platform/upstream/coreutils.git
19 years agoAdd copyright and authorship notice.
Paul Eggert [Fri, 3 Dec 2004 06:44:30 +0000 (06:44 +0000)]
Add copyright and authorship notice.
(AT_FDCWD): Use the same value Solaris 9 uses.

19 years agoInclude "openat.h" before other include files.
Paul Eggert [Fri, 3 Dec 2004 06:43:59 +0000 (06:43 +0000)]
Include "openat.h" before other include files.
Include "exitfail.h".
(openat): Remove #undef; no longer needed now that we include openat.h first.
(rpl_openat): Add comment about mode_t promotion.  Simplify
code a bit by moving initializations around.  Use exit_failure
rather than EXIT_FAILURE.

19 years agosave-cwd.c: Include "save-cwd.h" before other include files.
Paul Eggert [Fri, 3 Dec 2004 06:25:03 +0000 (06:25 +0000)]
save-cwd.c: Include "save-cwd.h" before other include files.
(O_DIRECTORY): Remove; not needed here, since "." must be
a directory.  All uses removed.
(save_cwd): Use __sgi || __sun, not sun || __sun.  __sun is
universal on Suns, and we also need to test for IRIX.
Revamp code to use 'if' rather than '#if'.
Avoid unnecessary comparison of cwd->desc to 0.

19 years ago*** empty log message ***
Jim Meyering [Thu, 2 Dec 2004 07:47:18 +0000 (07:47 +0000)]
*** empty log message ***

19 years agoWith using --color and with LS_COLORS saying not to color
Jim Meyering [Thu, 2 Dec 2004 07:47:14 +0000 (07:47 +0000)]
With using --color and with LS_COLORS saying not to color
executables, don't stat every file.

(is_colored): New function.
(gobble_file): Use it.
(main): Use it here, in place of too-strict tests against NULL:
if either ORPHAN or MISSING was set to 0 from LS_COLORS, the
old test would fail.

19 years agoAssume setlocale, locale.h, and localeconv exist and work.
Paul Eggert [Thu, 2 Dec 2004 06:57:05 +0000 (06:57 +0000)]
Assume setlocale, locale.h, and localeconv exist and work.

19 years ago(different): Assume setlocale exists.
Paul Eggert [Thu, 2 Dec 2004 06:56:28 +0000 (06:56 +0000)]
(different): Assume setlocale exists.

19 years agoAssume locale.h exists.
Paul Eggert [Thu, 2 Dec 2004 06:56:08 +0000 (06:56 +0000)]
Assume locale.h exists.
(HAVE_SETLOCALE): Remove.

19 years ago(C_DECIMAL_POINT): Remove. Use changed to '.'.
Paul Eggert [Thu, 2 Dec 2004 06:55:31 +0000 (06:55 +0000)]
(C_DECIMAL_POINT): Remove.  Use changed to '.'.
Assume setlocale exists.
(thousands_sep): Renamed from th_sep.
(IS_THOUSANDS_SEP): Remove.  All uses replaced by comparisons.
(NONZERO): Parenthesize use of arg.
(numcompare): Avoid duplicate loads.  Use ISDIGIT as boolean, for
consistency.  Avoid unnecessary negation by reversing
fraccompare args.
(main): Rewrite localeconv call to match seq.c.

19 years ago(decimal_point): Treat like sort. Now char.
Paul Eggert [Thu, 2 Dec 2004 06:55:08 +0000 (06:55 +0000)]
(decimal_point): Treat like sort.  Now char.
All uses changed.

19 years ago(keycmp): Assume setlocale exists.
Paul Eggert [Thu, 2 Dec 2004 06:54:40 +0000 (06:54 +0000)]
(keycmp):  Assume setlocale exists.

19 years ago(compare_files): Assume setlocale exists.
Paul Eggert [Thu, 2 Dec 2004 06:54:16 +0000 (06:54 +0000)]
(compare_files): Assume setlocale exists.

19 years ago(gl_MACROS): Assume localeconv exists.
Paul Eggert [Thu, 2 Dec 2004 06:53:49 +0000 (06:53 +0000)]
(gl_MACROS): Assume localeconv exists.

