diff --git a/ChangeLog b/ChangeLog index a21e9a456..67c9e1a71 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-10-31 Tor Lillqvist + + * glib/gstdio.[ch]: Add g_lstat(). + 2004-10-29 Matthias Clasen * glib/goption.c: Doc additions. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index a21e9a456..67c9e1a71 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,7 @@ +2004-10-31 Tor Lillqvist + + * glib/gstdio.[ch]: Add g_lstat(). + 2004-10-29 Matthias Clasen * glib/goption.c: Doc additions. diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index a21e9a456..67c9e1a71 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,7 @@ +2004-10-31 Tor Lillqvist + + * glib/gstdio.[ch]: Add g_lstat(). + 2004-10-29 Matthias Clasen * glib/goption.c: Doc additions. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index a21e9a456..67c9e1a71 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,7 @@ +2004-10-31 Tor Lillqvist + + * glib/gstdio.[ch]: Add g_lstat(). + 2004-10-29 Matthias Clasen * glib/goption.c: Doc additions. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index a21e9a456..67c9e1a71 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,7 @@ +2004-10-31 Tor Lillqvist + + * glib/gstdio.[ch]: Add g_lstat(). + 2004-10-29 Matthias Clasen * glib/goption.c: Doc additions. diff --git a/glib/gstdio.c b/glib/gstdio.c index 5cb95e239..d0c194165 100644 --- a/glib/gstdio.c +++ b/glib/gstdio.c @@ -206,7 +206,7 @@ g_mkdir (const gchar *filename, * * See the C library manual for more details about stat(). * - * Returns: 0 if the directory was successfully created, -1 if an error + * Returns: 0 if the information was successfully retrieved, -1 if an error * occurred * * Since: 2.6 @@ -243,6 +243,36 @@ g_stat (const gchar *filename, #endif } +/** + * g_lstat: + * @filename: a pathname in the GLib file name encoding + * @buf: a pointer to a stat struct, which + * will be filled with the file information + * + * A wrapper for the POSIX lstat() function. The lstat() function is + * like stat() except that in the case of symbolic links, it returns + * information about the symbolic link itself and not the file that it + * refers to. On Windows where there are no symbolic links g_lstat() + * is identical to g_stat(). + * + * See the C library manual for more details about lstat(). + * + * Returns: 0 if the information was successfully retrieved, -1 if an error + * occurred + * + * Since: 2.6 + */ +int +g_lstat (const gchar *filename, + struct stat *buf) +{ +#ifdef G_OS_WIN32 + return g_stat (filename, buf); +#else + return lstat (filename, buf); +#endif +} + /** * g_unlink: * @filename: a pathname in the GLib file name encoding diff --git a/glib/gstdio.h b/glib/gstdio.h index 9594973f9..b4e0d03d4 100644 --- a/glib/gstdio.h +++ b/glib/gstdio.h @@ -47,6 +47,9 @@ int g_mkdir (const gchar *filename, int g_stat (const gchar *filename, struct stat *buf); +int g_lstat (const gchar *filename, + struct stat *buf); + int g_unlink (const gchar *filename); int g_remove (const gchar *filename);