<HTML>
<HEAD>
<TITLE>Gnulib Module List</TITLE>
- <META NAME="keywords" CONTENT="acl, alloca, alloca-opt, allocsa, argmatch, argp, argz, assert, atexit, backupfile, base64, bcopy, binary-io, byteswap, c-bs-a, c-ctype, c-stack, c-strtod, c-strtold, calloc, canon-host, canonicalize, chdir-long, chown, classpath, cloexec, closeout, copy-file, csharpcomp, csharpexec, cycle-check, diacrit, dirfd, dirname, dummy, dup2, eealloc, error, euidaccess, exclude, execute, exit, exitfail, extensions, fatal-signal, file-type, fileblocks, filemode, filenamecat, findprog, fnmatch, fnmatch-gnu, fnmatch-posix, fpending, free, fsusage, ftruncate, fts, fts-lgpl, full-read, full-write, fwriteerror, gcd, getaddrinfo, getcwd, getdate, getdomainname, getgroups, gethostname, gethrxtime, getline, getloadavg, getlogin_r, getndelim2, getnline, getopt, getpagesize, getpass, getpass-gnu, getsubopt, gettext, gettime, gettimeofday, getugroups, getusershell, glob, group-member, hard-locale, hash, hash-pjw, human, iconv, iconvme, idcache, inet_ntop, inttostr, isdir, javacomp, javaexec, lchown, linebreak, linebuffer, localcharset, long-options, lstat, malloc, mathl, mbswidth, md5, memcasecmp, memchr, memcmp, memcoll, memcpy, memmem, memmove, mempcpy, memrchr, memset, minmax, mkdir, mkdir-p, mkdtemp, mkstemp, mktime, modechange, mountlist, nanosleep, obstack, openat, pagealign_alloc, pathmax, pathname, physmem, pipe, poll, posixtm, posixver, progname, putenv, quote, quotearg, raise, readlink, readtokens, readtokens0, readutmp, realloc, regex, rename, restrict, rmdir, rpmatch, safe-read, safe-write, same, save-cwd, savedir, setenv, settime, sh-quote, sha1, sig2str, snprintf, stat, stat-macros, stdbool, stdint, stdio-safer, stpcpy, stpncpy, strcase, strchrnul, strcspn, strdup, strerror, strftime, strndup, strnlen, strpbrk, strsep, strstr, strtod, strtoimax, strtok_r, strtol, strtoll, strtoul, strtoull, strtoumax, strverscmp, sysexits, time_r, timegm, timespec, tzset, ucs4-utf16, ucs4-utf8, ullong_max, unicodeio, unistd-safer, unlinkdir, unlocked-io, userspec, utf16-ucs4, utf8-ucs4, utime, utimecmp, utimens, vasnprintf, vasprintf, version-etc, version-etc-fsf, vsnprintf, wait-process, xalloc, xalloc-die, xallocsa, xgetcwd, xgetdomainname, xgethostname, xmemcoll, xnanosleep, xreadlink, xsetenv, xsize, xstrndup, xstrtod, xstrtoimax, xstrtol, xstrtoumax, xvasprintf, yesno">
+ <META NAME="keywords" CONTENT="acl, alloca, alloca-opt, allocsa, argmatch, argp, argz, assert, atexit, backupfile, base64, bcopy, binary-io, byteswap, calloc, canon-host, canonicalize, c-bs-a, c-ctype, chdir-long, chown, classpath, cloexec, closeout, copy-file, csharpcomp, csharpexec, c-stack, c-strtod, c-strtold, cycle-check, diacrit, dirfd, dirname, dummy, dup2, eealloc, error, euidaccess, exclude, execute, exit, exitfail, extensions, fatal-signal, fileblocks, filemode, filenamecat, file-type, findprog, fnmatch, fnmatch-gnu, fnmatch-posix, fpending, free, fsusage, ftruncate, fts, fts-lgpl, full-read, full-write, fwriteerror, gcd, getaddrinfo, getcwd, getdate, getdomainname, getgroups, gethostname, gethrxtime, getline, getloadavg, getlogin_r, getndelim2, getnline, getopt, getpagesize, getpass, getpass-gnu, getsubopt, gettext, gettime, gettimeofday, getugroups, getusershell, glob, group-member, hard-locale, hash, hash-pjw, human, iconv, iconvme, idcache, inet_ntop, inttostr, isdir, javacomp, javaexec, lchown, linebreak, linebuffer, localcharset, long-options, lstat, malloc, mathl, mbswidth, md5, memcasecmp, memchr, memcmp, memcoll, memcpy, memmem, memmove, mempcpy, memrchr, memset, minmax, mkdir, mkdir-p, mkdtemp, mkstemp, mktime, modechange, mountlist, nanosleep, obstack, openat, pagealign_alloc, pathmax, pathname, physmem, pipe, poll, posixtm, posixver, progname, putenv, quote, quotearg, raise, readlink, readtokens, readtokens0, readutmp, realloc, regex, rename, restrict, rmdir, rpmatch, safe-read, safe-write, same, save-cwd, savedir, setenv, settime, sha1, sh-quote, sig2str, snprintf, stat-macros, stdbool, stdint, stdio-safer, stpcpy, stpncpy, strcase, strchrnul, strcspn, strdup, strerror, strftime, strndup, strnlen, strpbrk, strsep, strstr, strtod, strtoimax, strtok_r, strtol, strtoll, strtoul, strtoull, strtoumax, strverscmp, sysexits, timegm, time_r, timespec, tzset, ucs4-utf16, ucs4-utf8, ullong_max, unicodeio, unistd-safer, unlinkdir, unlocked-io, userspec, utf16-ucs4, utf8-ucs4, utime, utimecmp, utimens, vasnprintf, vasprintf, version-etc, version-etc-fsf, vsnprintf, wait-process, xalloc, xalloc-die, xallocsa, xgetcwd, xgetdomainname, xgethostname, xmemcoll, xnanosleep, xreadlink, xsetenv, xsize, xstrndup, xstrtod, xstrtoimax, xstrtol, xstrtoumax, xvasprintf, yesno">
</HEAD>
<BODY>
<H1>Gnulib Module List</H1>
<TD ALIGN=LEFT VALIGN=TOP WIDTH="20%"><A HREF="#module=readlink">readlink</A>
<TD ALIGN=LEFT VALIGN=TOP WIDTH="80%"><A HREF="http://www.opengroup.org/onlinepubs/007904975/functions/readlink.html">readlink</A>() function: read the value of a symbolic link.
</TR>
- <TR WIDTH="100%">
- <TD ALIGN=LEFT VALIGN=TOP WIDTH="20%"><A HREF="#module=stat">stat</A>
- <TD ALIGN=LEFT VALIGN=TOP WIDTH="80%"><A HREF="http://www.opengroup.org/onlinepubs/007904975/functions/stat.html">stat</A>() function: return information about a file, following symbolic links.
- </TR>
<TR WIDTH="100%">
<TD ALIGN=LEFT VALIGN=TOP WIDTH="20%"><A HREF="#module=lstat">lstat</A>
- <TD ALIGN=LEFT VALIGN=TOP WIDTH="80%"><A HREF="http://www.opengroup.org/onlinepubs/007904975/functions/stat.html">stat</A>() function: return information about a file or symbolic link.
+ <TD ALIGN=LEFT VALIGN=TOP WIDTH="80%"><A HREF="http://www.opengroup.org/onlinepubs/007904975/functions/lstat.html">lstat</A>() function: return information about a file or symbolic link.
</TR>
<TR WIDTH="100%">
<TD ALIGN=LEFT VALIGN=TOP WIDTH="20%"><A HREF="#module=time_r">time_r</A>
<TD ALIGN=LEFT VALIGN=TOP><A HREF="m4/readlink.m4">readlink.m4</A><BR>gl_FUNC_READLINK
<TD ALIGN=LEFT VALIGN=TOP>---
</TR>
- <TR>
- <TD ALIGN=LEFT VALIGN=TOP><A NAME="module=stat"></A><A HREF="modules/stat">stat</A>
- <TD ALIGN=LEFT VALIGN=TOP>#include <<A HREF="http://www.opengroup.org/onlinepubs/007904975/basedefs/sys/stat.h.html">sys/stat.h</A>>
- <TD ALIGN=LEFT VALIGN=TOP><A HREF="lib/stat.c">stat.c</A>
- <TD ALIGN=LEFT VALIGN=TOP><A HREF="m4/stat.m4">stat.m4</A><BR>gl_FUNC_STAT
- <TD ALIGN=LEFT VALIGN=TOP>xalloc<BR>stat-macros
- </TR>
<TR>
<TD ALIGN=LEFT VALIGN=TOP><A NAME="module=lstat"></A><A HREF="modules/lstat">lstat</A>
- <TD ALIGN=LEFT VALIGN=TOP>#include <<A HREF="http://www.opengroup.org/onlinepubs/007904975/basedefs/sys/stat.h.html">sys/stat.h</A>>
+ <TD ALIGN=LEFT VALIGN=TOP>#include "<A HREF="lib/lstat.h">lstat.h</A>"
<TD ALIGN=LEFT VALIGN=TOP><A HREF="lib/lstat.c">lstat.c</A>
<TD ALIGN=LEFT VALIGN=TOP><A HREF="m4/lstat.m4">lstat.m4</A><BR>gl_FUNC_LSTAT
- <TD ALIGN=LEFT VALIGN=TOP>stat
+ <TD ALIGN=LEFT VALIGN=TOP>xalloc<BR>stat-macros
</TR>
<TR>
<TD ALIGN=LEFT VALIGN=TOP><A NAME="module=time_r"></A><A HREF="modules/time_r">time_r</A>
<LI>A testsuite
</UL>
<HR>
- Generated from <CODE>MODULES.html.sh</CODE> on 9 June 2005.
+ Generated from <CODE>MODULES.html.sh</CODE> on 24 June 2005.
</BODY>
</HTML>
-/* Work around the bug in some systems whereby lstat succeeds when
- given the zero-length file name argument. The lstat from SunOS 4.1.4
- has this bug.
+/* Work around a bug of lstat on some systems
- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free
Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-#define LSTAT
-#include "stat.c"
+/* written by Jim Meyering */
+
+#include <config.h>
+
+/* The specification of these functions is in sys_stat.h. But we cannot
+ include this include file here, because on some systems, a
+ "#define lstat lstat64" is being used, and sys_stat.h deletes this
+ definition. */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stat-macros.h"
+#include "xalloc.h"
+
+/* lstat works differently on Linux and Solaris systems. POSIX (see
+ `pathname resolution' in the glossary) requires that programs like `ls'
+ take into consideration the fact that FILE has a trailing slash when
+ FILE is a symbolic link. On Linux systems, the lstat function already
+ has the desired semantics (in treating `lstat("symlink/",sbuf)' just like
+ `lstat("symlink/.",sbuf)', but on Solaris it does not.
+
+ If FILE has a trailing slash and specifies a symbolic link,
+ then append a `.' to FILE and call lstat a second time. */
+
+int
+rpl_lstat (const char *file, struct stat *sbuf)
+{
+ size_t len;
+ char *new_file;
+
+ int lstat_result = lstat (file, sbuf);
+
+ if (lstat_result != 0 || !S_ISLNK (sbuf->st_mode))
+ return lstat_result;
+
+ len = strlen (file);
+ if (len == 0 || file[len - 1] != '/')
+ return lstat_result;
+
+ /* FILE refers to a symbolic link and the name ends with a slash.
+ Append a `.' to FILE and repeat the lstat call. */
+
+ /* Add one for the `.' we'll append, and one more for the trailing NUL. */
+ new_file = xmalloc (len + 1 + 1);
+ memcpy (new_file, file, len);
+ new_file[len] = '.';
+ new_file[len + 1] = 0;
+
+ lstat_result = lstat (new_file, sbuf);
+ free (new_file);
+
+ return lstat_result;
+}
+++ /dev/null
-/* Work around the bug in some systems whereby stat/lstat succeeds when
- given the zero-length file name argument. The stat/lstat from SunOS 4.1.4
- has this bug. Also work around a deficiency in Solaris systems (up to at
- least Solaris 9) regarding the semantics of `lstat ("symlink/", sbuf).'
-
- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free
- Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* written by Jim Meyering */
-
-#include <config.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#if defined LSTAT && ! LSTAT_FOLLOWS_SLASHED_SYMLINK
-# include <stdlib.h>
-# include <string.h>
-
-# include "stat-macros.h"
-# include "xalloc.h"
-
-/* lstat works differently on Linux and Solaris systems. POSIX (see
- `pathname resolution' in the glossary) requires that programs like `ls'
- take into consideration the fact that FILE has a trailing slash when
- FILE is a symbolic link. On Linux systems, the lstat function already
- has the desired semantics (in treating `lstat("symlink/",sbuf)' just like
- `lstat("symlink/.",sbuf)', but on Solaris it does not.
-
- If FILE has a trailing slash and specifies a symbolic link,
- then append a `.' to FILE and call lstat a second time. */
-
-static int
-slash_aware_lstat (const char *file, struct stat *sbuf)
-{
- size_t len;
- char *new_file;
-
- int lstat_result = lstat (file, sbuf);
-
- if (lstat_result != 0 || !S_ISLNK (sbuf->st_mode))
- return lstat_result;
-
- len = strlen (file);
- if (file[len - 1] != '/')
- return lstat_result;
-
- /* FILE refers to a symbolic link and the name ends with a slash.
- Append a `.' to FILE and repeat the lstat call. */
-
- /* Add one for the `.' we'll append, and one more for the trailing NUL. */
- new_file = xmalloc (len + 1 + 1);
- memcpy (new_file, file, len);
- new_file[len] = '.';
- new_file[len + 1] = 0;
-
- lstat_result = lstat (new_file, sbuf);
- free (new_file);
-
- return lstat_result;
-}
-#endif /* LSTAT && ! LSTAT_FOLLOWS_SLASHED_SYMLINK */
-
-/* This is a wrapper for stat/lstat.
- If FILE is the empty string, fail with errno == ENOENT.
- Otherwise, return the result of calling the real stat/lstat.
-
- This works around the bug in some systems whereby stat/lstat succeeds when
- given the zero-length file name argument. The stat/lstat from SunOS 4.1.4
- has this bug. */
-
-/* This function also provides a version of lstat with consistent semantics
- when FILE specifies a symbolic link and has a trailing slash. */
-
-#ifdef LSTAT
-# define rpl_xstat rpl_lstat
-# if ! LSTAT_FOLLOWS_SLASHED_SYMLINK
-# define xstat_return_val(F, S) slash_aware_lstat (F, S)
-# else
-# define xstat_return_val(F, S) lstat (F, S)
-# endif
-#else
-# define rpl_xstat rpl_stat
-# define xstat_return_val(F, S) stat (F, S)
-#endif
-
-int
-rpl_xstat (const char *file, struct stat *sbuf)
-{
- if (file && *file == 0)
- {
- errno = ENOENT;
- return -1;
- }
-
- return xstat_return_val (file, sbuf);
-}