19 years ago(gl_HUMAN): Assume locale.h and localeconv exist.
Paul Eggert [Thu, 2 Dec 2004 06:53:29 +0000 (06:53 +0000)]
(gl_HUMAN): Assume locale.h and localeconv exist.

19 years ago(gl_HARD_LOCALE): Assume locale.h and setlocale exist.
Paul Eggert [Thu, 2 Dec 2004 06:53:00 +0000 (06:53 +0000)]
(gl_HARD_LOCALE): Assume locale.h and setlocale exist.

19 years agoAssume <locale.h> exists.
Paul Eggert [Thu, 2 Dec 2004 06:52:10 +0000 (06:52 +0000)]
Assume <locale.h> exists.
(human_readable): Assume localeconv exists.

19 years agoAssume <locale.h> exists.
Paul Eggert [Thu, 2 Dec 2004 06:51:46 +0000 (06:51 +0000)]
Assume <locale.h> exists.
Include "strdup.h".
(GLIBC_VERSION): New macro.
(hard_locale): Assume setlocale exists.
Rewrite to avoid #ifdef.
Use strdup rather than malloc + strcpy.

19 years ago* src/ls.c (sort_files): Minor cleanup.
Paul Eggert [Thu, 2 Dec 2004 00:32:00 +0000 (00:32 +0000)]
* src/ls.c (sort_files): Minor cleanup.

19 years ago(sort_files): Minor cleanup. Remove an unnecessary
Paul Eggert [Thu, 2 Dec 2004 00:31:43 +0000 (00:31 +0000)]
(sort_files): Minor cleanup.  Remove an unnecessary
'volatile' on a local variable.  Rewrite to avoid unnecessary
double-assignment to 'func' in the usual case where strcoll does
not fail.

19 years agoRegenerate.
Paul Eggert [Wed, 1 Dec 2004 07:16:36 +0000 (07:16 +0000)]
Regenerate.

19 years ago* getcwd.c: Use system getcwd first, if appropriate.
Paul Eggert [Wed, 1 Dec 2004 07:13:35 +0000 (07:13 +0000)]
* getcwd.c: Use system getcwd first, if appropriate.

19 years ago* getcwd-path-max.m4 (gl_FUNC_GETCWD_PATH_MAX):
Paul Eggert [Wed, 1 Dec 2004 07:13:11 +0000 (07:13 +0000)]
* getcwd-path-max.m4 (gl_FUNC_GETCWD_PATH_MAX):
Define HAVE_PARTLY_WORKING_GETCWD if getcwd is partly working.

19 years ago(gl_FUNC_GETCWD_PATH_MAX):
Paul Eggert [Wed, 1 Dec 2004 07:12:46 +0000 (07:12 +0000)]
(gl_FUNC_GETCWD_PATH_MAX):
Define HAVE_PARTLY_WORKING_GETCWD if getcwd is partly working.

19 years ago(is_ENAMETOOLONG): New macro.
Paul Eggert [Wed, 1 Dec 2004 07:12:14 +0000 (07:12 +0000)]
(is_ENAMETOOLONG): New macro.
(__getcwd.c): Don't restore errno; glibc doesn't.
[HAVE_PARTLY_WORKING_GETCWD && !defined AT_FDCWD]: Try system getcwd
first, falling back to our code only if its results look suspicious.
Ensure that the resulting buffer is only as large as necessary.

19 years agoGo back to including <sys/types.h> rather than <stddef.h>; this is
Paul Eggert [Wed, 1 Dec 2004 07:07:38 +0000 (07:07 +0000)]
Go back to including <sys/types.h> rather than <stddef.h>; this is
needed on OpenBSD since its <utmp.h> needs time_t without making sure
that time_t is defined.

19 years ago* readutmp.m4 (gl_READUTMP): Don't check for sys/param.h.
Paul Eggert [Tue, 30 Nov 2004 21:48:33 +0000 (21:48 +0000)]
* readutmp.m4 (gl_READUTMP): Don't check for sys/param.h.

19 years ago(gl_READUTMP): Don't check for sys/param.h.
Paul Eggert [Tue, 30 Nov 2004 21:48:23 +0000 (21:48 +0000)]
(gl_READUTMP): Don't check for sys/param.h.

19 years agoMake readutmp more consistent among its client code.
Paul Eggert [Tue, 30 Nov 2004 21:41:31 +0000 (21:41 +0000)]
Make readutmp more consistent among its client code.

19 years ago(USER_PROCESS, RUN_LVL, INIT_PROCESS, LOGIN_PROCESS,
Paul Eggert [Tue, 30 Nov 2004 21:41:09 +0000 (21:41 +0000)]
(USER_PROCESS, RUN_LVL, INIT_PROCESS, LOGIN_PROCESS,
DEAD_PROCESS, BOOT_TIME, NEW_TIME, UT_TYPE_UNDEF, UT_TYPE): Remove.
(IS_USER_PROCESS): Move to ../lib/readutmp.h.
(UT_TYPE_RUN_LVL, UT_TYPE_INIT_PROCESS, UT_TYPE_LOGIN_PROCESS,
UT_TYPE_DEAD_PROCESS, UT_TYPE_NEW_TIME): New macros.
(gethostname): Remove decl.
(list_entries_who, scan_entries): Use the new macros defined above,
for consistency with pinky, uptime, and users.

19 years ago(list_entries_users): Use IS_USER_PROCESS
Paul Eggert [Tue, 30 Nov 2004 21:40:52 +0000 (21:40 +0000)]
(list_entries_users): Use IS_USER_PROCESS
instead of by-hand code.

19 years ago(print_uptime): Use IS_USER_PROCESS and
Paul Eggert [Tue, 30 Nov 2004 21:40:29 +0000 (21:40 +0000)]
(print_uptime): Use IS_USER_PROCESS and
UT_TYPE_BOOT_TIME instead of by-hand code.

19 years ago(gethostname): Remove decl.
Paul Eggert [Tue, 30 Nov 2004 21:40:12 +0000 (21:40 +0000)]
(gethostname): Remove decl.
(scan_entries): Use IS_USER_PROCESS instead of by-hand code.
* src/uptime.c (print_uptime): Use IS_USER_PROCESS and
UT_TYPE_BOOT_TIME instead of by-hand code.

19 years agoDon't include <sys/types.h>, <errno.h>,
Paul Eggert [Tue, 30 Nov 2004 21:39:46 +0000 (21:39 +0000)]
Don't include <sys/types.h>, <errno.h>,
<sys/param.h>, <time.h>; not needed to establish interface.
Include <stddef.h> instead.
(errno): Remove decl.
(HAVE_STRUCT_XTMP_UT_TYPE): Remove; no longer needed.
(UT_TYPE_EQ, UT_TYPE_NOT_DEFINED, UT_TYPE_BOOT_TIME,
UT_TYPE_USER_PROCESS, IS_USER_PROCESS): New macros.

19 years agoInclude readutmp.h first.
Paul Eggert [Tue, 30 Nov 2004 21:39:26 +0000 (21:39 +0000)]
Include readutmp.h first.
Include <errno.h>, since readutmp.h no longer does that.

19 years agotweak temp file name to be more consistent
Jim Meyering [Tue, 30 Nov 2004 15:01:01 +0000 (15:01 +0000)]
tweak temp file name to be more consistent

19 years ago.
Jim Meyering [Tue, 30 Nov 2004 14:58:46 +0000 (14:58 +0000)]
.

19 years ago.
Jim Meyering [Tue, 30 Nov 2004 14:53:34 +0000 (14:53 +0000)]
.

19 years ago*** empty log message ***
Jim Meyering [Tue, 30 Nov 2004 14:53:26 +0000 (14:53 +0000)]
*** empty log message ***

19 years ago*** empty log message ***
Jim Meyering [Tue, 30 Nov 2004 14:53:17 +0000 (14:53 +0000)]
*** empty log message ***

19 years agorename from chdir.m4
Jim Meyering [Tue, 30 Nov 2004 14:52:34 +0000 (14:52 +0000)]
rename from chdir.m4

19 years agorename to chdir-long.m4
Jim Meyering [Tue, 30 Nov 2004 14:52:21 +0000 (14:52 +0000)]
rename to chdir-long.m4

19 years ago.
Jim Meyering [Tue, 30 Nov 2004 14:48:02 +0000 (14:48 +0000)]
.

19 years agorenamed to chdir-long.[ch]
Jim Meyering [Tue, 30 Nov 2004 14:47:47 +0000 (14:47 +0000)]
renamed to chdir-long.[ch]

19 years ago*** empty log message ***
Jim Meyering [Tue, 30 Nov 2004 14:47:16 +0000 (14:47 +0000)]
*** empty log message ***

19 years ago(libfetish_a_SOURCES): Reflect name changes: chdir.[ch] -> chdir-long.[ch]
Jim Meyering [Tue, 30 Nov 2004 14:47:08 +0000 (14:47 +0000)]
(libfetish_a_SOURCES): Reflect name changes: chdir.[ch] -> chdir-long.[ch]

19 years agoInclude chdir-long.h rather than chdir.h.
Jim Meyering [Tue, 30 Nov 2004 14:46:25 +0000 (14:46 +0000)]
Include chdir-long.h rather than chdir.h.
(restore_cwd): Use chdir_long, not chdir.

19 years ago*** empty log message ***
Jim Meyering [Tue, 30 Nov 2004 14:46:09 +0000 (14:46 +0000)]
*** empty log message ***

19 years ago[!defined PATH_MAX]: Define chdir_long to chdir on systems like the Hurd.
Jim Meyering [Tue, 30 Nov 2004 14:45:28 +0000 (14:45 +0000)]
[!defined PATH_MAX]: Define chdir_long to chdir on systems like the Hurd.

19 years agoRenamed from chdir.h.
Jim Meyering [Tue, 30 Nov 2004 14:35:46 +0000 (14:35 +0000)]
Renamed from chdir.h.

19 years agoRenamed from chdir.c.
Jim Meyering [Tue, 30 Nov 2004 14:35:33 +0000 (14:35 +0000)]
Renamed from chdir.c.

19 years ago*** empty log message ***
Jim Meyering [Tue, 30 Nov 2004 14:24:55 +0000 (14:24 +0000)]
*** empty log message ***

19 years ago(O_DIRECTORY): Define, if necessary.
Jim Meyering [Tue, 30 Nov 2004 14:24:40 +0000 (14:24 +0000)]
(O_DIRECTORY): Define, if necessary.
(memchrcspn): Tiny wrapper around memchr.
(rpl_chdir): Use memchrcspn rather than strcspn.

19 years ago*** empty log message ***
Jim Meyering [Sun, 28 Nov 2004 22:43:11 +0000 (22:43 +0000)]
*** empty log message ***

19 years ago(rpl_openat): Also accept optional mode parameter.
Jim Meyering [Sun, 28 Nov 2004 22:42:08 +0000 (22:42 +0000)]
(rpl_openat): Also accept optional mode parameter.
Adjust prototype

19 years ago(rpl_openat): Also accept optional mode parameter.
Jim Meyering [Sun, 28 Nov 2004 22:41:57 +0000 (22:41 +0000)]
(rpl_openat): Also accept optional mode parameter.

19 years agoDon't let error uses in #if-0'd code trigger `make distcheck' failure.
Jim Meyering [Sun, 28 Nov 2004 22:24:38 +0000 (22:24 +0000)]
Don't let error uses in #if-0'd code trigger `make distcheck' failure.

19 years ago(main): Appease the gods.
Jim Meyering [Sun, 28 Nov 2004 21:29:16 +0000 (21:29 +0000)]
(main): Appease the gods.

19 years ago.
Jim Meyering [Sun, 28 Nov 2004 21:26:17 +0000 (21:26 +0000)]
.

19 years ago*** empty log message ***
Jim Meyering [Sun, 28 Nov 2004 21:26:06 +0000 (21:26 +0000)]
*** empty log message ***

19 years agoAdd lib/openat.c.
Jim Meyering [Sun, 28 Nov 2004 21:26:02 +0000 (21:26 +0000)]
Add lib/openat.c.

19 years ago*** empty log message ***
Jim Meyering [Sun, 28 Nov 2004 21:13:59 +0000 (21:13 +0000)]
*** empty log message ***

19 years ago*** empty log message ***
Jim Meyering [Sun, 28 Nov 2004 21:03:13 +0000 (21:03 +0000)]
*** empty log message ***

19 years agoInclude "chdir.h", so that if save_cwd/getcwd
Jim Meyering [Sun, 28 Nov 2004 21:03:08 +0000 (21:03 +0000)]
Include "chdir.h", so that if save_cwd/getcwd
saves a name longer than PATH_MAX, restore_cwd's chdir can use it.

19 years ago.
Jim Meyering [Sun, 28 Nov 2004 21:01:03 +0000 (21:01 +0000)]
.

19 years ago*** empty log message ***
Jim Meyering [Sun, 28 Nov 2004 20:55:38 +0000 (20:55 +0000)]
*** empty log message ***

19 years ago*** empty log message ***
Jim Meyering [Sun, 28 Nov 2004 20:55:05 +0000 (20:55 +0000)]
*** empty log message ***

19 years ago(gl_MACROS): Require gl_FUNC_CHDIR.
Jim Meyering [Sun, 28 Nov 2004 20:54:54 +0000 (20:54 +0000)]
(gl_MACROS): Require gl_FUNC_CHDIR.

19 years ago.
Jim Meyering [Sun, 28 Nov 2004 20:52:04 +0000 (20:52 +0000)]
.

19 years ago*** empty log message ***
Jim Meyering [Sun, 28 Nov 2004 20:51:57 +0000 (20:51 +0000)]
*** empty log message ***

19 years ago(libfetish_a_SOURCES): Add chdir.h and openat.h.
Jim Meyering [Sun, 28 Nov 2004 20:51:46 +0000 (20:51 +0000)]
(libfetish_a_SOURCES): Add chdir.h and openat.h.

19 years ago*** empty log message ***
Jim Meyering [Sun, 28 Nov 2004 20:51:05 +0000 (20:51 +0000)]
*** empty log message ***

19 years ago*** empty log message ***
Jim Meyering [Sun, 28 Nov 2004 20:50:26 +0000 (20:50 +0000)]
*** empty log message ***

19 years agoThis is a robust version of chdir, in that it can handle directory
Jim Meyering [Sun, 28 Nov 2004 20:49:14 +0000 (20:49 +0000)]
This is a robust version of chdir, in that it can handle directory
names longer than PATH_MAX.

19 years agoadd another FIXME, to make it obvious
Jim Meyering [Sun, 28 Nov 2004 20:49:04 +0000 (20:49 +0000)]
add another FIXME, to make it obvious

19 years agoThis is a robust version of chdir, in that it can handle directory
Jim Meyering [Sun, 28 Nov 2004 20:48:29 +0000 (20:48 +0000)]
This is a robust version of chdir, in that it can handle directory
names longer than PATH_MAX.

19 years ago* coreutils.texi (du invocation): Minor cleanups.
Paul Eggert [Sat, 27 Nov 2004 09:37:42 +0000 (09:37 +0000)]
* coreutils.texi (du invocation): Minor cleanups.

19 years ago(du invocation): Use if=/dev/null rather
Paul Eggert [Sat, 27 Nov 2004 09:37:22 +0000 (09:37 +0000)]
(du invocation): Use if=/dev/null rather
than :|.  Problem reported by Dan Jacobson.
Use "seek=2GiB" rather than the wordier "seek=`echo '2^31'|bc`".
Say "KiB" not the (inaccurate) "kilobytes".
Similarly for "GiB" and "gigabytes".

19 years agoRegenerate.
Paul Eggert [Fri, 26 Nov 2004 08:11:52 +0000 (08:11 +0000)]
Regenerate.

19 years agoFix problem reported by Scott S. Tinsley for HP-UX 11.11 using
Paul Eggert [Fri, 26 Nov 2004 07:41:22 +0000 (07:41 +0000)]
Fix problem reported by Scott S. Tinsley for HP-UX 11.11 using
HP's ANSI C compiler.

19 years agoFix problems reported by Scott S. Tinsley for HP-UX 11.11 using
Paul Eggert [Fri, 26 Nov 2004 07:40:56 +0000 (07:40 +0000)]
Fix problems reported by Scott S. Tinsley for HP-UX 11.11 using
HP's ANSI C compiler.

19 years ago(MIN) [defined MIN]: Don't define, since it's already defined.
Paul Eggert [Fri, 26 Nov 2004 07:40:41 +0000 (07:40 +0000)]
(MIN) [defined MIN]: Don't define, since it's already defined.

19 years ago(statvfs) [HAVE_SYS_STATVFS_H]: Remove decl.
Paul Eggert [Fri, 26 Nov 2004 07:40:23 +0000 (07:40 +0000)]
(statvfs) [HAVE_SYS_STATVFS_H]: Remove decl.
Declaring int functions causes warnings on some modern systems and
shouldn't be needed to compile on ancient ones.

19 years ago(link, symlink): Remove decls.
Paul Eggert [Fri, 26 Nov 2004 07:39:57 +0000 (07:39 +0000)]
(link, symlink): Remove decls.

19 years ago(stat): Remove decl.
Paul Eggert [Fri, 26 Nov 2004 07:39:32 +0000 (07:39 +0000)]
(stat): Remove decl.

19 years ago(stat, lstat, rename): Remove decls.
Paul Eggert [Fri, 26 Nov 2004 07:39:14 +0000 (07:39 +0000)]
(stat, lstat, rename): Remove decls.

19 years agofilesystems -> file systems
Paul Eggert [Fri, 26 Nov 2004 07:27:45 +0000 (07:27 +0000)]
filesystems -> file systems

19 years agoremove SPACEs before TABs
Jim Meyering [Thu, 25 Nov 2004 22:17:55 +0000 (22:17 +0000)]
remove SPACEs before TABs

19 years agoRecent getcwd fixes.
Paul Eggert [Thu, 25 Nov 2004 20:05:15 +0000 (20:05 +0000)]
Recent getcwd fixes.

19 years agoRecent getcwd fixes.
Paul Eggert [Thu, 25 Nov 2004 20:04:39 +0000 (20:04 +0000)]
Recent getcwd fixes.

19 years ago(gl_XGETCWD): Replace with gl_FUNC_GETCWD, since
Paul Eggert [Thu, 25 Nov 2004 20:02:20 +0000 (20:02 +0000)]
(gl_XGETCWD): Replace with gl_FUNC_GETCWD, since
that's all we need now.

19 years ago(gl_PREREQ): Add gl_FUNC_MEMPCPY.
Paul Eggert [Thu, 25 Nov 2004 20:01:08 +0000 (20:01 +0000)]
(gl_PREREQ): Add gl_FUNC_MEMPCPY.

19 years ago(gl_MACROS): Don't require GL_FUNC_GETCWD_PATH_MAX.
Paul Eggert [Thu, 25 Nov 2004 19:29:36 +0000 (19:29 +0000)]
(gl_MACROS): Don't require GL_FUNC_GETCWD_PATH_MAX.

19 years ago(gl_FUNC_GETCWD_NULL): Renamed from
Paul Eggert [Thu, 25 Nov 2004 19:28:28 +0000 (19:28 +0000)]
(gl_FUNC_GETCWD_NULL): Renamed from
AC_FUNC_GETCWD_NULL.  All used changed.  Change cache variable
name accordingly.
(gl_FUNC_GETCWD, gl_PREREQ_GETCWD): New macros.  Revamp to
accommodate new getcwd.c.

19 years ago(gl_FUNC_GETCWD_PATH_MAX): Renamed from
Paul Eggert [Thu, 25 Nov 2004 19:26:50 +0000 (19:26 +0000)]
(gl_FUNC_GETCWD_PATH_MAX): Renamed from
GL_FUNC_GETCWD_PATH_MAX for consistency.  All uses changed.
Use the _ONCE methods, for efficiency.
Check for fcntl.h.  In test program, include <errno.h>
and <fcntl.h> if available.  Remove old K&R cruft from
test program.  Check for common errors in GNU/Linux,
OpenBSD, and Solaris.  Just set gl_cv_func_getcwd_path_max;
don't do AC_LIBOBJ, as that's getcwd.m4's job.

19 years agoDavid MacKenzie's old code was removed, so give
Paul Eggert [Thu, 25 Nov 2004 19:25:07 +0000 (19:25 +0000)]
David MacKenzie's old code was removed, so give
credit only to Jim Meyering and adjust the copyright dates.
Do not include <limits.h>, <stdio.h>, <sys/types.h>,
<stdlib.h>, <unistd.h>, "pathmax.h".
Instead, include "xgetcwd.h" (first) and "getcwd.h".
(INITIAL_BUFFER_SIZE): Remove.
(xgetcwd): Rely on getcwd, since we now depend on a reliable one.

19 years agoReplace by a copy of glibc/sysdeps/posix/getcwd.c, but
Paul Eggert [Thu, 25 Nov 2004 19:23:32 +0000 (19:23 +0000)]
Replace by a copy of glibc/sysdeps/posix/getcwd.c, but
with the following changes.
(__set_errno): Parenthesize properly.
Include <stdbool.h>.
(MIN, MAX, MATCHING_INO): New macros.
(__getcwd): Define with prototype, not K&R form.
Use heuristics to allocate default buffer on stack if possible.
If AT_FDCWD is defined, use openat and fstatat to avoid O(N**2)
behavior, and to avoid the PATH_MAX limit when computing
../../../../...
Use MATCHING_INO to compare inode number to file.
Check for arithmetic overflow in size calculations.
Fix bug in reallocation of dot array that caused getcwd to fail
on directories nested deeper than 75.
Be more careful about saving errno on error.
Do not use realloc; use only free+malloc, as this is a bit
more flexible and avoids a needless copy operation.
Do not inspect st_dev and st_ino for symbolic links; POSIX
doesn't specify the latter.
Check for closedir errors.
Avoid needless casts.
Use "#ifdef weak_alias" around weak_alias, to be like other
glibc code.
The following changes to getcwd.c have effect only when used in
gnulib; they have no effect inside glibc proper.
(#pragma alloca) [defined _AIX && !defined __GNUC__]: Remove,
as alloca isn't used.
(alloca, __alloca): Likewise.
[!_LIBC]: Include "getcwd.h", "mempcpy.h".
Include <stddef.h>, <stdlib.h>, <string.h>, <limits.h>
unconditionally, as gnulib assumes C89 or better.
Do not include <sys/param.h>.
(errno) [!defined __GNU_LIBRARY__ && !defined STDC_HEADERS]: Remove
no-longer-necessary 'extern int errno' decl; gnulib assumes C89 or
better.
(NULL) [!defined NULL]: Remove; we assume C89 or better.
Include <dirent.h> in a way that is compatible with modern Autoconf.
(_D_ALLOC_NAMELEN, _D_EXACT_NAMLEN):
New macros, if not already defined.
Include <unistd.h> if _LIBC, not if __GNU_LIBRARY__.
Use "_LIBC", not "defined _LIBC", for consistency.
(HAVE_MEMPCPY): Remove; no longer needed now that gnulib has
a mempcpy module.
(__lstat, __closedir, __opendir, __readdir) [!_LIBC]: New macros.
(GETCWD_RETURN_TYPE): Remove.  All uses replaced by char *.

19 years ago(libfetish_a_SOURCES): Add getcwd.h, mempcpy.h.
Paul Eggert [Thu, 25 Nov 2004 19:20:13 +0000 (19:20 +0000)]
(libfetish_a_SOURCES): Add getcwd.h, mempcpy.h.

19 years agoInitial revision.
Paul Eggert [Thu, 25 Nov 2004 19:19:38 +0000 (19:19 +0000)]
Initial revision.

19 years agoImported from gnulib.
Paul Eggert [Thu, 25 Nov 2004 19:17:55 +0000 (19:17 +0000)]
Imported from gnulib.

19 years agoImported from gnulib.
Paul Eggert [Thu, 25 Nov 2004 19:16:12 +0000 (19:16 +0000)]
Imported from gnulib.