2004-11-30 Jim Meyering Change the name of the robust chdir function from chdir to chdir_long. * save-cwd.c: Include chdir-long.h rather than chdir.h. (restore_cwd): Use chdir_long, not chdir. * chdir-long.c: Renamed from chdir.c. * chdir-long.h: Renamed from chdir.h. [!defined PATH_MAX]: Define chdir_long to chdir on systems like the Hurd. * chdir.c (O_DIRECTORY): Define, if necessary. (memchrcspn): Tiny wrapper around memchr. (rpl_chdir): Use memchrcspn rather than strcspn. 2004-11-28 Jim Meyering * openat.c (rpl_openat): Also accept optional mode parameter. * openat.h (rpl_openat): Adjust prototype. * save-cwd.c: Include "chdir.h", so that if save_cwd/getcwd saves a name longer than PATH_MAX, restore_cwd's chdir can use it. * Makefile.am (libfetish_a_SOURCES): Add chdir.h and openat.h. This is a robust version of chdir, in that it can handle directory names longer than PATH_MAX. * chdir.c, chdir.h: New file. * openat.c, openat.h: New files. 2004-11-25 Paul Eggert Fix problems reported by Scott S. Tinsley for HP-UX 11.11 using HP's ANSI C compiler. * fsusage.c (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. * same.c (MIN) [defined MIN]: Don't define, since it's already defined. * mempcpy.c, mempcpy.h: New files, taken from gnulib. * Makefile.am: (libfetish_a_SOURCES): Add getcwd.h, mempcpy.h. * getcwd.c: Replace by a copy of glibc/sysdeps/posix/getcwd.c, but with the following changes. (__set_errno): Parenthesize properly. Include . (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 , , , unconditionally, as gnulib assumes C89 or better. Do not include . (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 in a way that is compatible with modern Autoconf. (_D_ALLOC_NAMELEN, _D_EXACT_NAMLEN): New macros, if not already defined. Include 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 *. * xgetcwd.c: David MacKenzie's old code was removed, so give credit only to Jim Meyering and adjust the copyright dates. Do not include , , , , , "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. 2004-11-23 Paul Eggert * utimens.c (__attribute__, ATTRIBUTE_UNUSED): New macros. (futimens): New function, which uses futimes if available. (futimens, utimens): Support timespec==NULL, with same semantics as utime and utimens. * utimens.h (futimens): New decl. 2004-11-23 Sergey Poznyakoff * getopt_.h: Re-addition of __getopt_argv_const caused redefinition warnings. To avoid them, include the defines in `#if !defined __need_getopt ... #endif'. The only place where __getopt_argv_const is used is in definitions of getopt_long and getopt_long_only below, which are as well protected by `#ifndef __need_getopt'. [defined __GETOPT_PREFIX && !defined __need_getopt]: Undef __need_getopt after including and These headers might have defined it. 2004-11-23 Jim Meyering * closeout.c: Revert last change, since it seems EBADF is always defined. 2004-11-22 Jim Meyering * closeout.c (EBADF): Fail with `#error ...' if it's not defined, asking the user to report the problem. 2004-11-17 Paul Eggert * realloc.c (rpl_realloc): Call 'free' if n==0, since realloc might fail. Problem reported by Yoann Vandoorselaere. * calloc.c (rpl_calloc): Defend against buggy calloc implementations that mishandle size_t overflow. 2004-11-16 Paul Eggert * xgetcwd.c: Include , for PATH_MAX. (xgetcwd): Set errno correctly when failing. Work around Solaris 9 bug: getcwd sets errno==ERANGE even though the failure is actually due to a PATH_MAX problem. Further getopt changes to make it more likely that glibc will buy the changes back. * getopt.c (POSIXLY_CORRECT): New constant. (getopt): Use it, so to preserve glibc semantic * getopt1.c (getopt_long, getopt_long_only): Arg is char * const * when compiling for libc. * getopt_.h (__getopt_argv_const): Bring it back. (getopt_long, getopt_long_only): Use it. * getopt.c (_getopt_initialize, _getopt_internal_r, _getopt_internal): New arg POSIXLY_CORRECT. All callers changed. (getopt): Argv is now char * const *, as per standard. (_getopt_internal_r, _getopt_internal): Argv is now char **, not char *__getopt_argv_const *. * getopt1.c (getopt_long, _getopt_long_r, getopt_long_only, _getopt_long_only_r): Likewise. * getopt_.h (getopt, getopt_long, geopt_long_only): Likewise. * getopt_int.h (_getopt_internal, _getopt_internal_r, _getopt_long_r, _getopt_long_only_r): Likewise. * getopt_.h (__getopt_argv_const): Remove. (getopt): Argv is now char * const *, as per standard. * canon-host.c: Include "strdup.h". (canon_host): Use getaddrinfo if available, so that IPv6 works. Use strdup instead of malloc/strcpy to duplicate strings. * getdate.y (tORDINAL): New token. (day, relunit): Allow it for relative times. (relative_time_table): Use tORDINAL for ordinals. 2004-11-15 Paul Eggert * human.h (LONGEST_HUMAN_READABLE): Add 1 for space before unit. (human_space_before_unit): New constant. * human.c (human_readable): Support it. 2004-11-14 Jim Meyering * closeout.c (close_stdout): Don't fail just because stdout was closed initially, since some programs don't write to stdout in the normal course of operation (other than --version and --help), and we don't want this function to make e.g. `cp 1 2 >&-' fail. But do fail if it was closed and someone has tried to write to it. E.g., printf foo >&- * __fpending.c, __fpending.h: Restore these files. They're useful after all. * Makefile.am (libfetish_a_SOURCES): Add __fpending.h. 2004-11-11 Paul Eggert * getopt.c, getopt1.c, getopt_.h, getopt_int.h: Sync from gnulib. 2004-11-10 Paul Eggert * allocsa.h, mbswidth.c, mktime.c, readlink.c, getdate.y, quotearg.c, strftime.c: Sync from gnulib. 2004-11-06 Jim Meyering * __fpending.c, __fpending.h: Remove files. * Makefile.am (libfetish_a_SOURCES): Remove __fpending.h, now that it's no longer used. Ensure that no close failure goes unreported. * closeout.c (close_stdout): Always close stdout. I.e., don't return early when it seems there's nothing to flush. Don't include __fpending.h. 2004-11-03 Paul Eggert * unsetenv.c: New file, from gnulib. Needed for new getdate.y. * Makefile.am (libfetish_a_SOURCES): Remove setenv.c. * xreadlink.c: Sync from gnulib. 2004-11-03 Jim Meyering * Makefile.am (libfetish_a_SOURCES): Add setenv.c and setenv.h. 2004-11-02 Paul Eggert * getdate.y, getpass.c, setenv.h: Sync from gnulib. 2004-10-29 Paul Eggert * getdate.y, getpagesize.h, mktime.c: Sync from gnulib. 2004-10-24 Paul Eggert * mktime.c (leapyear): Arg is long int, not int. Change imported from gnulib. 2004-10-17 Paul Eggert Sync from gnulib. * diacrit.c, diacrit.h: Add copyright notice. * getpass.c (fflush_unlocked, flockfile, funlockfile) (fputs_unlocked, putc_unlocked) [!_LIBCS && !USE_UNLOCKED_IO]: Map to real functions. 2004-10-13 Jim Meyering * fts.c (fts_read): When about to fail (by returning NULL) due to a failed fchdir or failed fts_safe_changedir call, set `sp->fts_cur = p'. Do this by removing the explicit `return NULL;' statements and setting p->fts_errno so execution falls through to the common-case code below. Otherwise, after such a failure, calling fts_close would attempt to free an already-freed buffer. Reported by Luis Lopez Lopez in http://bugs.debian.org/276352. 2004-10-04 Paul Eggert Sync from gnulib. * xalloc.h (xmemdup): Renamed from xclone. * xmalloc.c (xmemdup): Likewise. * xalloc.h (CCLONE, CLONE, NEW, XCALLOC, XMALLOC, XREALLOC, XFREE): Remove these long-obsolescent macros. * xmalloc.c (xstrdup): Implementation moved here from xstrdup.c * xstrdup.c: Remove. * argmatch.c, closeout.c, error.c, exclude.c, getdate.y, getndelim2.c, getpass.c, getusershell.c, linebuffer.c, md5.c, mountlist.c, posixtm.c, readtokens.c, readutmp.c, regex.c, sha1.c, version-etc.c, yesno.c: Include "unlocked-io.h" only if USE_UNLOCKED_IO. * unlocked-io.h: Don't worry about USE_UNLOCKED_IO; that's now the includer's responsibility. 2004-10-03 Paul Eggert Sync from gnulib. * dirfd.h, getpagesize.h: Add copyright notice. * vasnprintf.c: (VASNPRINTF): Set errno=EOVERFLOW if the output is too long. * vasnprintf.h: Doc fix. * vasprintf.c: Don't include . (vasprintf): Rely on vasnprintf to set errno=EOVERFLOW. 2004-09-23 Paul Eggert * modechange.c (mode_compile): Don't decrement a pointer that points to the start of a string, as the C Standard says the resulting behavior is undefined. 2004-09-22 Jim Meyering * getopt.c: Remove extraneous spaces before TAB. * getopt_.h: Likewise. * backupfile.c: Remove trailing blanks. * euidaccess.c: Likewise. 2004-09-13 Paul Eggert * backupfile.h (enum backuptype): Rename none -> no_backups, simple -> simple_backups, numbered_existing -> numbered_existing_backups, numbered -> numbered_backups to avoid shadowing problems. All uses changed. * argmatch.c (enum backuptype): Likewise. * backupfile.c (check_extension, numbered_backup): Rename locals to avoid shadowing 'basename'. * backupfile.h (VALID_BACKUP_TYPE): Don't evaluate arg more than once. 2004-09-02 Paul Eggert Port to diet libc. Problem reported by Felix von Leitner in * fts.c (fts_stat, fts_open, fts_read): Use "unsigned short int" rather than the unportable "u_short", and similarly for u_int. * fts_.h (FTSENT): Likewise. 2004-08-19 Paul Eggert * getopt.c, getopt1.c: Sync from gnulib. * getopt_.h: Renamed from getopt.h (this syncs from gnulib). * Makefile.am (libfetish_a_SOURCES): Remove getopt.c, getopt.h, getopt1.c, getopt_int.h. (BUILT_SOURCES, EXTRA_DIST, all-local, $(lib_OBJECTS), getopt.h, MOSTLYCLEANFILES): Add current gnulib snippet for getopt. * .cppi-disable: Add getopt_.h, getopt_int.h. * .cvsignore: Add getopt.h. 2004-08-18 Paul Eggert * userspec.c: Don't use , so that we don't use alloca on strings on unbounded length. alloca's performance benefits aren't that important here. (V_STRDUP): Remove. (parse_with_separator): New function, with most of the internals of the old parse_user_spec. Allow user to omit both user and group, for compatibility with FreeBSD. Clone only the user name, not the entire spec. Do not set *uid, *gid unless entirely successful. Avoid memory leak in some failing cases. Fix regression for USER.GROUP reported by Dmitry V. Levin in (parse_user_spec): Rewrite to use parse_with_separator. 2004-08-11 Paul Eggert * fts.c (O_DIRECTORY): Define to 0 if the system doesn't define. * settime.c (settime): Recode to avoid warning with Sun Forte C 6U2. * obstack.c: Include and if available. (union fooround): Use uintmax_t, not long int. The rest is a merge from libc: [defined _LIBC]: Include . (_obstack) [defined _LIBC]: Remove after 2.3.4. * xgethostname.c: Do not include error.h. (merge from gnulib). * fnmatch.c (WIDE_CHAR_SUPPORT): Don't set to 1 if missing wmemchr or wmemcpy. Problem reported by Robert Dahlem for Reliant Unix 5.43. 2004-08-09 Paul Eggert * Makefile.am (libfetish_a_SOURCES): Add getpass.h. * getpass.h: New file. * .cpp-disable: Add it. * getpass.c [!_LIBC]: Include it. * obstack.h (obstack_empty_p): Don't assume that chunk->contents is suitably aligned. * obstack.c (_obstack_begin, _obstack_begin_1, _obstack_newchunk): Likewise. Problem reported by Benno in . * chown.c (rpl_chown): Work even if the file is writeable but not readable. This could be improved further but it'd take some work. * fts.c (diropen): New function. (fts_open, fts_read, fts_children, fts_safe_changedir): Use it, so that the code works even if the directory is writeable but not readable. We'd like it to work even if the directory is merely executable, but I don't know how to do that portably. * xalloc-die.c: New file. * xalloc.h (xalloc_fail_func, xalloc_msg_memory_exhausted): Remove. All uses removed. * xmalloc.c (xalloc_fail_func, xalloc_msg_memory_exhausted): Likewise. Move inclusions of gettext.h, error.h, exitfail.h to xalloc-die.c. (_, N_, xalloc_die): Move to xalloc-die.c. * userspec.c (parse_user_spaec): Use xstrdup rather than strdup, so that we needn't mess with xalloc_msg_memory_exhausted. * sha1.h (sha1_ctx): Renamed from sha_ctx. (sha1_init_ctx): Renamed from sha_init_ctx. (sha1_process_block): Renamed from sha_process_block. (sha1_process_bytes): Renamed from sha_process_bytes. (sha1_finish_ctx): Renamed from sha_finish_ctx. (sha1_read_ctx): Renamed from sha_read_ctx. (sha1_stream): Renamed from sha_stream. (sha1_buffer): Renamed from sha_buffer. * sha1.c: Likewise. 2004-08-07 Paul Eggert * canonicalize.h, cycle-check.h, stat-macros.h, strdup.h, strftime.h, xnanosleep.c: Merge from gnulib. 2004-08-05 Paul Eggert Merge with gnulib and deal with some minor cleanups resulting. * .cppi-disable: Change fnmatch.h to fnmatch_.h. * .cvsignore: Add fnmatch.h, poll.h, stdbool.h, sysexit.h. Remove safe-lstat.c, safe-lstat.h, safe-stat.c, safe-stat.h. * backupfile.h, closeout.h, full-write.h, mbswidth.h, xalloc.h: Add extern "C" wrappers for C++. * dirname.h (IS_ABSOLUTE_FILE_NAME): Port to DOS. * gettime.c (gettime): Fall back on `time' if `gettimeofday' doesn't work. * settime.c: Include , for stime (on Solaris 8, anyway). (ENOSYS): Define if not defined. (settime): Fall back on stime if it exists and settimeofday fails. But don't bother with fallbacks if a method fails with errno == EPERM. * obstack.h: Add white space. * printf-parse.c, printf-parse.h, vasnprintf.c: Merge changes from gnulib, but rewrite to avoid "xsize.h". 2004-08-04 Paul Eggert * mountlist.c (SIZE_MAX): Define after including files, to avoid a collision on OpenBSD 3.4. * fts.c (LONGEST_MODIFIER): New macro. (PRIuMAX) [!PRI_MACROS_BROKEN && !defined PRIuMAX]: New macro. (find_matching_ancestor): Use it for dev_t and ino_t. * getndelim2.c: Sync from gnulib. * error.c: Work around bug in OpenBSD 3.4 sterror_r: it sometimes returns a positive errno value even when it succeeds. (print_errno_message) [!LIBC]: Fall back on strerror if __strerror_r fails. 2004-08-02 Paul Eggert * canonicalize.c (errno): Remove decl; we now assume C89 or better. * chown.c (errno): Likewise. * closeout.c (errno): Likewise. * dup-safer.c (errno): Likewise. * dup2.c (errno): Likewise. * exclude.c (errno): Likewise. * fopen-safer.c (errno): Likewise. * ftruncate.c (errno): Likewise. * full-write.c (errno): Likewise. * getcwd.c (errno): Likewise. * lchown.c (errno): Likewise. * memcoll.c (errno): Likewise. * nanosleep.c (errno): Likewise. * putenv.c (errno): Likewise. * rmdir.c (errno): Likewise. * same.c (errno): Likewise. * savedir.c (errno): Likewise. * setenv.c (errno): Likewise. * stat.c (errno): Likewise. * utime.c (errno): Likewise. * xgetcwd.c (errno): Likewise. * xmemcoll.c (errno): Likewise. * xreadlink.c (errno): Likewise. * xstrtol.c (errno): Likewise. * canonicalize.h (enum canonicalize_mode_t): Reformat comments to fit in 80 columns. * fileblocks.c (textutils_fileblocks_unused): Make it a typedef instead of an int, to save a few bytes in the object file. * getdate.y (lookup_word): Rewrite to avoid cast. * getloadavg.c: Include . (getloadavg_initialized): Use bool for booleans. * hard-locale.c (hard_locale): Return bool, not int. * hard-locale.h (hard_locale): Likewise. Include . * hash.c (hash_string): Rewrite to avoid cast. * human.h: Use Autoconf-suggested pattern for inttypes and stdint. * strtiomax.c: Likewise. * xstrtol.h: Likewise. * nanosleep.c: Include stdbool.h. (rpl_nanosleep): Usee bool for booleans. * quotearg.c: Include stdbool.h. (quotearg_buffer_restyled): Use bool for booleans. * readtokens.c (readtoken): Rewrite to avoid casts. * same.c (same_name): Return bool, not int. * same.h (same_name): Likewise. Include . * version-etc.c (version_etc_va): Use size_t for sizes. * xnanosleep.c: Include limits.h, stdbool.h. (CHAR_BIT): Remove. (timespec_subtract, xnanosleep): Use bool for booleans. * xstrtoimax.c: Just include xstrtol.h rather than rolling our own include pattern. * xstrtoumax.c: Likewise. * xstrtol.c (__xstrtol): Rewrite to avoid casts. * yesno.c: Include yesno.h first. (yesno): Return bool, not int. * yesno.h (yesno): Likewise. Include . * xstrtod.h (xstrtod): Return bool, not int. Invert the sense of the boolean. All uses changed. * xstrtod.c (xstrtod): Likewise. * nanosleep.c: Include stdbool.h. Use bool for booleans. * xgethostname.c: Don't include or "exit.h"; no longer needed. (errno): Remove decl; we now assume C89 or better. Include unistd.h if available, for gethostname. (ENAMETOOLONG): Define to 0, not 9999, to avoid colliding with existing errno values if any. (gethostname): Remove decl, since unistd.h declares it (or doesn't, in which case it's an older system and it should just work). (xgethostname): Don't assume host name length is less than INT_MAX. Exit if malloc fails, just as the comment says. * save-cwd.c: Include . (errno): Remove decl; we now assume C89 or better. (save_cwd): Use bool for booleans. (save_cwd, restore_cwd): Return -1 on failure, not 1, since we set errno on failure. * readutmp.h (UT_USER): Parenthesize properly. (UT_USER_SIZE): New constant. (read_utmp): Don't assume that the number of users is less than INT_MAX. * readutmp.c (read_utmp): Likewise. Check for integer overflow in size calculations. Return -1 (not 1) on failure, since we set errno in that case. * posixtm.c (posix_time_parse): Don't assume that the length of the string being parsed is <= UINT_MAX. * mountlist.h (read_file_system_list): Accept bool flag, not int. * mountlist.c (read_file_system_list): Likewise. * mountlist.h: Include . * mountlist.c (errno): Remove decl; we now assume C89 or better. (xatoi): Remove; replaced by strtoul. Hence device numbers can now go up to ULONG_MAX. * isdir.c: Remove; no longer needed. * Makefile.am (libfetish_a_SOURCES): Remove isdir.c. * fts_.h: Add an FSF copyright notice, since our changes are becoming nontrivial. * fts.c: Likewise. * fts_.h: Include stddef.h, for ptrdiff_t. (FTS.fts_nitems): Now size_t, not int, for hosts that allow more than INT_MAX entries in a directory. (FTS_ROOTPARENTLEVEL): Parenthesize properly. (FTSENT.fts_level): Now ptrdiff_t, not int, to allow recursing more than INT_MAX levels deep on 64-bit hosts. (FTSENT.fts_namelen): Now size_t, not u_short, to support hosts like the Hurd that don't have arbitrary limits on directory entry lengths. (FTSENT.fts_statp): Now an array, not a pointer, so that we don't have to play unportable games with pointer arithmetic. Keep it array for the benefit of user code that assumes it is a pointer. * fts.c: Include stdint.h if available, as Autoconf suggests. (ALIGNBYTES, ALIGN): Remove; no longer needed now that fts_statp is an array. (fts_alloc, fts_palloc, fts_sort, fts_load, fts_build): Use size_t for sizes. (fts_stat, fts_safe_changedir, fts_debug, fts_read, fts_build, fts_palloc): Use bool when appropriate. (SIZE_MAX, TYPE_SIGNED): New macros. (fts_read): Use u_short for instructions. (fts_build): Use ptrdiff_t for levels. Don't assume file name lengths fit into int. Don't assume nlink_t is signed. (find_matching_ancestor): Don't assume dev, ino fit in int. (fts_stat): Use function prototype; required for bool arg. (fts_sort): Detect integer overflow in size calculations. (fts_alloc): Simplify allocation code, now that fts_statp is an array and not a pointer. * fsusage.h: Include . (struct fs_usage): Use uintmax_t for block sizes, so that they're not limited to INT_MAX. Use bool for booleans. * fsusage.c: Use Autoconf-suggested pattern for inttypes and stdint. Include unistd.h, for lseek. * fnmatch.c: Include . (errno): Remove decl; we now assume C89 or better. * fnmatch_loop.c (EXT, FCT): Use bool when appropriate. (FCT): Use size_t, not unsigned int, for sizes. (EXT): Use size_t, not int, for sizes. * stripslash.c (strip_trailing_slashes): Now returns bool. * dirname.h (strip_trailing_slashes): Likewise. Include . * dirname.c (dir_name): Use bool when appropriate. * argmatch.h (argmatch, __xargmatch_internal, argmatch_invalid): Use ptrdiff_t, not int, when counting arguments, to allow more than INT_MAX arguments. * argmatch.c: Likewise. Use bool when appropriate. 2004-08-01 Paul Eggert * safe-read.c (errno): Remove decl; we now assume C89 or better. (safe_rw): Don't work around Tru64 bug unless the bug symptoms manifest themselves. This allows us to do proper reads and writes on other hosts, e.g., "dd" with a block size greater than 2**31. * md5.c (UNALIGNED_P): Use size_t; in practice, this is just as good as uintptr_t in checking for alignments, and has fewer configuration hassles. * sha1.c (UNALIGNED_P): Likewise. * md5.h: Don't include . Include if available, as it defines symbols like UINT32_MAX on Solaris 8. (md5_uint32): Assume uint32_t exists; Autoconf will define it otherwise (if the host has a 32-bit unsigned type, anyway). * memchr.c: Don't include inttypes.h or stdint.h. (UNALIGNED_P): Remove. (__memchr): Use size_t, not uintptr_t, to test alignment. * memrchr.c: Likewise, for __memrchr. 2004-07-30 Paul Eggert * makepath.h: Include . (make_path, make_dir): Use bool, not int, since we're not setting errno. Use mode_t for modes, not int. All uses changed. * makepath.c: Likewise. (errno): Remove decl; no longer needed since we assume C89. 2004-07-29 Paul Eggert * modechange.c: Include . (mode_compile): Use bool when appropriate. * memchr.c (UNALIGNED_P): Use sizeof, not alignof, for better performance on m68k-linux. Reported by Andreas Schwab in . * memrchr.c (UNALIGNED_P): Likewise. 2004-07-28 Paul Eggert * userspec.c: Include , "inttostr.h". (V_STRDUP): Don't assume the string's length fits in int. (ISDIGIT): unsigned -> unsigned int (is_number): Define only ifdef __DJGPP__; not needed elsewhere. Use bool instead of int where appropriate. Do not allow empty strings. (parse_user_spec): Parse numbers as decimal integers, even if they have a leading 0. Don't assume uids and gids fit in int. * memchr.c: Include , not and . (LONG_MAX_32_BITS): Remove. Include and if available. (alignof, UNALIGNEDP): New macro, portable to all C89 hosts. (__memchr): Don't assume unsigned long int is either 4 or 8 bytes; let it be any number of bytes greater than or equal to 4. * memrchr.c: Likewise, with __memrchr. * md5.h: Include if HAVE_STDINT_H || _LIBC, not ifdef _LIBC. (md5_uint32): Use uint32_t if available. Simplify fallback ifdefs. * md5.c: Don't include or ; suffices with C89 or better. (alignof): New macro, portable to all C89 hosts. (UNALIGNED): Use it. Use uintptr_t if available, and assume everything is unaligned otherwise; this is more portable than assuming 'unsigned long int' will always work. * sha1.c: Likewise. * getugroups.c: Include . (EOVERFLOW): Define if not defined. (getgroups): Return -1 with errno=EOVERFLOW if an integer overflow occurs. 2004-07-27 Paul Eggert * euidaccess.c [HAVE_LIBGEN_H]: Include , for eaccess on Solaris and SVR4-like systems. (euidaccess): Use HAVE_EACCESS, not HAVE_DECL_EACCESS. cycle-check integer overflow fixup. * cycle-check.h: Remove now-inaccurate comment about the files you need to include first. You don't need to include any files other than the usual config.h. Include and if available, for uintmax_t. Remove 'struct stat;' not needed since we know sys/stat.h has been included by dev-ino.h. (struct cycle_check_state): Change chdir_counter to uintmax_t, not size_t, since it isn't limited by object sizes. Change magic from long unsigned int to int; that's good enough for our use. * cycle-check.c (is_zero_or_power_of_two): Renamed from is_power_of_two, to reflect better what it really does. All uses changed. Arg is now uintmax_t, not unsigned int (it should have been unsigned long int -- that was a bug). (cycle_check): Check for integer overflow in cycle count, and report a cycle if that happens, as it must be a cycle by this point. backupfile.c rewrite to avoid arbitrary limits on lengths of numeric backup extensions. * addext.c: Remove; no longer needed. * Makefile.am (libfetish_a_SOURCES): Remove addext.c. * backupfile.h (addext): Remove decl. * backupfile.c: Include "backupfile.h" first. Include errno.h, stdbool.h, limits.h, unistd.h, xalloc.h. (CLOSEDIR, INT_STRLEN_BOUND): Remove. (pathconf) [! (HAVE_PATHCONF && defined _PC_NAME_MAX)]: New macro. (_POSIX_NAME_MAX) [!defined _POSIX_NAME_MAX]: New macro. (NAME_MAX_MAXIMUM): New macro. Unlike the old addext.c, we also look at _XOPEN_NAME_MAX, for better performance on modern hosts that support only file names of length 255 or more. (ISDIGIT): unsigned -> unsigned int (max_backup_version, version_number): Remove. (check_extension): New function. Similar to the old addext, but static, assumes that the extension has already been added, and a bit more careful on DOS hosts. (numbered_backup): New function. It does what max_backup_version and version_number used to do, but it doesn't use integer arithmetic to calculate extensions so it doesn't overflow. (find_backup_file_name): Rewrite to use these new functions. This has a new optimization: we needn't call pathconf if the new numbered backup name has the same length as the old. Also, use xmalloc rather than malloc, so that the caller needn't worry about memory exhaustion. 2004-07-25 Paul Eggert * euidaccess.c [!defined LIBC]: Included group-member.h, stat-macros.h. (S_IXUSR, S_IXGRP, S_IXOTH, S_IROTH, S_IWOTH, S_IXOTH): Remove; now done by stat-macros.h. (NGROUPS_MAX, group_member): Remove; now done by group-member.h. No need to include . (errno): Remove decl; we now assume C89 or better. (access, getuid, getgid, geteuid, getegid, stat) [defined _LIBC]: New macros. (uid, gid, have_ids): Remove these static variables. They weren't accurate for programs that also invoked setreuid etc. (euidaccess) [defined EFF_ONLY_OK || defined ACC_SELF || HAVE_DECL_EACCSS]: Use builtin substitutes. [defined _LIBC]: Ignore __libc_enable_secure; it's not a correct optimization for programs run as root that later invoke setreuid. [no builtin substitutes && HAVE_DECL_SETREGID && PREFER_NONREENTRANT_EUIDACCESS]: Use setreuid+setregid to get the correct answer. [no builtin substitutes && ! (HAVE_DECL_SETREGID && PREFER_NONREENTRANT_EUIDACCESS)]: Don't assume that the stat macros have their historical values, as POSIX doesn't require this. [defined TEST]: Include ; don't include errno.h twice; include rather than "error.h". 2004-07-23 Paul Eggert * Makefile.am (libfetish_a_SOURCES): Add fcntl-safer.h, open-safer.c. * fcntl-safer.h, open-safer.c: New files. 2004-07-12 Paul Eggert * c-strtod.c (STRTOD_L): New macro. (C_STRTOD) [defined LC_ALL_MASK]: Use it, so that the code is reentrant on platforms that have strtod_l. * getloadavg.c: Include , , even if HAVE_GETLOADAVG is defined, so that the test program can work. (errno): Remove declaration; not needed in C89 or later. Include "c-strtod.h". Do not include locale.h or define setlocale; no longer needed. Include . (INT_STRLEN_BOUND): New macro. (getloadavg): Use it to compute buffer size. Don't assume that buffer will be properly terminated by 'read'. Use c_strtod instead of setlocale. (main) [defined TEST]: Return int, not void. 2004-07-11 Paul Eggert * Makefile.am (libfetish_a_SOURCES): Add c-strtold.c. * c-strtold.c: New file. * c-strtod.c: Include first. (C_STRTOD, DOUBLE, STRTOD): New macros. (c_strtod): Use them. * c-strtod.h (c_strtold): New decl. 2004-07-07 Jim Meyering Don't infloop when MAXSYMLINKS is not defined. Detect symlink loops much earlier (albeit lazily) on systems with MAXSYMLINKS defined to a large value. * canonicalize.c: Include "cycle-check.h". (canonicalize_filename_mode): Don't try to detect loops by counting symlink-hops. Instead, use the cycle-check module. * cycle-check.h: Include stdbool.h. Forward-declare `struct stat'. * canonicalize.c (canonicalize_filename_mode): Remove do-while(0) loop. Replace each corresponding `break' stmt with `continue'. 2004-07-06 Jim Meyering * canonicalize.c: Include "stat-macros.h". (canonicalize_filename_mode): Remove #ifdef S_ISLNK, now that S_ISLNK is guaranteed to be defined (via stat-macros.h). 2004-04-03 Dmitry V. Levin * Makefile.am (libfetish_a_SOURCES): Add canonicalize.c unconditionally. * canonicalize.h (canonicalize_mode_t): New type. * canonicalize.c: Include "file-type.h". (canonicalize_filename_mode): New function, based on canonicalize_file_name, supports three canonicalize modes. (canonicalize_file_name) [!HAVE_CANONICALIZE_FILE_NAME && !HAVE_RESOLVEPATH]: Use it. 2004-07-05 Jim Meyering * path-concat.c (path_concat): Improve comment. From Paul Eggert. 2004-07-02 Paul Eggert * canonicalize.c (canonicalize_file_name): Assume that path_concat never returns NULL. * path-concat.c (mempcpy): Don't define if a system header defines it. Don't include stdio.h, stdlib.h, unistd.h, strdup.h. (longest_relative_suffix): New function. (path_concat): Use it. Assume first argument is not NULL. Port to DOS. Omit redundant separators. Report an error instead of returning NULL. Use mempcpy instead of memcpy. (xpath_concat): Remove: not declared or used. 2004-06-30 Paul Eggert * dirname.h (FILE_SYSTEM_PREFIX_LEN): Renamed from FILESYSTEM_PREFIX_LEN. All uses changed. * mountlist.h (read_file_system_list): Renamed from read_filesystem_list. All definitions and uses changed. 2004-06-24 Jim Meyering * obstack.h (obstack_base): Fix parentheses. From Paul Eggert. 2004-06-20 Jim Meyering * obstack.h (obstack_base): Cast to (void *), per documentation. * yesno.h: New file. * yesno.c: Include "yesno.h". * Makefile.am (libfetish_a_SOURCES): Add yesno.h. 2004-06-19 Jim Meyering * filemode.c: Remove all S_IS* and S_IF* definitions. Instead, just include "stat-macros.h". * stat.c: Likewise. * rmdir.c: Likewise. * makepath.c: Likewise. * lchown.c: Likewise. * isdir.c: Likewise. * canonicalize.c: Likewise. Add S_IS* definitions from filemode.c. * stat-macros.h (S_ISCTG): Define to zero if not already defined. (S_ISOFD): Likewise. (S_ISOFL): Likewise. 2004-06-11 Paul Eggert * readutmp.c (extract_trimmed_name): Don't apply strchr to a non-string; this leads to undefined behavior. 2004-05-18 Paul Eggert * fts.c (fts_stat, fts_alloc): Always allocate and use a struct stat, even if the user isn't interested in the results. This prevents a core dump in cycle_check when FTS_NOSTAT is set. * lchown.c (lchown): Return EOPNOTSUPP if not supported; this is what POSIX-2004 specifies. * lchown.h (EOPNOTSUPP): Define if not defined. (ENOSYS): Remove. 2004-06-06 Jim Meyering * getdate.y: Update from gnulib. 2004-05-25 Paul Eggert * xreadlink.c: Include xreadlink.h first, to catch .h file dependency problems. (xreadlink): Accept new arg SIZE, for efficiency. All decls and uses changed. * xreadlink.h: Include , for size_t. * canonicalize.c (canonicalize_file_name): Update use of xreadlink. 2004-06-01 Jim Meyering * xmalloc.c: Update from gnulib. 2004-05-30 Jim Meyering * alloca_.h: Remove trailing blank. 2004-05-29 Jim Meyering * dirname.h (IS_ABSOLUTE_FILE_NAME, IS_RELATIVE_FILE_NAME): Define. * calloc.c: New file. 2004-05-21 Jim Meyering * alloca.c, alloca_.h, fnmatch.c: Update from gnulib. * localcharset.c, regex.c: Likewise. 2004-05-20 Jim Meyering * obstack.c, obstack.h: Update from gnulib. 2004-05-16 Paul Eggert * getline.c, getndelim2.c, getndelim2.h: Sync with gnulib. 2004-05-11 Jim Meyering Prior to this change, rm required read access to the current directory on most systems (ones with the fchdir function). * save-cwd.c (save_cwd) [HAVE_FCHDIR]: If opening `.' read-only fails, try write-only, and finally, resort to using xgetcwd. 2004-05-07 Jim Meyering Update from gnulib. * obstack.c (_): Define only if not already defined. * obstack.h (obstack_finish): Rename local: s/value/__value/. 2004-05-03 Jim Meyering * lchown.c (lchown) [CHOWN_MODIFIES_SYMLINK]: Just call chown. 2004-05-01 Jim Meyering * chown.c (rpl_chown) [CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE]: Wrap old code with this conditional. [CHOWN_MODIFIES_SYMLINK]: Try to work around a chown function that does not dereference symlinks. 2004-04-18 Paul Eggert * nanosleep.c (suspended): Change its type from int to sig_atomic_t volatile. (first_call): Make it private to rpl_nanosleep, and have it be zero initially as that's a bit faster. (my_usleep): Round up fractional times instead of truncating them, as this is the usual meaning for 'sleep'. 2004-04-20 Jim Meyering * getndelim2.c (getndelim2): Upon realloc failure, don't leak memory. 2004-04-18 Jim Meyering * readutmp.c (read_utmp) [UTMP_NAME_FUNCTION]: Upon realloc failure, don't leak memory and do call END_UTMP_ENT. 2004-04-13 Jim Meyering * quotearg.c, quotearg.h: Remove trailing blanks. 2004-04-12 Jim Meyering * inttostr.h: Update from gnulib. 2004-03-27 Paul Eggert * utimecmp.c, utimecmp.h: New files. * Makefile.am (libfetish_a_SOURCES): Add utimecmp.c, utimecmp.h. 2004-04-09 Jim Meyering * stat-macros.h: New file, with contents from file-type.h and coreutils' system.h. * Makefile.am (libfetish_a_SOURCES): Add stat-macros.h. * file-type.c: Include "stat-macros.h". * file-type.h (file_type): Move all macro defiitions to new file, stat-macros.h. 2004-03-30 Paul Eggert * cloexec.c, cloexec.h, config.charset, file-type.c, file-type.h: * getloadavg.c, getndelim2.c, getusershell.c, group-member.c: * human.c, path-concat.c, printf-args.c, printf-args.h: * quotearg.c, quotearg.h, setenv.c, strdup.c: * userspec.c, userspec.h, vasprintf.c: Sync from gnulib. * allocsa.c, allocsa.h, strdup.h: New files, from gnulib. * Makefile.am (libfetish_a_SOURCES): Add allocsa.c, allocsa.h, and strdup.h. 2004-03-30 Jim Meyering * getloadavg.c: Merge changes from emacs (via gnulib). 2004-03-28 Paul Eggert Fix some gotchas encountered when porting to Solaris 8, using the Forte 6u2 compiler. * canonicalize.c [HAVE_UNISTD_H]: Include , for resolvepath declaration. * fts.c: Include dirfd.h, for dirfd. 2004-02-25 Paul Eggert * human.c (humblock): Support BLOCKSIZE as well as BLOCK_SIZE. 2004-03-23 Paul Eggert * readtokens0.c (readtokens0): Return true on success rather than on failure. All callers changed. This also happens to fix a portability bug on pre-C99 hosts, where (bool) INTEGER sometimes returns false even when INTEGER is nonzero. 2004-03-23 Jim Meyering * Makefile.am (libfetish_a_SOURCES): Add getopt_int.h. * getopt_int.h: New file, from gnulib. * getopt.c, getopt.h, getopt1.c: Sync from gnulib. * getopt.c, getopt.h: Remove space(s) before TAB. * mbswidth.c, mbswidth.h: Sync from gnulib. 2004-03-21 Jim Meyering * readtokens0.c, readtokens0.h: New files. * Makefile.am (libfetish_a_SOURCES): Add readtokens0.c and readtokens0.h * readtokens.c (readtoken): Don't leak 64 bytes when reading an empty input stream. * readtokens.c: Include . (readtoken): Use `size_t' rather than int/long. All callers adjusted. Use `bool' rather than `int' where appropriate. Use memset rather than an explicit loop. Use x2nrealloc rather than xrealloc. Allow the use of `\0' as a delimiter. (readtokens): Likewise. * readtokens.h (readtoken, readtokens): Update prototypes. 2004-02-29 Paul Eggert * getdate.h: Include stdbool.h, and timespec.h instead of the usual dance. (get_date): Change signature to support fractional time stamps. All callers changed. * getdate.y: Include "getdate.h" first, as we can now assume C89 and don't need to worry about 'const'. Similarly, include "unlocked-io.h" near start, not in middle. Include . (textint.value): Use long int rather than int. (textint.digits): Use size_t rather than int. (BILLION, LOG10_BILLION): New constants. (parser_control): New member rel_ns. Members day_ordinal, time_zone, month, day, hour, minutes, rel_year, rel_month, rel_day, rel_hour, rel_minutes, rel_seconds are now long int, not int. Member seconds is now struct timespec, not int. New member timespec_seen. Members dates_seen, days_seen, local_zones_seen, rels_seen, times_seen, zones_seen are now size_t, not int. (%union.intval): Now long int, not int. New member timespec. (tSDECIMAL_NUMBER, tUDECIMAL_NUMBER): New tokens. (seconds, signed_seconds, unsigned_seconds): New nonterminals. (spec): Now is a timespec or an item list. (timespec, items): New nonterminals. (time, rel, relunit, number, get_date): Add support for fractional seconds. (time): Fix bug: seconds weren't cleared in "00:00 +0000" syntax. (gmtime, localtime, mktime): Remove decls; not needed with C89. (to_hour): First arg is now long int, not int. (to_year): Returns long int, not int. Don't treat year -70 like 70. (tm_diff): Returns long int, not int. (lookup_word): Use bool instead of int when appropriate. (yylex): Use size_t for count, not int. Detect overflow when parsing large integer constants. Add support for fractions. (get_date): Make pointers 'const' if possible. Use more-portable code to detect integer overflow. (main) [TEST]: Adjust to above changes. Test for localtime failure. Don't use ctime; it's not reliable if the year has >4 digits. 2004-03-15 Jim Meyering `date --date="21:04 +0100" +%S' would print the seconds value from the current time, rather than `00'. * getdate.y: For a date string like `10:23 +0100', set the number of seconds to zero. Reported by Marc Haber. 2004-03-04 Jim Meyering * cloexec.c (set_cloexec_flag) [ ! (F_GETFD && F_SETFD)]: Return true, not false. 2004-03-03 Paul Eggert * cloexec.c: Include "cloexec.h" first, and before . (set_cloexec_flag): Use bool for booleans. All uses changed. If F_GETFD returns a negative number (not just -1), report a failure. Don't use F_SETFD if the flags are already right. Don't report a failure with F_SETFD unless it returns -1. * cloexec.h: Include . Adjust signature to use `bool' rather than `int'. * getloadavg.c (getloadavg): Use `true', not `1'. 2004-03-02 Dmitry V. Levin * cloexec.c: New file. The set_cloexec_flag implementation imported from GNU C Library Reference Manual. * cloexec.h: New file. * getloadavg.c: Include "cloexec.h". (getloadavg): Use set_cloexec_flag instead of manual fcntl call. * Makefile.am (libfetish_a_SOURCES): Add cloexec.c, cloexec.h. 2004-02-23 Paul Eggert * userspec.c: Don't include "posixver.h". (parse_user_spec): Fall back on USER.GROUP parsing, regardless of POSIX version, as POSIX 1003.1-2001 allows that behavior as a compatible extension. Simplify code by removing a boolean int that was always nonzero if a string was nonnull. 2004-02-05 Jim Meyering * timespec.h (ST_TIME_CMP_NS, ST_TIME_CMP): Define. (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise. From coreutils' system.h. 2004-01-29 Jim Meyering * mountlist.c [HAVE_SYS_UCRED_H]: Include grp.h before sys/ucred.h. 2004-01-21 Paul Eggert * argmatch.c (ARGMATCH_DIE) [! defined ARGMATCH_DIE]: Include "exitfail.h", and use exit_failure rather than EXIT_FAILURE. * argmatch.h: Comment fix to match the above. * long-options.c (parse_long_options): Use prototype for usage function arg. Pass it EXIT_SUCCESS rather than 0, for clarity. * obstack.c (obstack_exit_failure) [!defined _LIBC]: Now a macro referring to exit_failure, instead of a separate variable. Include "exitfail.h" to get it. * xstrtol.h: Include "exitfail.h". (STRTOL_FATAL_ERROR): Exit with status exit_failure, not 2. 2004-01-21 Jim Meyering * mktime.c (__mktime_internal) [!_LIBC]: Define to mktime_internal so as not to conflict with a different-sized __mktime_internal function in GNU libc. 2004-01-16 Jim Meyering Merge from gnulib. * localcharset.c: Test HAVE_DECL_GETC_UNLOCKED, rather than HAVE_GETC_UNLOCKED. 2003-10-08 Paul Eggert Merge from gnulib. * unlocked-io.h: Include , so that the caller doesn't have to include before us. (clearerr_unlocked, feof_unlocked, ferror_unlocked, fflush_unlocked, fgets_unlocked, fputc_unlocked, fputs_unlocked, fread_unlocked, fwrite_unlocked, getc_unlocked, getchar_unlocked, putc_unlocked, putchar_unlocked): Define to the unlocked counterpart if not declared, so that we can use getpass.c code from libc without rewriting it. (flockfile, ftrylockfile, funlockfile): New macros. 2004-01-14 Paul Eggert Merge from gnulib. * fnmatch_loop.c (ALLOCA_LIMIT): Remove macro, which collided with like-named macro in fnmatch.c. (EXT): Use an internal constant instead. Merge fnmatch patches from glibc. * fnmatch.c (mbsinit): Remove define. Add libc_hidden_ver (__fnmatch, fnmatch). * fnmatch_loop.c (FCT): Cast to int32_t and UCHAR when appropriate. Adjust to renaming of collseq_table_lookup to __collseq_table_lookup. 2003-11-24 Paul Eggert Merge from gnulib. * alloca.c: Remove dependency on xalloc module. (xalloc_die): Remove. (memory_full) [!defined emacs]: New macro. [!defined emacs]: Don't include xalloc.h. (alloca): Invoke memory_full, not xalloc_die, if malloc fails or address arithmetic overflows. Change datatypes a bit to avoid unnecessary casts. 2004-01-14 Paul Eggert * posixver.c: Include posixver.h. 2004-01-12 Jim Meyering * posixver.c (DEFAULT_POSIX2_VERSION): Use definition of new, optional configure-time default. 2004-01-10 Jim Meyering * version-etc.c (version_etc_copyright): Update copyright date. 2003-12-20 Jim Meyering * fts.c [!_LIBC]: Undefine, then define-away __P. 2003-12-19 Jim Meyering Rewrite fts to use a hash table or O(1)-mem cycle-detection code rather than the tree-based tsearch functions. * fts_.h: Include hash.h and cycle-check.h. (FTS_TIGHT_CYCLE_CHECK): New value. (FTS_OPTIONMASK): Adjust to include the new value. (FTS_NAMEONLY, FTS_STOP): Increase to allow room for new value. (struct FTS) [active_dir_ht]: New member. Replaces fts_dir_signatures. (struct FTS) [cycle_state]: New member. * fts.c: Don't include . [HAVE_INTTYPES_H]: Include . (tdestroy, tfind, tsearch): Remove definitions. (struct Active_dir): Rename from `known_object'. (AD_compare, AD_hash): New functions. (enter_dir, leave_dir): Rewrite to manipulate a hash table rather than a tree. (fts_open): Initialize hash table or cycle_state buffer. (free_node): Remove function. (find_matching_ancestor): Renamed/rewritten from look_up_active_dir. (fts_cross_check): Adapt to use new data structure. * Makefile.am (libfetish_a_SOURCES): Remove search_.h. (DISTCLEANFILES): Remove definition. 2003-12-18 Jim Meyering Rewrite cycle detection code to work properly. Add some framework (compiled out by default) to test it. * fts.c (Dprintf, ENTER_DIR, LEAVE_DIR): Define. (add_object): Remove function. Rewritten as... (enter_dir): New function. (leave_dir, free_node): New functions. (fts_read): Ensure that we call ENTER_DIR or LEAVE_DIR, as appropriate, before returning. (look_up_active_dir, fts_cross_check) [FTS_DEBUG]: New functions. (fts_stat): Don't perform the cycle check here. Now it's done via enter_dir. 2003-12-12 Jim Meyering * fts_.h (FTS) [fts_dir_signatures]: Add comment. 2003-12-03 Paul Eggert * getgroups.c (getgroups): xmalloc takes one argument, not two. Bug reported by Alfred M. Szmidt. 2003-12-02 Jim Meyering * Makefile.am (libfetish_a_SOURCES): Reflect sha -> sha1 renaming. * sha1.c: File renamed from sha.c. * sha1.h: File renamed from sha.h. Use SHA1_H, not _SHA_H in #ifndef condition. * sha.c: Add FSF Copyright. * sha.h: Correct stale references to MD5 and `16 bytes'. Patch by Ulrich Drepper. * sha.h: Add FSF Copyright. Remove reference to Scott Miller, since this file is now nearly identical to md5.h. * md5.h (rol) [__GNUC__ && __i386__]: Don't use `asm' code. These days, gcc-3.x does better all by itself. Patch from Dean Gaudet: http://mail.gnu.org/archive/html/bug-coreutils/2003-11/msg00144.html 2003-11-29 Jim Meyering * c-strtod.c (c_strtod): Save and restore original LC_NUMERIC setting, in case it was different from the environment-derived value. Patch by Paul Eggert. Include "xalloc.h" for declaration of xstrdup. 2003-11-24 Paul Eggert Parse floating-point operands and options in the C locale. POSIX requires this for printf, and we might as well be consistent elsewhere (tail, sleep, seq). * Makefile.am (libfetish_a_SOURCES): Add c-strtod.c, c-strtod.h. * c-strtod.c, c-strtod.h: New files. * xstrtod.h (xstrtod): Accept an extra arg, specifying the conversion function. * xstrtod.c (xstrtod): Likewise. All callers changed to include c-strtod.h and use c_strtod. Don't include stdlib.h; no longer needed. * xnanosleep.c: Don't include xstrtod.h; it's not needed. 2003-11-22 Jim Meyering * xmalloc.c (x2nrealloc_inline): Fix typos in comments: s/size/size_t/. 2003-11-21 Jim Meyering * xreadlink.c (xreadlink): Correct outdated comment. 2003-11-17 Jim Meyering On systems without utime and without a utimes function capable of dealing with a NULL struct utimbuf* argument, this utime replacement could -- in unusual circumstances -- leak a file descriptor. * utime.c: Include and . (utime_null): Be sure to close `fd' and to preserve errno. Reported by Geoff Collyer via Arnold Robbins. 2003-11-13 Jim Meyering * xalloc.h, xstrtol.c: Update from gnulib. 2003-11-11 Jim Meyering * ftw.c, ftw_.h: Remove files. No longer used. 2003-11-09 Jim Meyering * root-dev-ino.c, root-dev-ino.h: New files. * Makefile.am (libfetish_a_SOURCES): Add root-dev-ino.c root-dev-ino.h. * dev-ino.h: Include and . 2003-11-06 Jim Meyering * free.c: New file, from gnulib. 2003-10-31 Paul Eggert * mountlist.h (struct mount_entry.me_type_malloced): New member. * mountlist.c (SIZE_MAX): Define if not defined already. (read_filesystem_list): Set and use me_type_malloced. Use "sizeof *me" rather than "sizeof (struct mount_entry)" (or whatever the type happens to be), for brevity and consistency. Check for size calculation overflow on Alphas running OSF/1. 2003-10-31 Jim Meyering * hash.c: Include "xalloc.h" for use of xalloc_oversized. * linebuffer.c: Include for declaration of memset. * alloca.c, linebuffer.c, xmalloc.c, xalloc.h: Update from gnulib. * exclude.c, getgroups.c, quotearg.c, stdbool_.h: Update from gnulib. * hash.c, hash-pjw.h: Update from gnulib. 2003-10-25 Jim Meyering * hash.c, hash.h: Update from gnulib. * hash-pjw.c, hash-pjw.h: Likewise. * obstack.c, obstack.h: Likewise. 2003-10-25 Jim Meyering * fts_.h: Include only if _LIBC. [!_LIBC]: Define-away __THROW, __BEGIN_DECLS, __END_DECLS. 2003-10-19 Jim Meyering * vasnprintf.c (vasnprintf): Work around losing snprintf on e.g. HPUX 10.20. 2003-09-25 Jim Meyering Bruno Haible [Update from gnulib] This lets translators provide better translations for the "Written by ..." part of --version output. * version-etc.h: Include stdarg.h. (version_etc_copyright): Declare as readonly. (version_etc): Make this function variadic with a NULL-terminated list of author name strings. (version_etc_va): New declaration. * version-etc.c: Include stdarg.h, stdlib.h. (version_etc_copyright): Declare as readonly. (version_etc_va): New function. Provide a different translatable string for each possible number of authors < 10. Abbreviate when there are 10 authors or more. (version_etc): Make this function variadic. Call version_etc_va. Suggestion from Gary V. Vaughan. * long-options.h (parse_long_options): Change prototype: the authors string is moved to the end and becomes variadic. * long-options.c: Include stdarg.h. (parse_long_options): Make this function variadic, too. Call version_etc_va, not version_etc. 2003-10-17 Jim Meyering * xfts.c, xfts.h: New files. This factors out code used by du.c, chmod.c, and chown-core.c. * Makefile.am (libfetish_a_SOURCES): Add xfts.c and xfts.h. * error.h: Update from gnulib. * getpass.c: Likewise. * fnmatch.c: Likewise. * fnmatch_loop.c: Likewise. 2003-10-16 Jim Meyering * xmalloc.c: Include , for declarations of memset and memcpy. * getgroups.c: Update from gnulib. * readutmp.c: Fix indentation, from gnulib. * exclude.c: Update from gnulib. * xgethostname.c: Include xgethostname.h. * xgethostname.h: New file, from gnulib. * Makefile.am (libfetish_a_SOURCES): Add xgethostname.h. 2003-10-15 Jim Meyering * userspec.h: New file. * userspec.c: Include "userspec.h". * Makefile.am (libfetish_a_SOURCES): Add userspec.h. 2003-10-14 Paul Eggert Fix some number-parsing bugs, e.g., "head -n 100k@" wasn't properly diagnosed. * human.c, xstrtoimax.c, xstrtol.c, xstrtol.h, xstrtoul.c, xstrtoumax.c: Sync with gnulib. 2003-10-13 Paul Eggert * xalloc.h, xmalloc.c, xstrdup.c: Import latest version from gnulib. 2003-09-29 Paul Eggert * Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c. 2003-10-02 Jim Meyering Don't require that the maximum length of a file name encountered in a traversal fit in an `unsigned short', and fix some portability bugs (don't depend on gcc). * fts.c: Include "fts_.h", not . (ALIGNBYTES) [!(__GNUC__ >= 2)]: Add a definition that works with compilers that don't have __alignof__. (MAX): Use a definition that doesn't depend on gcc. (fts_build): Make `len' and `maxlen' be of type size_t, not int. Test for overflow in a less type-dependent manner. Test HAVE_STRUCT_DIRENT_D_TYPE, rather than defined DT_DIR && defined _DIRENT_HAVE_D_TYPE. (fts_palloc): Test for overflow in a less type-dependent manner. (fts_safe_changedir): Use stat, not stat64. Use fstat, not __fxstat64(_STAT_VER. * fts_.h [FTS] (fts_pathlen): Change type from int to size_t. [FTSENT] (fts_pathlen): Change type from u_short to size_t. (fts_level): Change type from u_short to int. * Makefile.am (libfetish_a_SOURCES): Add fts.c fts_.h. Remove ftw_.h. 2003-09-29 Paul Eggert * strftime.c (tm_diff) [! HAVE_TM_GMTOFF]: Fix arg typo in previous patch. 2003-09-28 Jim Meyering * error.c: Update from gnulib. 2003-09-19 Jim Meyering * version-etc.h: (version_etc): Rename parameter, authors, to written_by. * version-etc.c: (version_etc): Likewise. Combine fprintf and following putc('\n'. * version-etc.c, version-etc.h: Revert yesterday's changes. * long-options.c, long-options.h: Likewise. 2003-09-18 Jim Meyering This lets translators provide better translations for the `Written by ...' part of --version output. * version-etc.c: Include stdarg.h, stdlib.h, string.h, and xalloc.h. (version_etc): Make this function variadic, with a NULL-terminated list of author name strings. (version_etc_va): New function. Suggestion from Gary V. Vaughan. * version-etc.h (version_etc_va): Declare it. * long-options.c: Include stdarg.h. (parse_long_options): Make this function variadic (authors), too. Call version_etc_va, not version_etc. * long-options.h (parse_long_options): Update prototype. 2003-09-16 Paul Eggert * linebuffer.c (readlinebuffer): Return NULL immediately upon input error, instead of returning NULL the next time we are called (and therefore losing track of errno). 2003-09-15 Paul Eggert * getndelim2.c (getndelim2): Don't trash errno when a read fails, so that the caller gets the proper errno. * readutmp.c (read_utmp): Likewise. Check for fstat error. Close stream and free storage when failing. 2003-09-14 Jim Meyering * argmatch.c: Update from gnulib. * Makefile.am (libfetish_a_SOURCES): Add exit.h, strndup.h, time_r.c, time_r.h. 2003-09-13 Jim Meyering * setenv.c, strcspn.c, strdup.c, strndup.c, strnlen.c, strpbrk.c: * strstr.c, strtod.c, strtoimax.c, tempname.c, unicodeio.c, userspec.c: * vasprintf.h, xgethostname.c, xreadlink.c, xstrdup.c, xstrndup.c: * xstrndup.h, xstrtod.c, xstrtol.c, yesno.c: Update from gnulib. * strndup.h: New file, from gnulib. * exit.h: New file, from GNU gettext, via gnulib. 2003-09-06 Paul Eggert * time_r.c, time_r.h: New files. * mktime.c (my_mktime_localtime_r): Remove; all uses changed to __localtime_r. (__localtime_r) [!defined _LIBC]: New macro. Include . (__mktime_internal) [!defined _LIBC]: Now extern, not static. * strftime.c (my_strftime_gmtime_r): Remove; all uses changed to __gmtime_r. (my_strftime_localtime_r): Remove; all uses changed to __localtime_r. (__gtime_r, __localtime_r) [!HAVE_TM_GMTOFF]: New macros. Include . 2003-09-13 Jim Meyering * strtol.c: Update from gnulib. 2003-09-12 Paul Eggert * argmatch.c, xgethostname.c, xmalloc.c: Include exit.h. * obstack.c [!defined _LIBC]: Likewise. * argmatch.c (EXIT_FAILURE): Remove; now done by exit.h * exitfail.c, fatal.c, xgethostname.c, xmalloc.c: Likewise. * exitfail.c: Don't include stdlib.h; no longer needed. 2003-09-12 Paul Eggert * error.c (error_tail): Assume vprintf. 2003-09-09 Paul Eggert More K&R removal. * getloadavg.c (getloadavg, main): Define via prototypes. * getopt.h (struct option.name): Assume C89, and use 'const'. (getopt, etopt_long, getopt_long_only, _getopt_internal) [defined __GNU_LIBRARY__]: Assume C89, so we can always declare with a prototype. * getopt.c (const): Remove macro. Include unconditionally. (my_index): Remove; all uses changed to strchr. (strlen): Remove decl. (exchange): Remove forward decl; no longer needed. (exchange, _getopt_initialize, _getopt_internal, getopt, main): Define with prototype. * getopt1.c (const): Remove macro. (getopt_long, getopt_long_only, main): Define with prototype. * getugroups.c: Include unconditionally. * getusershell.c: Include unconditionally. (getusershell, setusershell, endusershell, readname, main): Define with prototypes. * group-member.c: Include group-member.h first. Include unconditionally. * hard-locale.c: Include hard-locale.h first. Include , unconditionally. * hash.c (free, malloc): Remove decls. Include unconditionally. * human.c: Include , unconditionally. (getenv): Do not declare. * idcache.c: Include unconditionally. * long-options.c: Include long-options.h first, to test interface. Include unconditionally. * makepath.c: Include makepath.h first, to test interface. Include and unconditionally. * linebuffer.c: Include . (free): Remove decl. * malloc.c: Include , for malloc; don't bother with stddef.h. rpl_malloc returns void *, not char *. * realloc.c (rpl_realloc): Likewise. Also, define with a prototype. * md5.h: Include unconditionally. (UINT_MAX_32_BITS): Don't worry about non-__STDC__ case. (__P): Remove; all uses removed. * md5.c: Include "md5.h" first. (md5_init_ctx, md5_read_ctx, md5_finish_ctx, md5_stream, md5_buffer, md5_process_bytes, md5_process_block): Define with prototypes. * sha.h (__P): Remove all uses. (It wasn't defined??) * sha.c: Include "sha.h" first. Include , unconditionally. * memchr.c (__ptr_t): Remove; all uses changed to void *. * memcmp.c (__ptr_t): Likewise. * memrchr.c (__ptr_t): Likewise. * memchr.c, memcmp.c, memcoll.c, memrchr.c: Include unconditionally. * memchr.c, memrchr.c: Include unconditionally. * memchr.c: Include unconditionally. * memchr.c (LONG_MAX): Remove. * memrchr.c (LONG_MAX): Likewise. * memchr.c (__memchr): Define via a prototype. * memrchr.c (__memrchr): Likewise. * memcmp.c (__P): Remove, and remove all uses. (memcmp_bytes, memcmp_common_alignment, memcmp_not_common_alignment): Remove forward decls; no longer needed. * memcpy.c, memmove.c, memset.c: Include . Use types required by C89 in prototype. * mkdir.c: Include , unconditionally. * savedir.c: Likewise. * mkdir.c (free): Remove decl. * rmdir.c (rmdir): Define with a prototype. * savedir.c: Include savedir.h first, to test interface. * mktime.c (STDC_HEADERS): Remove. Include , unconditionally. * modechange.c: Include unconditionally. (malloc): Remove decl. * mountlist.c: Include , unconditionally. (free): Remove decl. * obstack.h (PTR_INT_TYPE) [!defined __PTRDIFF_TYPE__]: Define to ptrdiff_t, without bothering to check HAVE_STDDEF_H. (This type really should be intptr_t, but that's a C99ism.) (_obstack_memcpy): Remove: all uses changed to memcpy. Include unconditionally. (struct obstack): Assume __STDC__ for types of members chunkfun, freefun, extra_arg. (_obstack_newchunk, _obstack_free, _obstack_begin, _obstack_begin_1, _obstack_memory_used, obstack_alloc_failed_handler, obstack_init, obstack_begin, obstack_specify_allocation, obstack_specify_allocation_with_arg, obstack_chunkfun, obstack_freefun, obstack_free) [! (defined __STDC__ && __STDC__)]: Remove unprototyped decls and the macros that use them. * obstack.c (POINTER): Remove. All uses changed to void *. (obstack_alloc_failed_handler, CALL_CHUNKFUN, CALL_FREEFUN, _obstack_begin, _obstack_begin_1, _obstack_allocated_p) (defined __STDC__ && __STDC__)]: Remove nonprototyped code. Include unconditionally. (_obstack_begin, _obstack_begin_1, _obstack_newchunk, _obstack_allocated_p, _obstack_free, obstack_free, _obstack_memory_used, print_and_abort): Define using prototypes. (obstack_1grow, obstack_1grow_fast, obstack_alloc, obstack_base, obstack_blank, obstack_blank_fast, obstack_copy, obstack_copy0, obstack_finish, obstack_grow, obstack_grow0, obstack_make_room, obstack_next_free, obstack_object_size, obstack_room) [0]: Remove unused, unprototyped code. * path-concat.c: Include , unconditionally. * physmem.c (physmem_total, physmem_available, main): Define with prototypes. * posixtm.c: Include , unconditionally. (main): Define with a prototype. * posixver.c (getenv): Remove decl. * putenv.c (malloc): Returns void *, not char *. Include unconditionally. (strchr, memcpy, NULL): Do not define. * readtokens.c: Include readtokens.h first, to test interface. Include , unconditionally. (init_tokenbuffer): Define with a prototype. * regex.c (PARAMS): Remove. All uses removed. All uses of _RE_ARGS removed, too. Include , , , unconditionally. (bzero): Assume memset exists. (memcmp, memcpy, NULL): Remove. (SIGN_EXTEND_CHAR): Remove; all uses replaced by casts to signed char, or assignments to local vars of type signed char. (init_syntax_once, PREFIX(extract_number_and_incr), PREFIX(print_partial_compiled_pattern), PREFIX(print_compiled_pattern), PREFIX(print_double_string), convert_mbs_to_wcs, print_fastmap, re_set_syntax, PREFIX(regex_grow_registers), PREFIX(regex_compile), PREFIX(store_op1), PREFIX(store_op2), PREFIX(insert_op1), PREFIX(insert_op2), PREFIX(at_begline_loc_p), PREFIX(at_endline_loc_p), group_in_compile_stack, insert_space, wcs_compile_range, byte_compile_range, truncate_wchar, PREFIX(re_compile_fastmap), re_compile_fastmap, re_set_registers, re_search, re_search_2, PREFIX(re_search_2), re_match, re_match_2, count_mbs_length, wcs_re_match_2_internal, byte_re_match_2_internal, PREFIX(group_match_null_string_p), PREFIX(alt_match_null_string_p), PREFIX(common_op_match_null_string_p), PREFIX(bcmp_translate), re_compile_pattern, re_comp, re_exec, regcomp, regexec, regerror, regfree, PREFIX(extract_number)): Define with prototype. Remove now-unnecessary declaration, if any. (byte_compile_range, PREFIX(regex_compile), re_comp, re_exec, regcomp, regexec): Remove now-unnecessary casts among pointer types. * regex.h (_RE_ARGS): Remove. All uses removed. * rename.c: Include , unconditionally. (free): Remove decl. * rpmatch.c: Include unconditionally. * save-cwd.c: Include unconditionally. * xgetcwd.c: Likewise. * stat.c: Include , unconditionally. (free): Remove decl. The following changes are not K&R related: * group-member.h: Include , so that this file is self-contained. * makepath.h: Likewise. * getusershell.c (readname, default_index, line_size, readname): Use size_t, not int, for sizes. (readname): If the size overflows, report an error instead of looping forever. 2003-09-09 Derek Robert Price * getndelim2.c: Assume stdlib.h per the C89 spec. 2003-09-08 Paul Eggert Assume C89 or better; remove K&R cruft. A few of these changes were first proposed by Derek Robert Price in . * addext.c: Include unconditionally. * backupfile.c: Include , unconditionally. Don't declare getenv or malloc. * alloca.c: Include , unconditionally. (POINTER_TYPE, pointer): Remove; all uses changed to void *. (NULL): Remove. (find_stack_direction, alloca): Use prototypes. * atexit.c (atexit): Define using a prototype. * basename.c, dirname.c, stripslash.c: Include unconditionally. * bcopy.c: Include . (bcopy): Define with prototype, using 'const' and 'void' and 'size_t'. * canon-host.c: Include , unconditionally. * error.h (error, error_at_line, error_print_progname) [! (defined (__STDC__) && __STDC__)]: Remove decls. * error.c: Include error.h first, to check interface. Include , , unconditionally. (VA_START): Remove; all uses changeed to va_start. (exit, strerror): Remove decls. (error_print_progname): Prototype uncondionally. Don't include ; no longer needed. (private_strerror): Remove. (error_tail): Always define. (error, error_at_line): Assume C89 or better; always use prototypes. * euidaccess.c (main): Define with a prototype. * exclude.c: Include , unconditionally. * exitfail.c: Include unconditionally. * fnmatch_.h (__P): Remove. All uses changed to assume prototypes. * fnmatch.c: Include fnmatch.h first, to test interface. Include , , unconditionally. (getenv): Remove decl. (fnmatch): Define using a prototype. * fnmatch_loop.c (FCT): Remove forward decl; no longer needed. (FCT): Define using a prototype. * getdate.y: Include , unconditionally. * gethostname.c: Include . (gethostname): Define with prototype. Length is size_t, not int. 2003-09-08 Paul Eggert * utime.c [!HAVE_UTIMES_NULL]: Include , . (utime_null): Fix typo: 'st' was sometimes called 'sb'. 2003-09-09 Jim Meyering * getversion.c: Remove unused file. Reported by Paul Eggert. 2003-09-03 Paul Eggert * human.c (human_readable): Fix bug that rounded 10501 to 10k. Bug reported by Lute Kamstra in . * getdate.y (relative_time_table): Use tDAY_UNIT for "tomorrow", "yesterday", "today", and "now" rather than tMINUTE_UNIT. Of course with correspondingly smaller numbers for tomorrow and yesterday. From Tadayoshi Funaba. Originally installed into sh-utils on 1999-08-07, but the patch was mistakenly reverted by the next change to that shared file (but this time in fileutils) on 1999-08-29. 2003-08-18 Paul Eggert * same.c: Include and unconditionally, as we're now assuming that part of hosted C89. (free) [!HAVE_DECL_FREE]: Remove decl; no longer needed. (same_name): Invoke pathconf on destination, not source, as that's a bit clearer even if they are the same dir. 2003-08-18 Jim Meyering * getopt.h: Remove space before TAB. 2003-08-17 Paul Eggert * same.c: Include , . (_POSIX_NAME_MAX): Define if not defined. (MIN): New macro. (same_name): If file names are silently truncated, report that the file names are the same if they are the same after the silent truncation. 2003-08-16 Paul Eggert Merge from gnulib. * Makefile.am (libfetish_a_SOURCES): Remove getndelim2.c, getndelim2.h, xstrtoimax.c. Add localcharset.h. (CLEANFILES, SUFFIXES): Initialize to empty. (EXTRA_DIST): Add getndelim2.c, getndelim2.h. (install-exec-local): Use $(GLIBC21), not @GLIBC21@. Do not mkdir libdir if not glibc21. (charset.alias): @host@ -> $(host). (SUFFIXES, .sin.sed, CLEANFILES): Reorder rules to match gnulib module suggestions. * localcharset.h, readlink.c: New files, from gnulib. * asnprintf.c, asnprintf.c, asprintf.c, backupfile.h, canon-host.c, config.charset, dirname.h, euidaccess.c, exclude.c, fsusage.h, full-write.c, getloadavg.c, getndelim2.h, gettext.h, group-member.h, hard-locale.h, hash.c, hash.h, hash-pjw.c, localcharset.c, long-options.h, makepath.h, malloc.c, mbswidth.c, mbswidth.h, md5.h, memcasecmp.c, memcasecmp.h, memcoll.h, mkstemp.c, modechange.h, mountlist.h, path-concat.h, pathmax.h, physmem.h, posixtm.h, printf-args.c, printf-args.h, printf-parse.c, printf-parse.h, putenv.c, quote.h, readutmp.h, ref-add.sin, ref-del.sin, safe-read.c, savedir.h, setenv.c, setenv.h, stdbool_.h, strnlen.c, strpbrk.c, strtoimax.c, strverscmp.h, tempname.c, unicodeio.c, unicodeio.h, unistd-safer.h, unlocked-io.h, vasnprintf.c, vasnprintf.h, vasprintf.c, vasprintf.h, version-etc.h, xgethostname.c, xmemcoll.c, xstrtoimax.c, xstrtoumax.c: Sync with gnulib. 2003-08-15 Paul Eggert * physmem.c: Include "physmem.h" before system includes. 2003-08-10 Jim Meyering * utimens.c (utimens): Revert most of last change. Test HAVE_WORKING_UTIMES instead of HAVE_UTIMES. 2003-08-09 Jim Meyering * utimens.c (utimens): Test HAVE_UTIME, not HAVE_UTIMES. Prefer utime, since it works and utimes doesn't on some systems. FIXME: Revert the above change once we have a working utimes replacement function. 2003-08-06 Paul Eggert * Makefile.am (libeftish_a_SOURCES): Add utimens.c, utimens.h. * utimens.c, utimens.h: New files. 2003-08-09 Jim Meyering * unicodeio.c (unicode_to_mb): Change to `Solaris 5.7' in comment. * putenv.c: Likewise. * fatal.c, fatal.h: Remove unused files. * Makefile.am: Use the e.g., `$(FNMATCH_H)' notation for AC_SUBST'd variable names, rather than @FNMATCH_H@. Likewise for $(ALLOCA_H). (fnmatch.h): Use `$@' in the commands, in place of the three copies of the literal target, `fnmatch.h'. (alloca.h): Likewise. 2003-08-08 Paul Eggert * Makefile.am (libfetish_a_SOURCES): Remove fnmatch_.h. (lib_OBJECTS): New macro, for convenience when cutting and pasting Makefile.am templates from gnulib. (EXTRA_DIST): Remove fnmatch_loop.c. (BUILT_SOURCES): Append $(FNMATCH_H). * Makefile.am: Import the following changes from gnulib templates for alloca and fnmatch): (all-local $(lib_OBJECTS)): New dependencies. (alloca.h): Use alloca.h-t for temporary. (EXTRA_DIST): Append fnmatch_.h, fnmatch_loop.c. (fnmatch.h): New rule. (MOSTLYCLEANFILES): Add fnmatch.h, fnmatch.h-t. (DISTCLEANFILES): Remove fnmatch.h 2003-08-08 Jim Meyering * mountlist.c (read_filesystem_list) [MOUNTED_GETFSSTAT]: Use MNT_NOWAIT, rather than MNT_WAIT. Otherwise, `df DIR' could hang on OSF/1 5.1 for DIR on both local and remote file systems. Reported by (and fix confirmed by) Nelson H. F. Beebe. 2003-08-07 Jim Meyering * regex.h (RE_SYNTAX_POSIX_AWK): Remove SPACE in SPACE-TAB sequence. 2003-08-05 Paul Eggert Merge getline from gnulib. * getline.h, getline.c: Merge from gnulib. * getndelim2.h, getndelim2.c: New files, from gnulib. * getdelim2.c, getdelim2.h: Remove. * Makefile.am (libfetish_a_SOURCES): Change getdelim2.c and getdelim2.h to getndelim2.c and getndelim2.h. 2003-08-04 Paul Eggert * regex.c, regex.h: Sync with gnulib. 2003-08-03 Paul Eggert * stdbool_.h (_Bool): Use a #define, not a typedef. 2003-07-31 Paul Eggert * bumpalloc.h: Remove. * Makefile.am (libfetish_a_SOURCES): Remove bumpalloc.h. 2003-07-28 Jim Meyering * stdbool_.h: Renamed from stdbool.hin. * Makefile.am: Reflect renaming: stdbool.hin -> stdbool_.h. * stdbool.hin: Remove file. 2003-07-28 Paul Eggert * stdbool.hin (_Bool): Make it signed char, instead of an enum type, so that it's guaranteed to promote to int. 2003-07-23 Jim Meyering * xstrndup.h: New file. * xstrndup.c: New file, factored out of dircolors.c from coreutils. * Makefile.am (libfetish_a_SOURCES): Add xstrndup.c and xstrndup.h. 2003-07-23 Jim Meyering * lstat.c, save-cwd.c, stat.c, utime.c, xgethostname.c: Normalize naming of Sun operating systems in comments, e.g., SunOS4 -> SunOS 4, Solaris5.9 -> Solaris 9. From Paul Eggert. 2003-07-22 Paul Eggert * xalloc.h (XCALLOC, XREALLOC, CCLONE): Fix under- and over-parenthesization in macros. 2003-07-18 Paul Eggert * closeout.h (close_stdout_set_status, close_stdout_status): Remove. * closeout.c: Likewise. Include "closeout.h" right after config.h, to test that it can stand by itself. Include "exitfail.h". Clients should set exit_failure instead. (EXIT_FAILURE): Remove; no longer needed. Do not include . 2003-07-18 Andreas Schwab * memcoll.c (memcoll) [!HAVE_STRCOLL]: Clear errno. 2003-07-17 Paul Eggert * xalloca.h, xmalloc.c, xmemcoll.c, xmemcoll.h: Merge with gnulib. Use a single exit_failure variable rather than a separate one for each module. 2003-07-16 Jim Meyering * Makefile.am (AM_CPPFLAGS): Rename from `INCLUDES', to avoid warning from automake -Wall. 2003-07-14 Jim Meyering * save-cwd.h: Add copyright. 2003-07-13 Jim Meyering * xgethostname.c: Include for declaration of free. (xgethostname): Return NULL, rather than exiting, upon any non-malloc/realloc error. 2003-07-12 Jim Meyering * Makefile.am (BUILT_SOURCES): Use `BUILT_SOURCES += $(STDBOOL_H)' rather than `all-local: $(STDBOOL_H)'. The latter didn't force creation of stdbool.h before most other targets. Likewise for $(ALLOCA_H). Don't emit diagnostics. Let callers do that. * save-cwd.c: Don't include "error.h". (save_cwd): Don't call error. Ensure that errno is valid when returning nonzero. * obstack.h: Update from gnulib. * makepath.c (make_path): Enclose diagnostic in _(...). 2003-07-10 Jim Meyering * userspec.c: Include "posixver.h". (parse_user_spec): Accept `.' as a separator only in pre-POSIX-200112 mode. * Makefile.am (libfetish_a_SOURCES): Add these: printf-args.h, printf-parse.h, vasprintf.h, vasnprintf.h. Now that a program (`who') uses asprintf, we need all of these: * asnprintf.c, asprintf.c, printf-args.c, printf-args.h, printf-parse.c: * printf-parse.h, vasnprintf.c, vasnprintf.h, vasprintf.c, vasprintf.h: New files, from gnulib. * alloca_.h, getpass.c, memrchr.c, obstack.h, posixver.c, strftime.c, strnlen.c, strverscmp.c: Switch from LGPL to GPL. 2003-07-09 Jim Meyering * mktime.c: Update from gnulib. FIXME: but still need to adjust m4/mktime.c so that this fixed version is used when needed. Fix the bug that would make `du /' omit the `/' on the last line. E.g., `du --exclude '[^/]*' -x /' would print only "4\t\n" for me. * ftw.c (ftw_dir): Don't clobber the leading `/'. Reported by Chris Lesniewski as http://bugs.debian.org/200542. 2003-07-04 Jim Meyering Update from gnulib. * xreadlink.c: Include unconditionally, instead of having it depend on HAVE_SYS_TYPES_H. 2003-06-18 Jim Meyering * inttostr.h (PARAMS): Remove. All uses removed. Merge in change from gnulib. * makepath.c: Remove block of alloca-related code in favor of an unconditional `#include '. * xalloc.h: Include . Remove unnecessary parentheses. Use `1990-2000' notation in Copyright line until Emacs' copyright-update function learns how to handle a comma-separated list of years that spans a line boundary. * Makefile.am (libfetish_a_SOURCES): Add getdelim2.c and getdelim2.h. * getline.c (getdelim2): Move this function into its own file. * getdelim2.c: Extracted from getline.c. * linebuffer.c, linebuffer.h: Update from gnulib. * getdelim2.c, getdelim2.h: New files. * getstr.c, getstr.h: Remove files. * same.h: Update from gnulib. * xstrtol.h: Update from gnulib. 2003-06-17 Paul Eggert Assume C89, so PARAMS isn't needed. * backupfile.h (PARAMS): Remove. All uses removed. * closeout.h, dirname.h, filemode.h, fsusage.h, getdate.h, getline.h, group-member.h, hard-locale.h, hash.h, linebuffer.h, long-options.h, makepath.h, memcasecmp.h, memcoll.h, modechange.h, mountlist.h, path-concat.h, physmem.h, posixtm.h, quote.h, readutmp.h, same.h, save-cwd.h, savedir.h, stdio-safer.h, strtoimax.c, strverscmp.h, unistd-safer.h, version-etc.h, xalloc.h, xreadlink.h, xstrtod.h, xstrtol.h: Likewise. * filemode.h, hard-locale.h, memcoll.h, modechange.h, physmem.h, same.h, * strverscmp.h: Do not include config.h; no longer needed. Anyway, config.h should always be included before any other file. 2003-06-17 Jim Meyering * getline.c: Update from gnulib. Merge in changes from gnulib. * hash.c: Include unconditionally. Include . (CHAR_BIT): Don't define. 2003-06-09 John David Anglin * acl.c: Include before . Required on Ultrix 4.3. 2003-05-20 Derek Price * stat.c [LSTAT]: Compile/use slash_aware_lstat only if it is necessary. 2003-06-10 Jim Meyering * getdate.y: Also accept dates of the form May-23-2003. Suggestion from Karl Berry. 2003-06-09 Jim Meyering * gettimeofday.c: Also undefine gmtime. (rpl_gmtime): New function. Suggestion from Paul Eggert. 2003-06-08 Jim Meyering * getline.h: Update from gnulib. Clean up, as part of merge with emacs version of strftime.c. * strftime.c (my_strftime) [!_LIBC && HAVE_TZNAME && HAVE_TZSET]: Remove function, now that we can rely on a working tzset function. [!_LIBC]: Ensure that the required autoconf test has been run. * gettimeofday.c: Also undef tzset. (rpl_tzset): New function, for use by new macro, gl_FUNC_TZSET_CLOBBER. 2003-06-07 Jim Meyering * readtokens.h: Add copyright notice. Include . Remove definition and uses of __P. * readtokens.c: Put `Free Software Foundation, Inc.' in place of my name in the copyright comment. (init_tokenbuffer): Remove unnecessary parentheses around malloc. Update from gnulib. * getdate.y: Include alloca.h unconditionally. * xmemcoll.h: Include . * Makefile.am (MOSTLYCLEANFILES): Add alloca.h and alloca.ht. (MOSTLYCLEANFILES): Add stdbool.ht. * human.c: Include , once again, for declaration of sprintf. Update from gnulib. * tempname.c: Include unconditionally. Include as an alternative to . * strtoimax.c: Include as an alternative to . * xstrtol.h: Likewise. * xstrtoimax.c: Likewise. * xstrtoumax.c: Likewise. Update from gnulib. * strcasecmp.c: Include , not . * savedir.c: Include . (NULL): Don't define, since does that. 2003-06-06 Jim Meyering Update from gnulib. * rpmatch.c: Include without checking for HAVE_LIMITS_H. Include unconditionally. (NULL): Don't define, since does that. * rename.c: #undef rename before defining rpl_rename. [HAVE_CONFIG_H]: Guard inclusion of config.h. * putenv.c: Include rather than , as we merely need size_t. * realloc.c: Likewise. * quote.c: Don't include or ; not needed. * modechange.c: Include . (NULL): Don't define, since does that. * memcoll.h: Include , to get size_t. * memcoll.c: Include "memcoll.h", which gets us size_t and checks our interface, instead of including (memcoll): Fall back on a simple algorithm using memcmp if strcoll doesn't work. * memcasecmp.h: Include . * memcasecmp.c: Don't include . From gnulib. * alloca_.h: New file. * Makefile.am (EXTRA_DIST): Add alloca_.h. (all-local $(lib_OBJECTS)): Depend on $(ALLOCA_H). (alloca.h): New rule. * addext.c: Update from gnulib. * backupfile.c: Likewise. * config.charset: Likewise. * dirname.h: Likewise. * fsusage.c: Likewise. * userspec.c: Likewise. * xreadlink.c: Likewise. * xstrtol.c: Likewise. * __fpending.h: Likewise. * md5.c: Include and unconditionally. (memcpy): Remove definition. * posixtm.c: Include unconditionally. 2003-06-05 Jim Meyering From gnulib. * mktime.c: Assume freestanding C89 or better. (HAVE_LIMITS_H): Remove. Assume it's 1. (__P): Remove; not used. (CHAR_BIT, INT_MIN, INT_MAX): Remove; defines them. (mktime, not_equal_tm, print_tm, check_result, main): Use prototypes. Use const * where appropriate. (main): Fix typo in testing code that uncovered by above changes. (Local Variables): Remove -DHAVE_LIMITS_H from compile-command. 2003-06-04 Paul Eggert Merge human.c etc. from gnulib. * exclude.c, human.c, human.h: Merge from gnulib. * cycle-check.c, cycle-check.h, src/system.h: Include unconditionally. 2003-06-02 Jim Meyering * stdbool.hin: New file. From gnulib. * Makefile.am (MOSTLYCLEANFILES): Initialize. (stdbool.h): New rule. (all-local $(lib_OBJECTS)): Depend on $(STDBOOL_H) (MOSTLYCLEANFILES): Add stdbool.h. (EXTRA_DIST): Add stdbool.h. 2003-05-30 Jim Meyering * addext.c: Update from gnulib. * mktime.c: Likewise. 2003-05-29 Jim Meyering Make the %r format directive honor any locale setting. * strftime.c: (my_strftime) [!defined _NL_CURRENT && HAVE_STRFTIME]: Use underlying_strftime for %r. 2003-05-15 Jim Meyering * getopt.h: Remove a space before a TAB. 2003-05-13 Jim Meyering * setenv.c (setenv): Don't apply cast to argument of free. * putenv.c (rpl_putenv): Likewise. * alloca.c (alloca): Likewise. 2003-05-12 Jim Meyering * ftw.c (ftw_startup): Always call free_cwd after restore_cwd. Reported by Matti Aarnio as https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=90563. Forwarded by Tim Waugh. * strftime.c (my_strftime): Let the `-' (no-pad) flag affect the space-padded-by-default conversion specifiers, %e, %k, %l. 2003-05-07 Paul Eggert * xnanosleep.c (timespec_subtract): Don't modify the 2nd arg. Work even if X-Y overflows when subtracting. Make explicit the assumption that tv_nsec must be in range. (clock_get_realtime): Remove. All callers changed to invoke gettime, for simplicity. (xnanosleep): Check for gettime failure every time. 2003-05-06 Jim Meyering * xnanosleep.c (clock_get_realtime): Use gettime.c's gettime function, rather than an inferior, open-coded version that would fail on AIX systems due to clock_gettime failing with errno == ENOSYS. Reported by Jérôme Zago. 2003-05-05 Jim Meyering Avoid array overrun. * ftw.c (nftw_arr): Update to reflect complete list of members. (ftw_arr): Likewise Reported by Olatunji Oluwabukunmi Ruwase. Make it less likely that the above can happen again. * ftw.c (struct dummy): Ensure that at least the number of initializers matches the number of members in the corresponding enum. * ftw_.h (enum Ftw_option): Name this previously-anonymous enum. (enum Ftw_option) [FTW_N_MEMBERS]: New member. 2003-05-04 Jim Meyering * setenv.c (__set_errno, LOCK, UNLOCK): Define. (unsetenv): Update from GNU libc. Ifdef-out this function, since the only caller is putenv.c and that file now has its own copy. This avoids a core dump on systems without GNU putenv, when running `env -u SOME_ALREADY_UNSET_VARIABLE'. * putenv.c (__set_errno, LOCK, UNLOCK): Define. (unsetenv): New static function, from GNU libc. (rpl_putenv): Use it. 2003-05-02 Jim Meyering * canonicalize.c (canonicalize_file_name) [!HAVE_RESOLVEPATH]: A memory-allocation error could result in heap corruption. Fix it by also updating `dest' when rpath may be changed by xrealloc. 2003-04-15 Jim Meyering * getloadavg.c: Remove (or replace-with-TAB(s) to retain alignment) each sequence of spaces before a TAB character. * md5.c, getopt.c, getopt.h, obstack.h, strftime.c: Likewise. 2003-04-11 Jim Meyering * readutmp.c: Include and unconditionally. * canonicalize.c, exclude.c, getgroups.c, getusershell.c: * group-member.c, idcache.c, mountlist.c, readtokens.c, readutmp.c: * bumpalloc.h: Remove anachronistic casts of xmalloc, xrealloc, and xcalloc return values. * xalloc.h (PARAMS): Remove definitions and uses. (XMALLOC, XCALLOC, XREALLOC): Remove unnecessary casts. * xmalloc.c: Remove use of PARAMS. 2003-04-10 Jim Meyering * canonicalize.c (canonicalize_file_name) [HAVE_RESOLVEPATH]: Remove stray semicolon that caused `readlink --canonical RELATIVE_NAME' to fail on e.g., Solaris systems. Reported by Bruce Korb. (canonicalize_file_name): Return NULL immediately if resolvepath fails. Otherwise, `readlink --canonical /no-such-file' would exhaust virtual memory on some systems (e.g. Solaris). (canonicalize_file_name): Always free `extra_buf' before returning. (canonicalize_file_name): NUL-terminate the result. 2003-04-05 Jim Meyering * Makefile.am (DEFS): Use += notation rather than `DEFS = ... @DEFS@'. Use $(VAR) rather than @VAR@, now that we can rely on automake to emit a definition for each substituted variable. 2003-03-26 Richard Dawe * dirname.c [TEST_DIRNAME]: Update build instructions for test. Add test-cases for DOS filenames. Declare program_name. (main): Set up program_name. 2003-03-22 Jim Meyering * strftime.c (widen): Cast alloca return value to proper type. * fnmatch_loop.c (NEW_PATTERN): Cast alloca return value to proper type. Otherwise, it wouldn't compile with at least /bin/cc on ymp-cray-unicos9.0.2.X. Combine two mostly-identical uses of alloca into one. Thanks to the Cray-Cyber project for access to a Cray Y-MP. 2003-03-19 Jim Meyering DJGPP doesn't have S_ISLNK, so provide a replacement. * ftw.c (S_IFMT): Define, if necessary. [STAT_MACROS_BROKEN]: Undefine S_ISLNK. (S_ISLNK): Define, if necessary. Based on a patch from Rich Dawe. * exclude.h (PARAMS): Remove definition and uses. * exclude.c: Remove uses of `PARAMS'. * fnmatch_.h: Don't define __const. (fnmatch): Use const, not __const in prototype. From Paul Eggert. 2003-03-17 Richard Dawe * fchdir-stub.c: New file: trivial stub for fchdir. 2003-03-18 Jim Meyering * mountlist.c (read_filesystem_list) [MOUNTED_VMOUNT]: Detect any error from mntctl. Use mntctl's return value to drive the entry-processing loop, since we can't rely on the value of the vmt_length member in the last entry. On some systems doing so could result in exhausting virtual memory. Based in part on a patch from Mike Jetzer. * quote.c (quote_n): Fix typo in comment. 2003-03-17 Jim Meyering * raise.c (raise): Rename from rpl_raise. Without that change, systems lacking raise (SunOS 4) would not be able to link programs using raise. Reported by Volker Borchert. * ftw.c (FTW_STAT): Rename from `STAT', to avoid conflict with STAT definition from on AIX 5.1. Suggestion from Mike Jetzer and Petter Reinholdtsen. * fchown-stub.c (fchown): Put function type on its own line. * readlink-stub.c (readlink): Likewise. * lstat-stub.c (lstat): Likewise. 2003-03-14 Jim Meyering * Makefile.am (AUTOMAKE_OPTIONS): Remove definition -- before it pointed to ../src/ansi2knr. Some of these files have required an ANSI (c89) compiler for a year or two. (libfetish_a_SOURCES): Remove unused files: c-stack.c, c-stack.h. 2003-02-04 Dmitry V. Levin * stat.c: Include "xalloc.h". 2003-03-13 Paul Eggert Merge changes from Bison. * obstack.h: (__INT_TO_PTR) [__STDC__]: Cast result to (void *) to avoid diagnostic with native c89 on SGI IRIX 6.5 when compiling Bison 1.875's `bitset bset = obstack_alloc (bobstack, bytes);'. Problem reported by Nelson H. F. Beebe. 2003-01-30 Richard Dawe * fchown-stub.c: New file: trivial stub for fchown. * lstat-stub.c: New file: trivial stub for lstat. * readlink-stub.c: New file: trivial stub for readlink. 2003-03-09 Paul Eggert * argmatch.c (EXIT_FAILURE): Define if the system doesn't. Reported by Bruce Becker; see: http://mail.gnu.org/archive/html/bug-bison/2003-03/msg00017.html 2003-03-03 Paul Eggert Bruno Haible * mbswidth.h: Include . Needed for UnixWare 7.1.1. Reported by John Hughes, see http://mail.gnu.org/archive/html/bug-bison/2003-02/msg00030.html 2003-03-09 Jim Meyering * ftw.c: Include "save-cwd.h". (ftw_startup): Avoid use of getcwd, if possible. Instead, use fopen/fchdir via save_cwd/restore_cwd. 2003-03-08 Jim Meyering * xnanosleep.c: Don't use `defined' in a #define directive. 2003-03-07 Jim Meyering * Makefile.am (libfetish_a_SOURCES): Remove mmap-stack.h. * mmap-stack.c, mmap-stack.h: Remove files. * getcwd.c: #undef getcwd only after *all* included header files. Declare getcwd unconditionally. The problem was that same.h included config.h, and that defined getcwd to rpl_getcwd a second time (after the original #undef), and led to the rpl_getcwd function calling itself endlessly. This was the cause of at least the `du' test failures on IRIX 6.5, reported by Nelson Beebe. * same.h (same_name): Remove unnecessary inclusion of config.h. It also happened to lead to infinite recursion in getcwd.c. (PARAMS): Remove definition and use. 2003-03-06 Jim Meyering * ftw.c (ftw_startup): Declare `func' parameter to be of type NFTW_FUNC_T, not void* which may be smaller on 64-bit systems. Remove now-unnecessary cast. (FTW_NAME): Cast func argument to type `NFTW_FUNC_T'. 2003-03-05 Jim Meyering * physmem.c (ARRAY_SIZE): Define it. 2003-03-04 Jim Meyering * makepath.c (CLEANUP_CWD): Call error here, now that restore_cwd no longer does it. * save-cwd.h (restore_cwd): Update prototype. * save-cwd.c (restore_cwd): Remove two parameters. Simplify. Don't call error upon failure. Let callers do that. (save_cwd): Mention that Irix 5.3 has the same problem as SunOS 4 when auditing is enabled. But don't bother updating the #if. * xgetcwd.c (xgetcwd): Improve comment. * getcwd.c: New file. 2003-02-28 Jim Meyering * ftw.c (ftw_startup): Return -1 if alloca fails. 2003-02-28 Jim Meyering * fts.c (fts_children): If opening `.' fails, set the fts_child member to NULL before returning. From NetBSD. * fts.c (fts_children): If fchdir fails, close file descriptor before returning. From NetBSD. 2003-02-27 Jim Meyering * physmem.c (physmem_total, physmem_available): Add comments. From Kaveh Ghazi. * physmem.c: Merge in portability changes from gcc/libiberty to support AIX, Tru64, and Windows. See the ChangeLog there for credits and details. Thanks to Kaveh Ghazi for helping to keep these files in sync. 2003-02-24 Jim Meyering * fts_.h [__USE_FILE_OFFSET64]: Remove #error directive. (fts_open): Initialize local, tmp, to pacify gcc. * fts_.h [struct FTS] (fts_dir_signatures): New, opaque member. * fts.c: Include . (struct known_object): Define. (object_compare, add_object, find_object): New functions, like those in ftw.c. (fts_open): Initialize new member. (fts_close): Free memory allocated for new member. (fts_stat): Detect a cycle in O(logN) time per directory processed. * fts.c [HAVE_CONFIG_H]: Include . Conditionalize inclusion of . Conditionalize inclusion of vs . Include autoconf-recommended block of dirent/NAMELEN-related definitions and includes. Use NAMLEN throughout, rather than _D_EXACT_NAMLEN. [_LIBC] (close, closedir, fchdir, open, opendir): Define. [_LIBC] (readdir, tdestroy, tfind, tsearch): Define. Remove `__' prefix from all uses of the above. This will help to merge *BSD changes. [!_LIBC] (internal_function): Define. [! _LIBC && ! LSTAT_FOLLOWS_SLASHED_SYMLINK]: Define lstat. (__set_errno): Define if not already defined. * fts.c: (fts_open): If fts_alloc returns NULL, don't dereference it. (fts_read): If fts_safe_changedir fails because it is not able to chdir into a subdirectory, then inform the caller. * fts.c, fts_.h: New files, directly from glibc. 2003-02-23 Jim Meyering * fts_.h (struct _ftsent) [fts_level]: Change type from short to int, so it can handle a root-relative file name longer than 32K bytes. [fts_pathlen, fts_namelen]: Rearrange members to decrease size of this struct from 84 to 80 bytes. 2003-02-21 Jim Meyering * mmap-stack.h: Undefine HAVE_MMAP_STACK, thus disabling this code on all systems. Merge in some changes from GNU libc. * md5.h (md5_uintptr): Define. * ftw.c: Include before . This is required for Apple Darwin 6.3 (MacOS 10.2.3). Patch by Nelson Beebe. 2003-02-19 Jim Meyering * md5.c: Merge in some clean-up and optimization changes from glibc. * sha.c: Apply those same changes here, too. 2003-02-18 Jim Meyering * md5.c (md5_stream) [BLOCKSIZE]: Move definition to top of file. Ensure that it is a multiple of 64. Rearrange loop exit tests so as to avoid performing an additional fread after encountering an error or EOF. * sha.c (sha_stream): Likewise. Reported by Michael Bacarella. * Makefile.am (CLEANFILES): Remove ftw.h and search.h. (DISTCLEANFILES): Add them here. Add fnmatch.h, too. * sha.c (sha_stream): Rearrange loop exit tests so as to avoid performing an additional fread after encountering an error or EOF. 2003-02-17 Jim Meyering * mmap-stack.h (RUN_WITH_BIG_STACK_4): Define. * physmem.c: Undo most of last change. Use sysmp instead, since it provides a cleaner interface. From Kaveh Ghazi. 2003-02-16 Jim Meyering * Makefile.am (libfetish_a_SOURCES): Add mmap-stack.h. * mmap-stack.c (MAP_ANONYMOUS): Use MAP_ANON, if possible. Initialize `fd' to -1, so Solaris' mmap works with MAP_ANON. 2003-02-15 Jim Meyering * mmap-stack.c, mmap-stack.h: New files. Let the caller run a function with a larger (mmap'd) stack. Add Irix6 support to physmem.c. * physmem.c (irix_sysget): New function. (IRIX_SYSGET_TOTAL, IRIX_SYSGET_AVAILABLE): New macros. (physmem_total, physmem_available): Use them. (main) [DEBUG]: New function. 2003-02-11 Jim Meyering * Makefile.am (libfetish_a_SOURCES): Add euidaccess.h. * euidaccess.c: Include "euidaccess.h". * euidaccess.h: New file. 2003-02-08 Jim Meyering * ftw.c (ftw_startup): Don't shadow outer declaration of save_err. Merge inconsequential changes from libc. * ftw.c (ftw_startup): When using FTW_CHDIR, always remember the current directory, not just when DIR contains a slash. Reported by Manoj Srivastava via Michael Stone as Debian bug #180228. 2003-02-07 Jim Meyering Merge inconsequential changes from libc. * ftw.c: Include limits.h earlier. Move PATH_MAX definition `down' a little; add comment. Rename local, saved_errno to save_err. 2003-02-06 Jim Meyering Support for pruning. * ftw_.h (FTW_DPRE) [enum]: New member and definition. (struct FTW) [skip]: New member. * search_.h (__restrict): Define to `restrict' or to nothing. * fsusage.c: Remove declaration of statfs. It conflicted with one from OSF/1 5.1 in . Reported by Nelson Beebe. 2003-02-05 Jim Meyering Fix a heap-corruption bug that affected Solaris systems. * ftw.c: Include . (PATH_MAX): Define to 1024, if not already defined. (process_entry): Allocate enough space to hold the resulting file name. Don't presume that 2*dirbufsize is enough. (ftw_startup): Always use PATH_MAX to compute buffer size, now that it is guaranteed to be defined. Nelson Beebe reported that du would sometimes segfault on Solaris. * ftw.c (process_entry): When using FTW_DEPTH, call `func', the user-supplied callback, once for the current directory before calling ftw_dir, in case that part of the hierarchy should be pruned. `func' does that by setting `data->skip'. (ftw_startup): Likewise. 2003-02-02 Jim Meyering * ftw.c (lstat) [!_LIBC && !LSTAT_FOLLOWS_SLASHED_SYMLINK]: Define to rpl_lstat. 2003-01-25 Jim Meyering * ftw.c (ISSLASH, FILESYSTEM_PREFIX_LEN) [_LIBC]: Define. (base_name): New function. (ftw_startup): Don't strip trailing slashes. Use base_name to find the offset of the basename. 2003-01-25 Jim Meyering * ftw.c (object_compare): Compare inode numbers before device numbers. The former is much more likely to differ for any two given file objects. 2003-01-23 Jim Meyering * tsearch.c [HAVE_CONFIG_H]: Include . Add autoconf-recommended block of alloca-related code. Cast each use of alloca to the required type, (node**). * ftw.c: Add autoconf-recommended block of alloca-related code. [!_LIBC] (__getcwd): Define to xgetcwd and declare xgetcwd. 2003-01-22 Jim Meyering * ftw.c (find_object): Don't use c99-style struct initializer. * ftw_.h: Change all uses of __const to const. * search_.h: Likewise. * Makefile.am (CLEANFILES): Add generated files: ftw.h search.h. * ftw.c (process_entry): Handle FTW_DCHP. (ftw_dir): Handle FTW_DCH. * ftw_.h [!_LIBC && !__USE_XOPEN_EXTENDED]: Define __USE_XOPEN_EXTENDED and FTW_H_STANDALONE. [anon enum] (FTW_DCH, FTW_DCHP): New members. (FTW_DCH, FTW_DCHP): Define. * ftw.c: Include autoconf-recommended block of dirent/NAMELEN related definitions and includes. Use NAMELEN throughout, rather than _D_EXACT_NAMLEN. [_LIBC]: Define NAMELEN to _D_EXACT_NAMLEN. (stpcpy): Declare, if necessary. (mempcpy): Define, if necessary. [!_LIBC] (__stpcpy, __mempcpy): Define. [!_LIBC] (LXSTAT, XSTAT): Define. 2003-01-21 Jim Meyering * tsearch.c: New file, from GNU libc. [! weak_alias]: Define __-prefixed names to publicized ones. [! defined _LIBC] (weak_alias, internal_function): Define-away. [defined weak_alias]: Guard each use of weak_alias. 2003-01-20 Jim Meyering * canonicalize.c: Include "path-concat.h". * search_.h: New file, from GNU libc. * Makefile.am (libfetish_a_SOURCES): Use ftw_.h here, too. (libfetish_a_SOURCES): Add search_.h. * ftw_.h: Rename from ftw.h. * obstack.h (obstack_object_size): Declare temporary, __o, to be const, in order to avoid warnings. (obstack_room): Likewise. (obstack_empty_p): Likewise. Merge in changes from GNU libc * error.c: Eliminate many `#ifdef USE_IN_LIBIO' conditionals. 2003-01-19 Ulrich Drepper From GNU libc. * strftime.c (my_strftime): Handle very large width specifications for numeric values correctly. Improve checks for overflow. 2003-01-19 Jim Meyering * strftime.c (widen) [COMPILE_WIDE]: Merge nearly-identical definitions. (nl_get_alt_digit) [! defined my_strftime]: Define. (my_strftime) [_NL_CURRENT]: Merge nearly-identical uses of _nl_get_alt_digit and _nl_get_walt_digit. * strftime.c (my_strftime): Merge in locale-related changes from libc. These changes have no effect outside of _LIBC. 2003-01-14 Jim Meyering * same.c (same_name): Declare *_basename locals to be `const'. Consolidate declarations and initializations of *_base* locals. 2003-01-11 Bruno Haible * same.c (same_name): Reorder tests so as to avoid calling stat() when a string comparison is sufficient. 2003-01-11 Bruno Haible * readtokens.c (readtoken): Cast character to 'unsigned char', not 'unsigned int'. 2003-01-14 Jim Meyering * ftw.c: Merge in Ulrich's and my changes from libc. 2003-01-12 Jim Meyering * ftw.c (ftw_startup): Rename local-shadowing local to pacify gcc. Also work on systems that have `struct direct', using autoconf's AC_HEADER_DIRENT. Tweak comments. * ftw.h, ftw.c: New files, from glibc/io. * Makefile.am (libfetish_a_SOURCES): Add ftw.h. 2003-01-11 Jim Meyering * makepath.c: Don't test HAVE_ERRNO_H. It's not necessary. * canonicalize.c: Don't test HAVE_ERRNO_H. It's not necessary. Don't test HAVE_STDDEF_H. It's not necessary. Use definition of PTR_INT_TYPE from obstack.h. 2002-12-01 Dmitry V. Levin * canonicalize.c: New file. The readlink-based implementation imported from GNU C Library. The resolveip-based implementation imported from src/df.c (show_point). * canonicalize.h: New file. * Makefile.am (libfetish_a_SOURCES): Add canonicalize.h. 2003-01-10 Jim Meyering * save-cwd.h: Remove uses of PARAMS. 2002-11-30 Dmitry V. Levin * xgetcwd.h: New file. * Makefile.am (libfetish_a_SOURCES): Add xgetcwd.h. * save-cwd.c: Include "xgetcwd.h". * xgetcwd.c: Likewise. 2002-11-30 Dmitry V. Levin * getgroups.c: Don't declare functions declared by xalloc.h. Include "xalloc.h" instead. * group-member.c: Likewise. * idcache.c: Likewise. * readutmp.c: Likewise. 2003-01-08 Jim Meyering * full-write.c: Undefine and define-away `const' after inclusion of errno.h, not before. Suggestion from Bruno Haible. 2003-01-06 Jim Meyering * full-write.c: Rework so that it may serve to define full_read, too. * full-read.c: Simply #define FULL_READ and include full-write.c. * Makefile.am (libfetish_a_SOURCES): Add full-read.c and full-read.h. * full-read.c, full-read.h: New files. Update from gnulib. 2002-12-10 Paul Eggert Port exclude.c and exclude.h to more non-GNU systems, e.g. Solaris 7. * exclude.h (EXCLUDE_ANCHORED, EXCLUDE_INCLUDE, EXCLUDE_WILDCARDS): Choose values that are less likely to collide with system fnmatch options. * exclude.c (FNM_CASEFOLD, FNM_LEADING_DIR): Define to 0 if not defined (e.g., a pure POSIX system). (EXCLUDE_macros_do_not_collide_with_FNM_macros): Use FNM_PATHNAME instead of FNM_FILE_NAME, for compatibility with pure POSIX systems. Update from gnulib. * utime.c (utime_null): Use SAFE_READ_ERROR. (utime_null): No need to call ftruncate if the file was nonempty. * getdate.y (get_date): Test HAVE_STRUCT_TM_TM_ZONE, not HAVE_TM_ZONE. * canon-host.c (strdup): Remove unused declaration. * fsusage.c: Include full_read.h. (get_fs_usage): Use full_read instead of safe_read. Patches by Bruno Haible. 2003-01-04 Jim Meyering * version-etc.c: Update copyright date. 2002-12-31 Jim Meyering * dev-ino.h: New file. * cycle-check.c: New file. * cycle-check.h: New file. * Makefile.am (libfetish_a_SOURCES): Add cycle-check.c, cycle-check.h, and dev-ino.h. 2002-12-21 Jim Meyering * stime.c: Remove file (for real, this time). 2002-12-15 Jim Meyering * strftime.h: New file, for declaration of nstrftime. * Makefile.am (libfetish_a_SOURCES): Add strftime.h. 2002-12-09 Jim Meyering * unlocked-io.h: Sync from gnulib. 2002-12-06 Jim Meyering * unlocked-io.h: New file, but with proper copyright notice and attribution. Note: this is *not* the same as the file in gnulib. This uses #if HAVE_FUNC_UNLOCKED for each `FUNC', rather than HAVE_DECL_FUNC_UNLOCKED. This usage is consistent with the autoconf macro in ../m4/jm-glibc-io.m4. Modulo comments, this file still contains exactly what was generated by gen-uio. 2002-12-04 Paul Eggert Do not generate unlocked-io.h automatically, since it's easier to maintain it by hand. * gen-uio: Remove. * Makefile.am: Add copyright notice. (libfetish_a_SOURCES): Add unlocked-io.h. (BUILT_SOURCES, all-local): Remove unlocked-io.h. (DISTCLEANFILES, io_functions): Remove macros. (EXTRA_DIST): Remove gen_uio. (unlocked-io.h): Remove rule. 2002-12-05 Paul Eggert * alloca.c [defined emacs]: Include "lisp.h". (xalloc_die) [defined emacs]: New macro. (free) [defined emacs && defined EMACS_FREE]: Define to EMACS_FREE. [! defined emacs]: Include . (POINTER_TYPE) [!defined POINTER_TYPE]: New macro. (pointer): Typedef to POINTER_TYPE *. (malloc): Remove decl; we now always use xmalloc. (alloca): Use old-style definition, since Emacs needs this. Check for arithmetic overflow when computing combined size. 2002-12-04 Jim Meyering Reflect the fact that stat.c and lstat.c are no longer generated. * Makefile.am (BUILT_SOURCES): Remove stat.c and lstat.c. (DISTCLEANFILES): Likewise. (EXTRA_DIST): Likewise. (all_local): Don't depend on stat.c or lstat.c. (stat.c, lstat.c): Remove rules. (EXTRA_DIST): Remove xstat.in. * xstat.in: Remove file. Contents moved into stat.c. * stat.c: Rework so that it may serve to define rpl_lstat, too. * lstat.c: Simply #define LSTAT and include stat.c. * safe-read.c: Rework so that it may serve to define safe_write, too. * safe-write.c: Simply #define SAFE_WRITE and include safe-read.c. 2002-12-03 Jim Meyering * safe-read.h: Update from gnulib (add comments, include stddef.h). 2002-12-02 Jim Meyering * safe-read.c (EINTR): Define. (safe_read): Rewrite to iterate IFF the read fails with EINTR. 2002-12-01 Jim Meyering * safe-read.c: Merge from gnulib. (safe_read): Also exit the loop when read returns zero. (CHAR_BIT, TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, INT_MAX): Define. * Makefile.am (libfetish_a_SOURCES): Add safe-write.c and safe-write.h. * strtoll.c: Update from gnulib (trivial changes). * strdup.c: Likewise. * strpbrk.c: Likewise. * strstr.c: Likewise. * tempname.c: Likewise. * obstack.c: Likewise. * getopt.c: Likewise. * getopt1.c: Likewise. * getopt.h: Likewise. * quote.h: Update from gnulib: add Copyright comment. * quote.c: Likewise. 2002-11-28 Jim Meyering * mktime.c: Merge from gnulib/libc, for a slightly uglier solution. Merge some more, in preparation for merge back into libc. * error.c (_): Define only if not already defined. Move definition to follow all #include directives. Include unlocked-io.h only if !_LIBC. Merge in changes from libc. * error.c [_LIBC]: Include . [USE_IN_LIBIO]: Include (fflush): Tweak definition to use INTUSE. (putc): Define. 2002-11-23 Jim Meyering From gnulib, by Bruno Haible * closeout.c: Include gettext.h instead of . * makepath.c: Likewise. * rpmatch.c: Likewise. * userspec.c: Likewise. * version-etc.c: Likewise. * xmemcoll.c: Likewise. * error.c [!_LIBC]: Include gettext.h instead of . * mbswidth.h: Update from gnulib. * mbswidth.c: Likewise. * localcharset.c: Likewise. * config.charset: Likewise. * unicodeio.c: Likewise. 2002-11-22 Paul Eggert * quotearg.h: Allow multiple inclusion by surrounding with "#ifndef QUOTEARG_H_". Include , for size_t, so that we can be included first. (PARAMS): Remove; we now assume C89 or later. All uses removed. * quotearg.c: Include quotearg.h immediately after config.h. No need to include stddef.h or sys/types.h any more. Surround local include files with "", not "<>". Assume HAVE_LIMITS_H unconditionally, as we assume C89. Similarly, assume HAVE_C_BACKSLASH_A, CHAR_BIT, UCHAR_MAX, UINT_MAX, HAVE_STDLIB_H, HAVE_STRING_H, STDC_HEADERS. (HAVE_MBSINIT): Undef if !HAVE_MBRTOWC. (mbsinit): Define to 1 if !defined mbsinit && !HAVE_MBSINIT. (ISPRINT): Remove; no longer needed now that we assume C89. (clone_quoting_options, quotearg_buffer, quotearg_n_options): Preserve errno. (quotearg_buffer_restyled, quotearg_n, quotearg_n_style, quotearg_char): Use SIZE_MAX rather than (size_t) -1 when we are talking about "infinity". (quotearg_buffer_restyled): Fix bug when quoting trigraphs. 2002-11-22 Jim Meyering From gnulib. * strstr.c: Don't include . It's unnecessary. 2002-11-21 Bruno Haible Remove case insensitive option matching. * argmatch.h (argcasematch): Remove declaration. (ARGCASEMATCH): Remove macro. (__xargmatch_internal): Remove case_sensitive argument. (XARGMATCH): Update. (XARGCASEMATCH): Remove macro. * argmatch.c (argmatch): Renamed from __argmatch_internal. Remove case_sensitive argument. (argcasematch): Remove function. (__xargmatch_internal): Remove case_sensitive argument. (main): Use XARGMATCH instead of XARGCASEMATCH. * argmatch.c: Include gettext.h instead of and . 2002-11-21 Bruno Haible * xmalloc.c: Change compile-time error message. Add comment about required autoconf version. * xmalloc.c: Include gettext.h instead of . (textdomain): Remove definition. 2002-11-21 Jim Meyering * strdup.c (strdup): Merge in changes from gnulib; mainly to use memcpy rather than strcpy. * strcspn.c: Update from gnulib. * sig2str.c (str2signum): Use unsigned, not size_t, for type of index. * quotearg.c: Use `"'s when including quotearg.h and xalloc.h, not the `<...>' notation. Include and declare errno if necessary. * README: Update from gnulib. 2002-11-20 Paul Eggert Merge argmatch cleanups from Bison. Assume C89. * argmatch.c: Include config.h here, not in argmatch.h. Include stdlib.h, for EXIT_FAILURE. Always include , since we assume C89. (EXIT_FAILURE): Remove pre-C89 bug workaround. * argmatch.h: Do not include or . Include instead, since it's all we need for size_t. (PARAMS): Remove. All uses removed. (ARRAY_CARDINALITY): Do not bother to #undef. (ARRAY_CARDINALITY, ARGMATCH, ARGCASEMATCH, invalid_arg, ARGMATCH_VALID, XARGMATCH, XARGCASEMATCH): Remove unnecessary parentheses. (ARGMATCH_VALID, XARGMATCH, XARGCASEMATCH): Insert necessary parentheses. (ARGMATCH_CONSTRAINT, ARGMATCH_VERIFY): New macros. (ARGMATCH_ASSERT): Use ARGMATCH_CONSTRAINT. 2002-11-19 Jim Meyering Be careful not to clobber errno. * quotearg.c (quotearg_buffer_restyled): If mbrtowc returns `(size_t) -1' (at which point it would also set errno to EILSEQ), then restore errno to its previous value. Reported by Phillip Jones via Tim Waugh as https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=76334. Avoid a link-time failure on some Linux systems. * mktime.c (STATIC): Define to be empty (_LIBC) or `static' (otherwise). (__mon_yday): Declare with the STATIC attribute. (__mktime_internal): Likewise. Based on a report from Greg Schafer. 2002-11-14 Jim Meyering * long-options.c: Don't include libintl.h, and don't define `_' -- they're not used. * same.c: Likewise. 2002-11-10 Jim Meyering * raise.c: New file. 2002-11-08 Paul Eggert * human.c (human_readable): Revamp to avoid warning about unused variable 'amt'. Unfortunately this means using some gotos. 2002-11-08 Jim Meyering * human.c (human_readable): Avoid warnings from gcc -Wshadow. 2002-11-06 Jim Meyering * Makefile.am (EXTRA_DIST): Add inttostr.h. 2002-10-07 Paul Eggert * Makefile.am (libfetish_a_SOURCES): Add imaxtostr.c, offtostr.c, umaxtostr.c. (EXTRA_DIST): Add inttostr.c. * inttostr.c, inttostr.h, imaxtostr.c, offtostr.c, umaxtostr.c: New files, taken from GNU tar. * human.c, human.h: Rewrite to support locale-specific notations like thousands separators. Specify what includer of include.h must include beforehand. (human_group_digits, human_suppress_point_zero, human_autoscale, human_base_1024, human_SI, human_B): New enum values. (human_readable): Rename from human_readable_inexact; put the options before the sizes. All uses changed. The old human_readable function has been removed; use inttostr.h instead. (human_options): Renamed from human_block_size, with new signature that allows block sizes up to UINTMAX_MAX. All callers changed. 2002-10-13 Jim Meyering * xnanosleep.c (initialized): Remove declaration now that it's unused. 2002-10-12 Paul Eggert * xnanosleep.c: There's no need to futz with the rounding mode, since the code should work properly even in the default rounding mode. (): Do not include. (#pragma STDC FENV_ACCESS ON): Remove. (xnanosleep): Don't futz with rounding state. 2002-10-06 Jim Meyering * safe-read.c (safe_read): Change type of function from ssize_t to size_t. * safe-read.h: Update prototype. (SAFE_READ_ERROR): Define. 2002-09-28 Jim Meyering * makepath.c (make_path): Restore umask *before* creating the final component. 2002-09-25 Paul Eggert * fsusage.c [! HAVE_INTTYPES_H && HAVE_STDINT_H] Include . (UINTMAX_MAX) [!defined UINTMAX_MAX]: New macro. (PROPAGATE_ALL_ONES): Work even if X is unsigned and narrower than int. Work more efficiently if X is the same width as uintmax_t. Do not compare X to -1, to avoid bogus compiler warning. (get_fs_usage): (uintmax_t) -1 -> UINTMAX_MAX to avoid a cast. Don't assume that f_frsize and f_bsize are the same type. 2002-09-25 Jim Meyering * fsusage.c: Remove unneeded parentheses around operands of `defined'. * safe-read.c (safe_read): Make comment more precise: upon error, it returns -1. 2002-09-22 Jim Meyering * makepath.c (make_path): Minor reformatting. 2002-09-14 Paul Eggert * xnanosleep (xnanosleep): Return -1 on failure, not 1, for consistency with nanosleep. Check errno after nanosleep returns -1. 2002-09-11 Jim Meyering * xnanosleep.c, xnanosleep.h: New files, factored out of sleep.c. * Makefile.am (libfetish_a_SOURCES): Add them. 2002-09-04 Jim Meyering * addext.c (addext): Add a cast to avoid gcc's warning about `comparison between signed and unsigned'. * sig2str.c (str2signum, sig2str): Declare loop index variables to be of type size_t so that they match type of upper bound, thus avoiding warning about `comparison between signed and unsigned'. 2002-08-31 Jim Meyering * mktime.c: Update from GNU libc. * obstack.c: Likewise. * getopt.c: Likewise. * getopt1.c: Likewise. 2002-08-05 Paul Eggert Fix some minor time-related bugs with POSIX time arguments. Some valid time stamps were being rejected (notably -1, and time stamps before 1900 on 64-bit hosts). And some invalid time stamps were being accepted, e.g. September 31. * posixtm.h (posixtime): Return bool instead of time_t, so that we can return (time_t) -1 successfully. * posixtm.c: Likewise. [HAVE_STDBOOL_H]: Include . (bool, false, true) [!HAVE_STDBOOL_H]: New type. (t): Remove static var. (year, posix_time_parse): Now takes struct tm * arg to modify, instead of static var. All uses changed. (year): Do not reject years before 1900; they can occur with 64-bit time_t. (posix_time_parse): Do not check for out-of-range components; that is now the caller's responsibility, since our checks were only approximations. (posixtime): Use mktime to check for out-of-range components, since it knows them exactly. If mktime returns (time_t) -1, check whether an error actually occurred by invoking localtime on -1. (main) [TEST_POSIXTIME]: Check for input data errors, and report posixtime failures better. Improve the test data (in comments only). 2002-07-27 Jim Meyering * readutmp.h: If we have both utmpx.h and utmp.h, and there exists the utmp.ut_exit member, but not the utmpx.ut_exit member, then undefine HAVE_UTMPX_H. For AIX 4.3.3. Doing all this in cpp is a big kludge; someday we'll put the brains in an autoconf macro. (UT_EXIT_E_TERMINATION, UT_EXIT_E_EXIT): Define. 2002-07-20 Jim Meyering * xmalloc.c: Adjust to work with new autoconf macros, AC_FUNC_MALLOC and AC_FUNC_REALLOC: test #ifndef HAVE_MALLOC/HAVE_REALLOC. * gettext.h: Upgrade to gettext-0.11.3. 2002-07-13 Bruno Haible * xstat.in: Include . * mountlist.c: #undef MNT_IGNORE before defining it, to avoid warning on FreeBSD. 2002-07-09 Jim Meyering * mountlist.h (ME_DUMMY): Don't count entries of type `auto' as dummy ones. At least on GNU/Linux systems, `auto' means something else. From Michael Stone. 2002-07-01 Jim Meyering * c-stack.c: Include sys/time.h. From Volker Borchert. 2002-06-11 Paul Eggert * fnmatch.c, fnmatch_loop.c (WIDE_CHAR_SUPPORT): New macro. Use it uniformly instead of (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H). It also uses HAVE_BTOWC, to fix a porting bug on Solaris 2.5.1 reported by Vin Shelton. 2002-06-22 Jim Meyering * fnmatch.c (ISASCII, ISPRINT): Undefine, to avoid warning about redefinition due to Solaris 2.6's definition in /usr/include/sys/euc.h. 2002-06-22 Paul Eggert * c-stack.h (segv_handler, c_stack_action) [! defined SA_SIGINFO]: Do not assume SA_SIGINFO behavior. Bug reported by Jim Meyering on NetBSD 1.5.2. 2002-06-22 Jim Meyering * c-stack.c, c-stack.h: New files, from diffutils-2.8.2. * exitfail.c, exitfail.h: Likewise. * Makefile.am (libfetish_a_SOURCES): Add exitfail.c and exitfail.h. * Makefile.am (libfetish_a_SOURCES): Add fnmatch_.h in place of fnmatch.h. (EXTRA_DIST): Add fnmatch_loop.c. (libfetish_a_SOURCES): Add c-stack.c and c-stack.h. * fnmatch_loop.c: New file, from diffutils-2.8.2. * fnmatch.c: Update from diffutils-2.8.2. * fnmatch_.h: New file. From diffutils-2.8.2. * fnmatch.h: Remove file. 2002-06-18 Paul Eggert * file-type.h: Report an error if neither S_ISREG nor S_IFREG is defined, instead of using a test specific to glibc 2.2. This should be safe, since POSIX requires S_ISREG and Unix Version 7 had S_IFREG. We don't need to check for since we don't use any symbols that it defines. 2002-06-15 Jim Meyering * file-type.h (FILE_TYPE_H): Guard entire contents with #ifndef. For GNU libc 2.2 and newer, ensure that and have been included before this file. 2002-06-13 Richard Dawe * Makefile.am (lstat.c, stat.c, .sin.sed): Use t-$@, rather than $@-t, so that each temporary file name is unique and valid in the first 8 characters, for operation under DOS. 2002-06-15 Jim Meyering Work even with DJGPP 2.03, which lacks support for symlinks. From Richard Dawe. * xstat.in (S_ISLNK): Define to 0 if neither S_ISLNK nor S_IFLNK is defined. * lchown.c (S_ISLNK): Likewise. 2002-06-14 Jim Meyering * file-type.h: Use the version from diffutils-2.8.2. * file-type.c: Likewise. 2002-05-27 Jim Meyering Fix a problem seen only on nonconforming systems whereby ls.c's use of localtime, and then of gettimeofday would cause trouble: the localtime call used to initialize rpl_gettimeofday's save mechanism would clobber ls's current local time information so that in any long listing the first file would always be listed with date 1970-01-01. Analysis by Volker Borchert. * gettimeofday.c (localtime): Undefine. (rpl_localtime): New function. 2002-05-22 Jim Meyering * Makefile.am (libfetish_a_SOURCES): Add file-type.c and file-type.h. * file-type.h: New file. * file-type.c (file_type): New file/function. Extracted from diffutils. 2002-04-29 Paul Eggert * hard-locale.c: Upgrade to version used in GNU Diffutils 2.8.1. 2002-04-28 Paul Eggert * sig2str.h (SIGNUM_BOUND): Do not use WTERMSIG, to avoid depending on and WTERMSIG. Default to 64 instead of 127, since 64 is the largest conceivable number for ancient nonstandard hosts. * sig2str.c: Do not include ; no longer needed. 2002-04-28 Jim Meyering * sig2str.c (WTERMSIG): Remove definition (unused). 2002-04-28 Paul Eggert * sig2str.h, sig2str.c: New files. * Makefile.am (libfetish_a_SOURCES): Add sig2str.h. 2002-04-24 Jim Meyering * gettext.h: New file, from Gettext. * Makefile.am (INCLUDES): Remove -I../intl. (libfetish_a_SOURCES): Add gettext.h. 2002-04-16 Jim Meyering * readutmp.h (UT_TYPE): Remove definition (now in who.c). (HAVE_STRUCT_XTMP_UT_EXIT, HAVE_STRUCT_XTMP_UT_ID): Define. (HAVE_STRUCT_XTMP_UT_PID, HAVE_STRUCT_XTMP_UT_TYPE): Define. 2002-04-12 Jim Meyering * dirfd.h (dirfd): Elide prototype if dirfd is a macro. 2002-03-10 Jim Meyering * makepath.c (make_path): Remove a comma from a diagnostic. Suggestion from Santiago Vila. 2002-03-08 Jim Meyering * rename.c: Mention that this wrapper is needed also on mips-dec-ultrix4.4 systems. 2002-03-02 Jim Meyering * gettime.c (gettime): Test HAVE_CLOCK_GETTIME, not HAVE_CLOCK_SETTIME. 2002-02-27 Paul Eggert * nanosleep.h: Rename to.... * timespec.h: New name for nanosleep.h. All uses changed. * gettime.c: New file. * settime.c: New file. * stime.c: Remove. * Makefile.am (libfetish_a_SOURCES): Add gettime.c, settime.c, timespec.h. Remove nanosleep.h. 2002-02-25 Paul Eggert * acl.c, acl.h: New files. * Makefile.am (libfetish_a_SOURCES): Add acl.h, acl.c. 2002-02-24 Jim Meyering * strnlen.c (strnlen): Define-away/undef so that an inconsistent prototype in string.h (on at least AIX4.3.2.0 w/gcc-2.95.3) doesn't cause trouble. Reported by Nelson Beebe. 2002-02-23 Paul Eggert * path-concat.c (xpath_concat): Reorder code to pacify compilers that don't know that xalloc_die never returns. 2002-02-20 Jim Meyering * getdate.c: Regenerate using bison-1.33. 2002-02-15 Paul Eggert * posixver.c, posixver.h: New files. * Makefile.am (libfetish_a_SOURCES): Add them. 2002-02-02 Paul Eggert Bruno Haible * unicodeio.h (print_unicode_char): Add exit_on_error argument. (fwrite_success_callback): New declaration. * unicodeio.c (unicode_to_mb): New function, extracted from print_unicode_char. Call failure callback instead of error. (fwrite_success_callback): New function. (exit_failure_callback): New function. (fallback_failure_callback): New function. (print_unicode_char): Call unicode_to_mb. 2002-01-26 Jim Meyering * Makefile.am (getdate$U.o): Depend on unlocked-io.h. 2002-01-22 Jim Meyering * Makefile.am (Makefile): Don't depend on $(BUILT_SOURCES). Otherwise, some versions of automake would omit the rule that makes Makefile from Makefile.in. 2001-01-21 Paul Eggert * xmemcoll.h, xmemcoll.c: New files. * Makefile.am (libfetish_a_SOURCES): Add them. * memcoll.c: Include errno.h, and declare errno if not defined. (memcoll): Set errno to zero if there is no error. * quotearg.c (quotearg_buffer_restyled): Fix bug with quoting buffers containing NUL when backslashing escapes. This bug was exposed by the other changes in this patch. (quotearg_n_options): New arg ARGSIZE. All callers changed. (quoting_options_from_style): New function. (quotearg_n_style): Use it. (quotearg_n_style_mem): New function. * quotearg.h (quotearg_n_style_mem): New function. 2002-01-16 Jim Meyering * getdate.y: Add three semicolons, each just before a closing brace. Bison (as of version 1.31) no longer papers over that mistake. 2002-02-14 Paul Eggert * backupfile.c (ISDIGIT): Comment fix. * getdate.y (ISDIGIT): Likewise. * posixtm.c (ISDIGIT, year): Likewise. * strverscmp.c (ISDIGIT): Likewise. * userspec.c (ISDIGIT): Likewise. 2002-01-05 Jim Meyering * version-etc.c (version_etc_copyright): Update copyright year. 2001-01-19 Paul Eggert * closeout.c (close_stdout_status): If ferror (stdout), do not silently exit merely because the output buffer happens to have nothing pending. 2001-12-18 Paul Eggert See the big note in ../ChangeLog. * human.c (suffixes): Prefer K to k for 1024. (generate_suffix_backwards): New function. (human_readable_inexact): Use it. * xstrtol.c (__xstrtol): If there is no number but there is a valid suffix, assume 1. "MB" now means decimal, "MiB" binary. Accept 'K' as well as 'k'. 2001-12-15 Jim Meyering * regex.h (__restrict_arr): Update from libc. * mountlist.h (ME_REMOTE): Recognize file systems of type smbfs as `remote' if the name starts with `//'. Suggested by Michael Stone. (STREQ): Define. 2001-12-10 Jim Meyering * linebuffer.c: Remove explicit declarations of xmalloc and xrealloc, Instead, include "xalloc.h". (initbuffer): Don't cast xmalloc return value to char*. (readline): Reword comment. Don't cast xrealloc return value to char* Return NULL, not 0. 2001-12-09 Jim Meyering * modechange.c (mode_compile): Add cast to avoid pedantic warning about `signed and unsigned type in conditional expression'. * posixtm.c (posix_time_parse): Likewise. * xreadlink.c (xreadlink): Add cast to avoid a pedantic warning. * readtokens.c (readtoken): Declare an index to be of type unsigned to avoid a pedantic warning. * getstr.c: Don't include assert.h. (getstr): Remove warning-evoking assertions. Return -1 if offset parameter is out of bounds. Change the type of a local from int to size_t. * strftime.c (my_strftime_localtime_r): Include this function definition in the `#if ! HAVE_TM_GMTOFF' block. * xgethostname.c: Remove declarations of xmalloc and xrealloc. Include xalloc.h instead. 2001-12-02 Jim Meyering * tempname.c: Don't declare getenv, thus reverting the change of 2001-11-18. It's no longer necessary, now that stdlib.h is always included. * regex.c [!__BOUNDED_POINTERS__]: Define away __bounded, __unbounded, and __ptrvalue. Reported by Uwe H. Steinfeld. 2001-11-30 Akim Demaille * xstrdup.c: Include xalloc.h, so that xstrdup is declared before being defined. 2001-11-27 Paul Eggert * quotearg.h (quotearg_n, quotearg_n_style): First arg is int, not unsigned. * quotearg.c (quotearg_n, quotearg_n_style): Likewise. (SIZE_MAX, UINT_MAX): New macros. (quotearg_n_options): Abort if N is negative. Avoid overflow check on hosts where size_t is 64 bits and int is 32 bits, as overflow is impossible there. Fix off-by-one typo that caused unnecessary reallocation. 2001-11-27 Jim Meyering * tempname.c: Merge with version from libc. * regex.c: Likewise. * tempname.c: Include stdlib.h unconditionally. On some old systems for which STDC_HEADERS is 0, it was not included, resulting in a warning about an integer-to-pointer conversion problem with getenv. Reported by Volker Borchert. 2001-11-26 Jim Meyering * gtod.h: Remove file. * Makefile.am (libfetish_a_SOURCES): Remove gtod.h. * gettimeofday.c: Don't include gtod.h. (GTOD_init): Remove function. (rpl_gettimeofday): Do its job here instead, rather than aborting. Suggestion from Volker Borchert. 2001-11-23 Jim Meyering * hash.h (struct hash_table): Don't define here. Merely declare it. * hash.c (struct hash_table): Define it here instead. 2001-11-22 Jim Meyering * hash.h: Bracket contents of file with #ifndef HASH_H_ ... #endif. 2001-11-18 Paul Eggert * tempname.c (TMP_MAX): Remove; no longer needed. (TEMPORARIES): New macro. (__gen_tempname): Use TEMPORARIES rather than TMP_MAX. This removes an artificial limitation (e.g. HP-UX 10.20, where TMP_MAX is 17576). 2001-11-18 Jim Meyering * tempname.c [!HAVE_DECL_GETENV]: Declare getenv to avoid warning on SunOS 4. * Makefile.am (Makefile): Depend on $(BUILT_SOURCES), so those files will be created before anything else. 2001-11-17 Jim Meyering * modechange.c (mode_adjust): Fix error introduced on 1999-04-26 that made e.g., `chmod a=,o=w,g=o F' cause F to be group readable rather than group writable. Patch by Juan F. Codagnone. * readtokens.c: Remove explicit declarations of xmalloc and xrealloc, Instead, include "xalloc.h". * mountlist.c: Include unlocked-io.h after all system headers. Remove explicit declarations of xmalloc, xrealloc, and xstrdup. Instead, include "xalloc.h". * argmatch.c, closeout.c, error.c, exclude.c: Include unlocked-io.h. * fatal.c, getdate.y, getpass.c, getstr.c, getusershell.c: Likewise. * mountlist.c, posixtm.c, readtokens.c, readutmp.c: Likewise. * regex.c, sha.c, version-etc.c, yesno.c: Likewise. Reported by Padraig Brady. * mkstemp.c: #undef mkstemp. Include config.h. (rpl_mkstemp): Rename from mkstemp. Protoize. 2001-11-16 Jim Meyering * physmem.c [HAVE_SYS_PSTAT_H]: Include . (physmem_total) [HAVE_PSTAT_GETSTATIC]: If sysconf couldn't be used to determine the amount of total physical memory, use pstat_getstatic. HPUX-11 doesn't define _SC_PHYS_PAGES. (physmem_available) [HAVE_PSTAT_GETSTATIC && HAVE_PSTAT_GETDYNAMIC]: If sysconf couldn't be used to determine the amount of available physical memory, use both pstat_getstatic and pstat_getdynamic. Based on a patch from Bob Proulx. 2001-11-05 Jim Meyering * xstat.in (slash_aware_lstat): Correct a misleading comment. 2001-11-03 Jim Meyering * argmatch.h (ARGMATCH_TO_ARGUMENT): Remove casts of first two args in argmatch_to_argument call. * dirfd.c (dirfd): Reflect the fact that DIR_TO_FD now takes an argument. * hash.c (hash_clear): Fix a bug that could lead to an infloop or e.g., a fault due to an attempt to free a NULL pointer. 2001-11-01 Jim Meyering * dirfd.c, dirfd.h: New files. * Makefile.am (libfetish_a_SOURCES): Add dirfd.h. * hash.c (hash_print) [TESTING]: Clean up. 2001-10-22 Paul Eggert * hard-locale.c (alloca): Define to __builtin_alloca if __GNUC__, to avoid a warning if -Wall. 2001-10-21 Paul Eggert * regex.c (uintptr_t): Remove macro and decl; it's config.h's job. 2001-10-21 Jim Meyering * obstack.c (_): Honor the setting of ENABLE_NLS. Otherwise, this code would end up calling gettext even in packages built with --disable-nls. * getopt.c (_): Likewise. * regex.c (_): Likewise. 2001-10-20 Paul Eggert * error.c (strerror_r): Do not declare unless !_LIBC. Do not check for HAVE_DECL_STRERROR_R missing unless STRERROR_R_CHAR_P. Use strerror_r that is only a macro, even if it is not a function. (strerror): Check for HAVE_DECL_STRERROR before declaring. (private_strerror): Use prototypes, not old-style function definition. (print_errno_message): New function. Support the POSIX 'int'-flavored strerror_r, as well as the traditional char*-flavored one. (error_tail, error, error_at_line): Use it. 2001-10-11 Jim Meyering * argmatch.c (argmatch_invalid): Use quotearg_n_style (0, ... and quote_n (1, ... to avoid clobbering a buffer. 2001-10-05 Jim Meyering * Makefile.am: (libfetish_a_SOURCES): Add hash-pjw.c and hash-pjw.h. * hash-pjw.c: New file (factored out of fileutils' remove.c). * hash-pjw.h: New file. 2001-09-30 Jim Meyering * mountlist.c [MOUNTED_GETFSSTAT]: Include , for Apple Darwin. Include sys/mount.h and sys/fs_types.h only if available. (FS_TYPE): Define. (read_filesystem_list): Use FS_TYPE. 2001-09-29 Paul Eggert * exclude.c (excluded_filename): 0 -> false, since it's a boolean context. 2001-09-28 Paul Eggert Fix bug reported by Petter Reinholdtsen for HP-UX 10.20, which #defines strtoimax. Also treat the other strto* functions like strtoimax. * xstrtol.c (strtol): Do not declare if HAVE_DECL_STRTOL. (strtoul): Do not declare if HAVE_DECL_STRTOUL. (strtoimax, strtoumax): Do not declare if already defined as a macro. 2001-09-26 Jim Meyering Most macros in unlocked-io.h had the wrong number of arguments. * gen-uio: New script. (USE_UNLOCKED_IO): Define to 1 if not already defined. * unlocked-io.hin: Remove file. * Makefile.am (unlocked-io.h): Rewrite to use a separate script, rather than trying to embed it here. (EXTRA_DIST): Add gen-uio. Remove unlocked-io.hin Reported by Padraig Brady. 2001-09-25 Volker Borchert * gettimeofday.c (rpl_gettimeofday): Declare local variable `result'. 2001-09-23 Jim Meyering * mountlist.c: Remove useless parentheses in #if directives. (MOUNTED) [!defined MOUNTED]: Define to _PATH_MOUNTED, for when the deprecated MOUNTED symbol is no longer defined in mntent.h. 2001-09-22 Jim Meyering * localcharset.c: Update from latest gettext. * config.charset: Likewise. 2001-09-20 Jim Meyering * xstrtol.c (strtoimax): Guard declaration with `#if !HAVE_DECL_STRTOIMAX', rather than just `#ifndef strtoimax'. The latter fails because some systems (at least rs6000-ibm-aix4.3.3.0) have their own, conflicting declaration of strtoimax in sys/inttypes.h. (strtoumax): Likewise, for completeness (it wasn't necessary). 2001-09-06 Paul Eggert * strtoimax.c (HAVE_LONG_LONG): Redefine to HAVE_UNSIGNED_LONG_LONG if unsigned. (strtoimax): Use sizeof (long), not sizeof strtol (ptr, endptr, base), to work around bug in IBM C compiler. 2001-09-16 Jim Meyering * mkdir.c: New file. 2001-09-04 Paul Eggert * xgetcwd.c: Revert some of the previous change; intead, fix the HAVE_GETCWD_NULL code to behave more like the !HAVE_GETCWD_NULL code used to. Include "xalloc.h". (xgetcwd): Do not return NULL when memory is exhausted; instead, invoke xalloc_die. 2001-09-04 Paul Eggert * xreadlink.c (xreadlink): Omit size_t* arg. All uses changed. Use ssize_t, not int, to store result of readlink. Check for ssize_t overflow as well as size_t overflow, as POSIX says the result of readlink is implementation-defined when ssize_t overflows. Remove unnecessary cast to char*. Use free+malloc instead of realloc, as the storage doesn't need to be preserved and it's clearer and can be more efficient that way. (SIZE_MAX, SSIZE_MAX): New macros, if doesn't declare. * xreadlink.h (xreadlink): Update prototype. 2001-09-03 Paul Eggert * exclude.c (fnmatch_no_wildcards): Fix confusion between usage of FNM_CASEFOLD and FNM_LEADING_DIR. The bug was spotted by Jim Meyering. 2001-09-03 Jim Meyering * xreadlink.c (xreadlink): Preserve errno around `free' during failure. 2001-09-03 Paul Eggert * xgetcwd.c: Fix the !HAVE_GETCWD_NULL code to behave more like the HAVE_GETCWD_NULL code. Include pathmax.h if not HAVE_GETCWD. Do not include xalloc.h. (INITIAL_BUFFER_SIZE): New symbol. Do not use xmalloc / xrealloc, since the caller is responsible for handling errors. Preserve errno around `free' during failure. Do not overrun buffer when using getwd. 2001-09-03 Paul Eggert * xgetcwd.c (xgetcwd): Use HAVE_GETCWD_NULL, not (defined __GLIBC__ && __GLIBC__ >= 2), to decide whether to use getcwd (NULL, 0). 2001-09-02 Jim Meyering * error.c: Update from GNU libc. 2001-09-01 Jim Meyering * xreadlink.c: New file. * xreadlink.h: New file. * Makefile.am (libfetish_a_SOURCES): Add xreadlink.c and xreadlink.h. * regex.c (uintptr_t) [!_LIBC]: Define to private_uintptr_t, so it doesn't conflict with sparc Solaris 7's definition in /usr/include/sys/int_types.h. * exclude.c: Use `""', not `<>' to #include non-system header files. (fnmatch_no_wildcards): Rewrite not to use function names, strcasecmp and strncasecmp as r-values. Unixware didn't have declarations. 2001-08-31 Jim Meyering * xgetcwd.c (xgetcwd): Reorganize to avoid some duplication. Use an initial, malloc'd, buffer of length 128 rather than a statically allocated one of length 1024. 2001-08-30 Paul Eggert * xgetcwd.c: Don't include pathmax.h. Include stdlib.h and unistd.h if available. Include xalloc.h. (xmalloc, xstrdup, free): Remove decls. (xgetcwd): Don't assume sizes fit in unsigned. Check for overflow when computing sizes. Simplify reallocation code. 2001-08-28 Paul Eggert * Makefile.am (libfetish_a_SOURCES): Remove strtoxmax.c. * strtoimax.c: Renamed from strtoxmax.c, removing the old strtoimax.c. Also, make the following further changes to make this file's configuration more similar to that of strtol.c: (UNSIGNED): Renamed from STRTOUXMAX_UNSIGNED. All uses changed. (strtoumax, uintmax_t, strtoull, strtol): Remove. (intmax_t, strtoimax, strtol, strtoll): New macros, if UNSIGNED. (strtoimax): Renamed from strtoumax. All uses of unsigned values changed to signed values. And make the following changes as well: Fix copyright notice, as 1999 was missing. (verify): New macro. (strtoimax): Check sizes at compile-time, not run-time. Prefer strtol to strtoll if both work. (main): Remove; it was not that useful and was a pain to maintain. * strtoumax.c: Include strtoimax.c, not strtouxmax.c. 2001-08-30 Paul Eggert * savedir.c (savedir): Remove size parameter, as POSIX says that a directory's st_size can have an arbitrary value, so the old usage could waste an arbitrary amount of memory. All uses changed. * savedir.h: Update prototype. 2001-08-30 Paul Eggert * xstrtol.c (strtoimax): New decl. 2001-08-28 Paul Eggert * xstrtol.h: Add copyright notice. (_DECLARE_XSTRTOL): Improve quality of diagnostic for LONGINT_INVALID_SUFFIX_CHAR. 2001-08-30 Paul Eggert * quotearg.c: BSD/OS 4.1 wchar.h requires FILE and struct tm to be declared. 2001-08-30 Paul Eggert * hash.c: Remove '2001' from copyright notice. 2001-08-30 Paul Eggert * full-write.h: New file. * Makefile.am (libfetish_a_SOURCES): Add full-write.h. * full-write.c: Correct credits, as cccp.c no longer exists and anyway it was so heavily changed from the old cccp code as to be unrecognizable. Include full-write.h. (full_write) Return size_t, with short writes meaning failure. All callers changed. This fixes a bug with large buffers on 64-bit hosts. * utime.c: Include full-write.h. 2001-08-30 Paul Eggert Merge 'exclude' changes from tar 1.13.22. This fixes one or two unlikely storage allocation overflow bugs, but doesn't change user-visible behavior otherwise. 2001-08-30 Paul Eggert * exclude.c (bool): Declare, perhaps by including stdbool.h. (): Include only if HAVE_SYS_TYPES_H. (, , , , ): Include if available. (): Include (SIZE_MAX): Define if or doesn't. (verify): New macro. Use it to verify that EXCLUDE macros do not collide with FNM macros. (struct patopts): New struct. (struct exclude): Use it, as exclude patterns now come with options. (new_exclude): Support above changes. (new_exclude, add_exclude_file): Initial size must now be a power of two to simplify overflow checking. (free_exclude, fnmatch_no_wildcards): New function. (excluded_filename): No longer requires options arg, as the options are determined by add_exclude. Now returns bool, not int. (excluded_filename, add_exclude): Add support for the fancy new exclusion options. (add_exclude, add_exclude_file): Now takes int options arg. Check for arithmetic overflow when computing sizes. (add_exclude_file): xrealloc might modify errno, so don't realloc until after errno might be used. * exclude.h (EXCLUDE_ANCHORED, EXCLUDE_INCLUDE,EXCLUDE_WILDCARDS): New macros. (free_exclude): New decl. (add_exclude, add_exclude_file): Now takes int options arg. (excluded_filename): No longer requires options arg, as the options are determined by add_exclude. Now returns bool, not int. 2001-08-30 Paul Eggert * alloca.c (alloca): Arg is of type size_t, not unsigned. 2001-08-27 Jim Meyering * Makefile.am (libfetish_a_SOURCES): Add strtoxmax.c * version-etc.c (N_): Remove definition. Revert most of last change. Instead, simply don't mark the `Copyright...' string for translation. Based on advice from Paul Eggert. * strtoxmax.c: Tweak comment. 2001-08-26 Jim Meyering * version-etc.c (version_etc_copyright_fmt): Replace literal year of copyright with `%s' so translators don't get an untranslated message in 2002. (COPYRIGHT_YEAR): Define. (version_etc): Use fprintf rather than fputs. Suggestion from Ulrich Drepper. * Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c. * strtoll.c: New file, from GNU libc. * xstrtoimax.c: New file. * xstrtol.h: Add xstrtoimax. * strtoumax.c: New file. Simply include "strtoumax.c". * strtoimax.c: New file. Likewise, but first define STRTOUXMAX_SIGNED. * strtoumax.c: Factor to work both for unsigned and signed types, ... * strtoxmax.c: ... then renamed to this. 2001-08-13 Paul Eggert * Makefile.am (unlocked-io.h): Do not append "_unlocked" twice. Port to Solaris 8, where 'sed' requires a space after the 'r' command, and where sh dislikes "$/". Clean up the spacing a bit. Redirect output to $tmp just once. 2001-08-12 Paul Eggert * addext.c (): Include. (errno): Declare if not defined. (addext): Work correctly when pathconf returns -1 and leaves errno alone because there is no limit. Also, work even if pathconf returns a value greater than SIZE_MAX. 2001-08-12 Jim Meyering * xgetcwd.c (xgetcwd) [defined __GLIBC__ && __GLIBC__ >= 2]: Simply `return getcwd (NULL, 0);'. [! (defined __GLIBC__ && __GLIBC__ >= 2)]: Use 1300 as initial value for length, not PATH_MAX. * pathmax.h: Clean up cpp syntax. 2001-08-12 Jim Meyering * gettimeofday.c: New file. * gtod.h: New file. * Makefile.am (libfetish_a_SOURCES): Add gtod.h. 2001-08-04 Jim Meyering * error.h (__attribute__): Remove `|| __STRICT_ANSI__' from #if stmt, to get in sync with glibc. 2001-08-03 Paul Eggert The following changes are from gettext 0.10.39 as maintained by Bruno Haible. * mbswidth.h (MBSW_REJECT_UNPRINTABLE, MBSW_REJECT_INVALID): Renamed from MBSW_ACCEPT_UNPRINTABLE and MBSW_ACCEPT_INVALID with inverted sense. All uses changed. * mbswidth.c: Don't include . Include and unconditionally. (iswcntrl, mbsinit, ISCNTRL): New macros. (mbsnwidth): Use K&R style function declarations. Don't bother checking for MB_LEN_MAX == 1, since the compiler can optimize it when MB_CUR_MAX == 1. The width of control characters is zero, not 1. 2001-07-15 Jim Meyering * Makefile.am (EXTRA_DIST): Add unlocked-io.hin. (BUILT_SOURCES): Add unlocked-io.h. (io_functions): Define. (unlocked-io.h): New rule. (DISTCLEANFILES): Add unlocked-io.h. (all-local): Depend on unlocked-io.h, to ensure it is created. * unlocked-io.hin: New file * regex.c: Update from glibc. 2001-07-05 Jim Meyering * Makefile.am (noinst_HEADERS): Remove definition, per new automake recommendation. (libfetish_a_SOURCES): Put all .h files here instead. Remove a thus-exposed (better checks in automake) duplicate and two unnecessary .h files. 2001-06-11 Jim Meyering * regex.c: Update from GNU libc. 2001-05-27 Jim Meyering * readutmp.h (UT_TYPE): Define. 2001-05-24 Jim Meyering * argmatch.c: Include "quote.h". (argmatch_invalid): Remove explicit `' quotes. Instead, use the quote function. Reported by Göran Uddeborg. 2001-05-20 Alexandre Duret-Lutz * dirname.c (dir_name): Compute append_dot using path, not newpath which is not yet declared. 2001-05-11 Paul Eggert * Makefile.am (libfetish_a_SOURCES): Add strftime.c, since we now compile it on all hosts. * strftime.c (my_strftime): Define to nstrftime if emacs, but only if my_strftime is not defined. (extra_args, extra_args_spec, extra_args_spec_iso): Rename from ut_argument, ut_argument_spec, ut_argument_spec_iso, respectively. Add one more extra argument: a nanoseconds value. All uses changed. (ns): New macro. (my_strftime function): Add %N format. (emacs_strftimeu): Renamed from emacs_strftime, with extra ut argument. 2001-05-11 Paul Eggert dirname code cleanup. base_name now behaves more compatibly with POSIX basename when given file names that have trailing slashes, and similarly for dir_name. Add new primitives base_len and dir_len. Put the directory-name-related decls into dirname.h. * addext.c (ISSLASH, base_name): Remove; now in dirname.h. * backupfile.c (base_name): Likewise. * basename.c (FILESYSTEM_PREFIX_LEN, PARAMS, ISSLASH): Likewise. * dirname.c (FILESYSTEM_PREFIX_LEN, ISSLASH): Likewise. * makepath.c (strip_trailing_slashes): Likewise. * path-concat.c (DIRECTORY_SEPARATOR, FILESYSTEM_PREFIX_LEN, ISSLASH): Likewise. * rename.c (strip_trailing_slashes): Likewise. * same.c (base_name): Likewise. * stripslash.c (ISSLASH): Likewise. * addext.c: Include after size_t is defined. * backupfile.c: Likewise. * addext.c (addext): Use base_len to trim redundant trailing slashes instead of doing it ourselves. But do not trim the last slash if it is not redundant. * backupfile.c (find_backup_file_name, max_backup_version): Use base_len instead of rolling it ourselves. Handle the case of "" and (on DOS) "C:" correctly. * basename.c: Do not include , ; no longer needed. Include , . (base_name): Allow file names ending in slashes, other than names that are all slashes. In this case, return the basename followed by the slashes. This is more general, and can be used in places where the original base_name purposely had an assertion failure. (base_len): New function. * dirname.c: Include instead of . Do not include ; no longer needed. Include xalloc.h. (memrchr): Remove decl. (dir_name_r): Remove. (dir_len): Renamed from dirlen. All callers changed. Rewrite in terms of base_name, for simplicity and consistency. (dir_name): Never return NULL. All callers changed. Do not include in test program; no longer needed. return 0; is fine for test program. * dirname.h (DIRECTORY_SEPARATOR, ISSLASH, FILESYSTEM_PREFIX_LEN): New macros. (base_name, base_len, dir_len, strip_trailing_slashes): New decls. * path-concat.c (path_concat): Use base_len to compute base length, not strlen; this means we cannot rely on memcpy to null-terminate. * same.c (STREQ): Remove. (same_name): Handle the case where the basename ends in trailing '/'. * stripslash.c (strip_trailing_slashes): Return nonzero if a slash was stripped. Do not strip the last slash after a file system prefix. 2001-04-08 Jim Meyering * getdate.y (get_date): Set tm_isdst to -1 to ensure that it is recomputed; that's necessary when the offset spans a DST transition. Patch by David J. MacKenzie. Reported by Hon-Yin Kok. 2001-04-02 Jim Meyering * regex.h, regex.c: Update from GNU libc. 2001-03-19 Paul Eggert * version-etc.c (version_etc_copyright): Update to 2001. 2001-03-16 Paul Eggert * tempname.c (uint64_t): Define to uintmax_t if not defined, and if UINT64_MAX is not defined. Required at least for Vax Ultrix4.3, which doesn't define uint64_t. Reported by John David Anglin. 2001-03-10 Bruno Haible * localcharset.c (locale_charset): Allow wildcard syntax. Also resolve alias if codeset is empty. * config.charset (BeOS): Use wildcard syntax. 2001-03-13 Jim Meyering * path-concat.c (path_concat) [FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX]: Don't insert a backslash when concatenating e.g., `C:' and `foo'. From Bruno Haible. 2001-03-06 Bruno Haible * localcharset.c (locale_charset): Don't use setlocale(LC_CTYPE,NULL). Don't return NULL. * unicodeio.c (print_unicode_char): Simplify accordingly. 2001-03-06 Bruno Haible * config.charset: Update for FreeBSD 4.2 and OSF/1 5.1. Add support for DOS/DJGPP. 2001-02-28 Paul Eggert * Makefile.am (libfetish_a_SOURCES): Add dup-safer.c, fopen-safer.c. (noinst_HEADERS): Add stdio-safer.h, unistd-safer.h. * dup-safer.c, fopen-safer.c, stdio-safer.h, unistd-safer.h: New files. 2001-02-25 Paul Eggert The mkstemp replacement is taken from glibc 2.2.2, with some portability fixes for use outside glibc, as follows: * tempname.c (struct_stat64): New macro. (direxists, __gen_tempname): Use it. This avoids a portability problem with Solaris 8. * tempname.c (): Include if HAVE_CONFIG_H. (, , ): Include only if STDC_HEADERS || _LIBC. (): Include only if HAVE_FCNTL_H || _LIBC. (): Include only if HAVE_UNISTD_H || _LIBC. (): Include only if HAVE_SYS_TIME_H || _LIBC. (__set_errno): Define this macro if doesn't. (P_tmpdir, TMP_MAX, __GT_FILE, __GT_BIGFILE, __GT_DIR, __GT_NOCREATE): Define these macros if doesn't. (S_ISDIR, S_IRUSR, S_IWUSR, S_IXUSR): Define these macros if doesn't. Ignore S_ISDIR if STAT_MACROS_BROKEN. (stat64, __getpid, __gettimeofday, __mkdir, __open, __open64, lxstat64, __xstat64): Define if not _LIBC. (__secure_getenv): Define if ! (HAVE___SECURE_GETENV || _LIBC). (__gen_tempname): Invoke gettimeofday only if HAVE_GETTIMEOFDAY || _LIBC; otherwise, fall back on plain "time". Use macros like S_IRUSR | S_IWUSR rather than octal values like 0600. * mkstemp.c (__GT_FILE): Define to zero if not defined. * mkstemp.c, tempname.c: New files, taken from glibc 2.2.2. 2001-02-17 Jim Meyering * strtoul.c: Sync from GNU libc. Use double quotes, not <...> around included file name. * strnlen.c (__strnlen): Merge in a change from GNU libc. * strftime.c: Update from GNU libc (the only changes were to comments). 2001-02-13 Bruno Haible * mbswidth.h (mbswidth): Also define as macro, to avoid prototype clash. 2001-02-17 Paul Eggert * mbswidth.c, quotearg.c (mbrtowc, mbsinit): Remove workaround macros for hosts that have mbrtowc but not mbstate_t, as we now insist on proper declarations for both before using mbrtowc. 2001-02-17 Jim Meyering * regex.c: Update from libc. 2001-02-16 Paul Eggert * alloca.c (malloc): Undef before defining, since stdlib.h may have defined it. Needed for Encore Umax-3.0.9.16b systems. Reported by Mark Hounschell via Paul Eggert. 2001-01-30 Bruno Haible * config.charset: Update for FreeBSD 4.2. 2001-01-26 Jim Meyering * quotearg.c: Include stddef.h. * quote.c: Include stddef.h. Reported by Axel Kittenberger. * xmalloc.c [HAVE_DONE_WORKING_MALLOC_CHECK]: Enclose error-evoking line in double quotes so that it evokes a better diagnostic. [HAVE_DONE_WORKING_REALLOC_CHECK]: Likewise. Reported by Axel Kittenberger. 2001-01-15 Bruno Haible * unicodeio.c (print_unicode_char): Cast the second iconv() arg, to avoid a warning. Add back 'const' to inptr. 2001-01-16 Jim Meyering * basename.c: Include , needed by assert on SunOS 4. From Bruno Haible. 2001-01-14 Jim Meyering * rename.c: New file. From Volker Borchert. Include stdlib.h, string.h or strings.h, and xalloc.h. Use strip_trailing_slashes rather than open-coding it. 2001-01-03 Paul Eggert * strftime.c: Sync with glibc time/strftime.c 1.81. 2001-01-03 Jim Meyering * unicodeio.c (print_unicode_char): Remove `const' from declaration of local `inptr' to avoid warning with some system declarations of iconv. 2000-12-29 Paul Eggert * modechange.c: Do not assume that mode_t uses the traditional octal encoding. E.g. "chmod 1 FOO" should set the other-execute bit of FOO even if S_IXOTH != 1. (SUID, SGID, SVTX, RUSR, WUSR, XUSR, RGRP, WGRP, XGRP, ROTH, WOTH, XOTH, ALLM): New macros. (S_ISUID, S_ISGID, S_ISVTX, S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH): Use them. (S_ISGID): Fix typo; it was defaulting to the same value as S_ISUID. (S_IRWXU, S_IRWXG, S_IRWXO): Specify defaults in terms of the above. (mode_compile): No need to use uintmax_t; unsigned long is long enough. Don't bother to get suffix since we don't use it. 2000-12-24 Jim Meyering * hash.c (is_prime): Return explicit boolean values. (hash_get_first): Return NULL to appease Irix5.6's 89. Reported by Nelson Beebe. 2000-10-31 Bruno Haible * localcharset.c (locale_charset): Add support for Win32. 2000-12-18 Paul Eggert * physmem.h, physmem.c: New files. * Makefile.am (libfetish_a_SOURCES): Add physmem.c. (noinst_HEADERS): Add physmem.h. * xstrtol.c (__xstrtol): Add undocumented suffixes 'g' and 't' for compatibility with Solaris 8 sort. 2000-12-18 Bruno Haible * config.charset: Add support for BeOS. 2000-12-16 Jim Meyering * getusershell.c [!SHELLS_FILE && __DJGPP__]: Define SHELLS_FILE to a file name that's useful on djgpp systems. Include stdlib.h. (ADDITIONAL_DEFAULT_SHELLS): Define. (default_shells): Prepend ADDITIONAL_DEFAULT_SHELLS. Based mostly on a patch from Prashant TR. 2000-12-16 Jim Meyering This bug had a serious impact on chown: `chown N:M FILE' (for integer N and M) would have treated it like `chown N:N FILE'. * userspec.c (parse_user_spec): Fix typo: s/u/g/. 2000-10-31 Bruno Haible * config.charset: Add ISO-8859-3, BIG5HKSCS, GB18030, JOHAB, VISCII, CP874, CP949, CP950, CP1250, CP1253, CP1254, CP1255, CP1256, CP1257 to the list of canonical encodings. Rename EUC-CN to GB2312. 2000-12-08 Andreas Schwab * mbswidth.c (mbsnwidth): Don't loop endlessly when called with an invalid mulitbyte sequence and with the MBSW_ACCEPT_INVALID flag set. 2000-12-07 Jim Meyering * stripslash.c (ISSLASH): Define. (strip_trailing_slashes): Use ISSLASH rather than comparing against `/'. From Prashant TR. * dirname.c (FILESYSTEM_PREFIX_LEN): Define. (dir_name_r): Declare this function as static. [BACKSLASH_IS_PATH_SEPARATOR]: Fix a bug that'd manifest itself on a name containing a mix of slashes and backslashes. Make this function work with names starting with a DOS-style drive letter and colon prefix. (dir_name): Append `.' if necessary. Based mostly on patches from Prashant TR and Eli Zaretskii. * dirname.h (dir_name_r): Remove prototype. 2000-12-05 Jim Meyering * dirname.c (dir_name_r): Add `const' in a few local declarations. 2000-12-04 Jim Meyering * path-concat.c: [!HAVE_DECL_MALLOC]: Declare malloc. Also include memory.h, stdlib.h, unistd.h if appropriate. Reported by Andreas Jaeger (conflicting declaration of malloc). 2000-12-02 Jim Meyering * closeout.h: Make idempotent, to avoid some obscure warnings. 2000-12-01 Paul Eggert * memrchr.c: Include before any system include file. 2000-11-29 Paul Eggert * dirname.c (dir_name_r): Fix typo: int -> size_t. 2000-11-26 Jim Meyering * memcoll.c: Include sys/types.h. From Werner Almesberger. 2000-11-22 Paul Eggert * strftime.c (my_strftime): Do not invoke mbrlen with a size of (size_t) -1; it's not portable. 2000-11-17 Akim Demaille * obstack.h: Formatting changes. (obstack_grow, obstack_grow0): Don't cast WHERE at all: that would prevent type checking. (obstack_ptr_grow, obstack_ptr_grow_fast): When assigning, don't cast the value to (void *): assigning a `foo *' to a `void *' variable is valid. (obstack_int_grow, obstack_int_grow_fast): Don't cast AINT to int. 2000-11-17 Jim Meyering * strstr.c: Update from GNU libc. 2000-11-16 Jim Meyering * strverscmp.c: Incorporate weak-alias-related changes from glibc. 2000-11-11 Jim Meyering * error.c: Add a couple #includes, merging from GNU libc version. 2000-11-10 Jim Meyering * obstack.h: Update from GNU libc. * obstack.c: Likewise. 2000-11-06 Paul Eggert * getusershell.c (setusershell): Use rewind rather than fseek/fseeko, to avoid configuration hassles with fseeko. Don't bother opening SHELLS_FILE if shellstream is NULL; it's not necessary. 2000-11-05 Jim Meyering * makepath.h (make_dir): Declare. * makepath.c (make_dir): Remove `static' attribute. Tweak a comment. 2000-11-04 Alexandre Duret-Lutz * hash.c (hash_get_next): Fix a thinko: when ENTRY is the last one in a bucket, advance to the next bucket. 2000-11-02 Vesselin Atanasov * fnmatch.c: Do not comment out all the code if we are using the GNU C library, because in some cases we are replacing buggy code in the GNU C library itself. 2000-10-30 Paul Eggert * error.h, getline.h, modechange.h: Remove "2000" from Copyright line, as the file hasn't been changed this year other than in the copyright notice. * xalloc.h: Add "2000" to Copyright line, as this file was changed this year. 2000-10-30 Paul Eggert * fnmatch.c (FOLD): Do not assume that characters are unsigned. (fnmatch): Fix some FNM_FILE_NAME and FNM_LEADING_DIR bugs, e.g. fnmatch("d*/*1", "d/s/1", FNM_FILE_NAME) incorrectly yielded zero. 2000-10-29 Greg Louis * regex.h (__restrict_arr): Move definition out of #ifndef block. Required because egcs-2.91.66 (aka 1.1.2) defines __restrict, but doesn't define __restrict_arr. 2000-10-29 Jim Meyering * xstat.in: Fix grammar in comment. 2000-10-28 Jim Meyering * memchr.c: Update from libc. Adjust for portability: [HAVE_STDLIB_H]: Include stdlib.h. [HAVE_BP_SYM_H || _LIBC]: Guard inclusion of bp-sym.h. Undef __memchr, too. [!weak_alias]: Define __memchr to memchr. * regex.c: Update from libc. * regex.h: Likewise. * getopt1.c: Likewise. * memcmp.c: Likewise. * getusershell.c (setusershell) [HAVE_FSEEKO]: Use fseeko. Avoid using fseek, when possible -- it's broken by design. Patch by Ulrich Drepper. 2000-10-26 Jim Meyering * strftime.c: Update from libc. 2000-10-25 Jim Meyering * obstack.c: Update from libc. 2000-10-23 Jim Meyering * hard-locale.c (hard_locale): Revert last change -- it was simply wrong. That set_locale call must not have any side effects. From Paul Eggert. 2000-10-22 Jim Meyering * md5.c (md5_process_block) [OP]: Use `rol', not CYCLIC. [CYCLIC]: Remove now-unused definition. * save-cwd.c (O_DIRECTORY): Define, if needed. (save_cwd) [HAVE_FCHDIR]: Use O_DIRECTORY when opening ".". Suggestion from Ulrich Drepper. 2000-10-21 Jim Meyering * dirname.c (dir_name_r): New function, factored out of dir_name. (dir_name): Use dir_name_r. * dirname.h (dir_name_r): Declare it. 2000-10-21 Jim Meyering * dirname.c (memrchr): Declare if necessary. (dir_name): Remove the restriction that there be no trailing slashes. Now, this code skips past them, effectively ignoring them. [TEST_DIRNAME] (main): New unit tests. * memrchr.c: New file from GNU libc. Undef __memrchr, too. [!weak_alias]: Define __memrchr to memrchr. Guard weak_alias use with `#ifdef weak_alias'. 2000-10-17 Jim Meyering * quote.h (PARAMS): Define and use. Reported by Akim Demaille. * getopt.c: Update from libc. 2000-10-16 Jim Meyering * hard-locale.c (hard_locale): Use "", not 0 as 2nd arg to setlocale. From Jan Fedak. 2000-09-25 Jim Meyering * md5.h (rol): Define (from GnuPG). * sha.c: Give credit (GnuPG) where due. (M): Use rol rather than open-coding it. Add a FIXME comment. 2000-09-21 Jim Meyering * userspec.c (parse_user_spec): Remove debugging printf I'd added. Reported by Michael Stone. 2000-09-20 Jim Meyering * Makefile.am (libfetish_a_SOURCES): Add sha.c. (noinst_HEADERS): Add sha.h. Based on code from Scott G. Miller and from GnuPG. 2000-09-15 Jim Meyering * regex.c: Update from libc. 2000-09-10 Jim Meyering * getopt.c (_getopt_internal): Update from glibc. 2000-09-09 Jim Meyering * quotearg.c: Rename ISASCII to IN_CTYPE_DOMAIN, so people don't think it should be used as a general replacement for isascii. * fnmatch.c: Likewise. * mbswidth.c: Likewise * regex.c: Likewise. Don't use atoi. * userspec.c: Include sys/param.h and limits.h. Include xstrtol.h. (CHAR_BIT, TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): Define. (UID_T_MAX, GID_T_MAX, MAXUID, MAXGID): Define. (parse_user_spec): Use xstrtoul, not atoi when converting numeric UID, GID. Check range. 2000-09-06 Jim Meyering * getopt.c (_getopt_internal): Update from glibc. 2000-08-30 Jim Meyering * strftime.c: Merge in changes from GNU libc. 2000-08-26 Jim Meyering * closeout.c: Include "__fpending.h". (close_stdout_status): Return right away if there's nothing to flush. * Makefile.am (noinst_HEADERS): Add __fpending.h. * __fpending.c: New file. * __fpending.h: New file. 2000-08-07 Paul Eggert Standardize on "memory exhausted" instead of "Memory exhausted" or "virtual memory exhausted". * obstack.c (print_and_abort): Use "memory exhausted", not "virtual memory exhausted". * same.c (same_name): Invoke xalloc_die instead of printing our own message. * userspec.c (parse_user_spec): Likewise. * bumpalloc.h: comment fix * same.c, userspec.c: Include xalloc.h. * xalloc.h (xalloc_msg_memory_exhausted): Now char const[], not char *const and pointing to a constant array. * xmalloc.c (xalloc_msg_memory_exhausted): Likewise. (xrealloc): Comment fix. * userspec.c (parse_user_spec): Don't translate a message until just before returning, to avoid unnecessary translation. 2000-08-07 Jim Meyering * addext.c, argmatch.c, argmatch.h, backupfile.h, bumpalloc.h, chown.c, diacrit.h, dirname.h, dup2.c, exclude.h, fileblocks.c, fnmatch.c, fnmatch.h, fsusage.c, fsusage.h, getdate.h, getgroups.c, gethostname.c, getopt.h, group-member.c, hard-locale.c, hash.h, isdir.c, lchown.c, linebuffer.c, linebuffer.h, long-options.h, malloc.c, md5.c, md5.h, memchr.c, memcmp.c, memcoll.c, memset.c, mktime.c, modechange.h, obstack.h, pathmax.h, realloc.c, rmdir.c, safe-read.c, save-cwd.c, stime.c, stpcpy.c, strcasecmp.c, strcspn.c, strdup.c, stripslash.c, strstr.c, strtod.c, strtol.c, strtoul.c, strtoull.c, strtoumax.c, utime.c, version-etc.h, xalloc.h, xstrdup.c, xstrtoumax.c, yesno.c: Back out Copyright date changes for each file with no change this year. This eases coordination with other programs using the same source code modules. From Paul Eggert. 2000-08-03 Greg McGary * regex.c (SET_HIGH_BOUND, MOVE_BUFFER_POINTER, ELSE_EXTEND_BUFFER_HIGH_BOUND): New macros. (EXTEND_BUFFER): Use them. 2000-08-01 Jim Meyering * dirname.c (ISSLASH): Define. (BACKSLASH_IS_PATH_SEPARATOR): Define. (dir_name) [BACKSLASH_IS_PATH_SEPARATOR]: Handle the case in which both `\' and `/' may be use as path separators. Based on a patch from Prashant TR. 2000-07-31 Paul Eggert * quotearg.c (quotearg_n_options): Don't make the initial slot vector a constant, since it might get modified. 2000-07-31 Jim Meyering * xmalloc.c: Use `virtual memory exhausted', not `Memory exhausted'. * obstack.c (print_and_abort): Likewise. 2000-07-30 Paul Eggert * quotearg.c (quotearg_n_options): Preallocate a slot 0 buffer, so that the caller can always quote one small component of a "memory exhausted" message in slot 0. From a suggestion by Jim Meyering. 2000-07-30 Jim Meyering * makepath.c (make_path): Quote the other instance, too. * quotearg.c (N_STATIC_SLOTVECS): Define. (STATIC_BUF_SIZE): Define. (quotearg_n_options): Use only statically allocated storage when N < N_STATIC_SLOTVECS and the length of the quoted result is smaller than STATIC_BUF_SIZE. 2000-07-29 Jim Meyering * diacrit.c (diacrit_diac): Use __MSDOS__ in favor of MSDOS. * dirname.c (dir_name): Likewise. * basename.c (base_name): Use ISSLASH rather than comparing against `/'. * dirname.c (dir_name) [MSDOS]: Declare `lim' to be const. (dir_name): Assert that there are no trailing slashes. 2000-07-18 Bruno Haible * mbswidth.h (mbswidth): Add a flags argument. (mbswidth): New declaration. (MBSW_ACCEPT_INVALID, MBSW_ACCEPT_UNPRINTABLE): New macros. * mbswidth.c (mbswidth): Add a flags argument. (mbsnwidth): New function. 2000-07-24 Jim Meyering * mbswidth.c: Remove useless #else. From Bruno Haible. 2000-07-23 Paul Eggert * mbswidth.c (_XOPEN_SOURCE): Don't define; this causes problems on Solaris 7. (wcwidth) [!HAVE_DECL_WCWIDTH]: Declare. 2000-07-23 Paul Eggert * quotearg.c: Include even if ! (HAVE_MBRTOWC && 1 < MB_LEN_MAX), so that mbstate_t is always defined. Do not inspect MB_LEN_MAX, since it's incorrectly defined to be 1 in at least one GCC installation, and this configuration error is likely to be common. Ignoring MB_LEN_MAX hurts performance on hosts that have mbrtowc but have only unibyte locales, but I assume these hosts are rare. 2000-07-23 Paul Eggert * quotearg.c: Streamline by invoking multibyte code only if needed. : Include only if HAVE_MBRTOWC && 1 < MB_LEN_MAX. (MB_CUR_MAX): Redefine to 1 if ! (HAVE_MBRTOWC && 1 < MB_LEN_MAX). (quotearg_buffer_restyled): If a unibyte locale, don't bother to invoke multibyte primitives. 2000-07-23 Jim Meyering * basename.c (base_name): Add an assertion. 2000-07-15 Bruno Haible * quotearg.c: When the system forces us to redefine mbstate_t, shadow its mbsinit function. 2000-07-16 Bruno Haible * mbswidth.h: New file. * mbswidth.c: New file. * Makefile.am (libfetish_a_SOURCES): Add mbswidth.c. (noinst_HEADERS): Add mbswidth.h. 2000-07-17 Bruno Haible * config.charset: Add support for FreeBSD. Improve support for HP-UX and IRIX 6. 2000-07-15 Jim Meyering * makepath.c: Include quote.h. (make_path): Convert "`%s'" in format strings to "%s", and wrap each corresponding argument in a `quote (...)' call. Give better diagnostics. * Makefile.am (libfetish_a_SOURCES): Add quote.c. (noinst_HEADERS): Add quote.h. * quote.c (quote, quote_n): New file. Two functions taken verbatim from tar's src/misc.c. * quote.h: New file. Prototypes for same. 2000-07-10 Paul Eggert From a suggestion by Bruno Haible. * quotearg.c (mbrtowc): Do not use HAVE_WCHAR_H in the definition. Use defined mbstate_t, not HAVE_MBSTATE_T_OBJECT, to decide whether to define the BeOS workaround macro; this adjusts to the change to AC_MBSTATE_T. 2000-07-13 Paul Eggert * quotearg.h (enum quoting style): New enum clocale_quoting_style. * quotearg.c (quoting_style_args, quoting_style_vals, quotearg_buffer_restyled): Add support for clocale_quoting_style. Undo previous change to locale_quoting_style behavior, and undo the "{LEFT QUOTATION MARK}" and "{RIGHT QUOTATION MARK}" msgids. 2000-07-05 Paul Eggert The old behavior of quoting `like this' doesn't look good with newer, ISO-style fonts. See: http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html Instead, quote "like this" by default. Let the translator tailor the locale-specific quoting behavior by providing translations for {LEFT QUOTATION MARK} and {RIGHT QUOTATION MARK}. * quotearg.c (N_): New macro. (gettext_default): New function. (quotearg_buffer_restyled): Use gettext_default ("{LEFT QUOTATION MARK}", "\"") for left quote, and gettext_default ("{RIGHT QUOTATION MARK}", "\"") for right quote. 2000-07-09 Jim Meyering * Most files: Update copyright dates to include 2000. 2000-07-08 Jim Meyering * xgethostname.c (ENAMETOOLONG): Define to an unlikely value if not defined. (xgethostname): Remove now-unnecessary #ifdef. Move declaration of `err' into loop where it's used. 2000-07-05 Bruno Haible * xgethostname.c (xgethostname): Protect against the SunOS 5.5 bug by allocating a larger buffer. Test the gethostname return value for being >= 0, not == 0, for BeOS. Don't exhaust memory if gethostname returns an error and ENAMETOOLONG isn't defined. 2000-07-05 Paul Eggert and Bruno Haible * quotearg.c (mbrtowc): Declare returned type, since BeOS doesn't. 2000-07-05 Bruno Haible * quotearg.c (struct quoting_options): Simplify quote_these_too dimension. 2000-07-03 Jim Meyering * strndup.c: [!HAVE_DECL_STRNLEN]: Declare strnlen. Reported by Bruno Haible. 2000-07-04 Jim Meyering * quotearg.c: Make inclusion of independent of whether HAVE_MBRTOWC is set. Required at least for irix-5.6, which lacks mbrtowc. 2000-07-03 Paul Eggert and Bruno Haible * quotearg.c (mbrtowc): Assign to *pwc, and return 1 only if result is nonzero. (iswprint): Use ISPRINT when substituting our own mbrtowc. 2000-07-03 Jim Meyering * readutmp.h: [HAVE_UTMPX_H]: Include if HAVE_UTMP_H. This is necessary to get a definition of e.g., UTMP_FILE on HP-UX 10.20. From Bob Proulx. 2000-07-02 Jim Meyering * quotearg.c (mbstate_t): Don't define here. 2000-07-02 Jim Meyering * nanosleep.c (SIGCONT): Define if not already defined. 2000-06-17 Bruno Haible * mountlist.c: Use MOUNTED_FS_STAT_DEV instead of MOUNTED_NEXT_DEV, per change in ../m4/ls-mntd-fs.m4. (read_filesystem_list): Ignore symbolic links. 2000-06-29 Jim Meyering * same.c: Include or , as appropriate, for declaration of strcmp. * long-options.c: Include , for declaration of exit. * mountlist.c (fsp_to_string) [HAVE_F_FSTYPENAME_IN_STATFS]: Avoid warning by casting result to `char *' to remove `const'. 2000-06-17 Bruno Haible * Makefile.am (libfetish_a_SOURCES): Remove readutmp.c. 2000-06-26 Paul Eggert savedir now sets errno on failure and invokes xmalloc to get memory. Fix a couple of other minor bugs while we're at it. * savedir.c (): Do not include; there's no need. (NAMLEN): Remove macro. (malloc, realloc): Remove decls. (stpcpy): Likewise. ("xalloc.h"): Include. (NAME_SIZE_DEFAULT): New macro. (savedir): Use xmalloc / xrealloc to allocate memory. Use NAME_SIZE_DEFAULT if name_size is negative or overflows to zero. Skip "" directory entries. Use strlen to calculate directory entry length, since the old method is rarely used these days and isn't worth supporting. Don't use a pointer after freeing it. Check for integer overflow when calculating allocation size. Use memcpy to copy entries, instead of stpcpy. Set errno properly when returning NULL. Check for readdir error. 2000-06-26 Jim Meyering * posixtm.c [HAVE_STDLIB_H]: Include stdlib.h, for decl of abort. 2000-06-17 Bruno Haible * getusershell.c (xmalloc, xrealloc): Remove functions. Include xalloc.h. Don't include . Don't declare malloc, realloc. 2000-06-23 Bruno Haible * unicodeio.c (print_unicode_char): Work around ansi2knr deficiency. 2000-06-24 Jim Meyering * error.c [!HAVE_DECL_STRERROR_R]: Declare strerror_r. 2000-06-21 Jim Meyering * getpass.c: New file, from Bruno Haible. Required for BeOS. 2000-06-19 Paul Eggert * quotearg.c: Include after , for Solaris 2.5. (mbrtowc, mbstate_t): Define substitutes if HAVE_MBRTOWC && HAVE_WCHAR_H && !HAVE_MBSTATE_T_OBJECT. (iswprint): Define to 1 if !defined iswprint && !HAVE_ISWPRINT, not if ! (HAVE_MBRTOWC && HAVE_WCHAR_H). 2000-06-17 Bruno Haible * xgetcwd.c (xgetcwd): If the required pathname length is smaller than 1024, return a memory chunk of least possible size, instead of size PATH_MAX + 2. In the loop, increment the size proportionally. Use free/xmalloc instead of xrealloc to avoid copying for very long paths. 2000-06-17 Bruno Haible * canon-host.c (canon_host): Use malloc and memcpy to copy an address, not strdup. Include and don't declare free(). 2000-06-17 Bruno Haible * path-concat.c (path_concat): Don't access dir[-1] if dir is the empty string. 2000-06-21 Jim Meyering * Makefile.am (libfetish_a_SOURCES): Add getstr.c. (noinst_HEADERS): Add getstr.h. * getline.c (getstr): Move into a separate file. * getstr.c (getstr): New file, extracted from getline.c, with the following changes: new parameter, delim2; both delim[12] parameters have type `int', not `char'. The latter would lose with 8-bit delimiters. * getstr.h: New file. 2000-06-19 Jim Meyering * getloadavg.c [HAVE_NLIST_H] (NLIST_STRUCT): Define. 2000-06-18 Jim Meyering * mkdir.c: Remove file, due mainly to copyright incompatibility. Besides, these days every porting target provides a mkdir function. * strnlen.c: Include memory.h, string.h, and/or strings.h as needed. (this snippet comes from src/system.h). 2000-06-15 Paul Eggert * human.c (adjust_value): New function. (human_readable_inexact): Apply rounding style even when printing approximate values. 2000-06-14 Paul Eggert * human.c (human_readable_inexact): Allow an input block size that is not a multiple of the output block size, and vice versa. Reported by Piergiorgio Sartor. 2000-06-14 Paul Eggert * getdate.y (get_date): Apply relative times after time zone indicator, not before. Reported by Todd A. Jacobs. 2000-06-13 Jim Meyering * Makefile.am (all-local): Depend on lstat.c and stat.c. * xstat.in [!HAVE_DECL_FREE]: Declare free in lstat.c. 2000-06-12 Paul Eggert * xstat.in: Include in lstat, to declare "free". 2000-06-04 Paul Eggert * strnlen.c: Include if HAVE_CONFIG_H. 2000-06-04 Jim Meyering * getugroups.c (getugroups): Cast -1 to gid_t, for systems like SunOS 4.1.4 for which gid_t is an unsigned type. 2000-06-03 Jim Meyering * strnlen.c [!HAVE_DECL_MEMCHR]: Declare memchr. 2000-05-26 Bruno Haible * Makefile.am (install-exec-local): On systems with glibc-2.1 or newer, don't install charset.alias. * config.charset: Change the Linux/glibc rules so they become empty on glibc-2.1 or newer. 2000-06-02 Jim Meyering * mountlist.c: Back out last change. Instead, do this... * mountlist.c (read_filesystem_list) [MOUNTED_VMOUNT]: Set the me_dummy member using the same `ignore'-testing code. * mountlist.h (ME_DUMMY): Add `autofs' to the list of ignored fs_type strings. From Mark D. Roth. 2000-05-29 Jim Meyering * mountlist.c (read_filesystem_list) [MOUNTED_VMOUNT]: Ignore mounts with the `ignore' attribute. Based on a patch from Mark D. Roth. 2000-05-22 Jim Meyering * makepath.c: Remove old, now-unnecessary `#ifdef __MSDOS__' block. 2000-05-18 Jim Meyering * hash.c (hash_rehash): Fix a nasty bug: copy the free entry list back, too, since it may have been modified by allocate_entry. (hash_delete): Rewrite to use neither the assignment operator nor the comma operator in an if-expression. 2000-05-15 Paul Eggert * closeout.c: , , , (STDOUT_FILENO): Remove; no longer needed. "quotearg.h": Add include. (file_name): Do not bother to explicitly initialize to NULL; it's less efficient on some hosts. (close_stdout_status): Remove test as to whether stdout was already closed; it breaks for the case "echo x | sort >&-". Quote file name colons. Do not assume that _("write error") lacks format strings. 2000-05-15 Jim Meyering * version-etc.c (version_etc_copyright): Update the copyright string used in all --version output. 2000-05-14 Jim Meyering * closeout.c (close_stdout_set_file_name): New function. (close_stdout_status): Use new file-scoped global. Return right away if fstat says the stdout file descriptor is invalid. * closeout.h (close_stdout_set_file_name): Declare. 2000-05-10 Jim Meyering * closeout.c [default_exit_status]: New file-scoped variable. (close_stdout_set_status): New function. * closeout.h (close_stdout_set_status): Declare. 2000-05-08 Jim Meyering * long-options.c: Don't include closeout.h. (parse_long_options): Don't call close_stdout for --version. 2000-05-06 Jim Meyering * strnlen.c: Undefine __strnlen and strnlen. [!weak_alias]: Define __strnlen to strnlen. * atexit.c: New file, from libiberty. 2000-05-06 Jim Meyering * closeout.c (close_stdout_status): Also check for errors on the stderr stream. 2000-05-05 Bruno Haible * localcharset.c (get_charset_aliases): Use malloc, realloc and memcpy instead of xmalloc, xrealloc, path_concat. (locale_charset): Treat empty environment variables as absent. (DIRECTORY_SEPARATOR, ISSLASH): New macros. 2000-05-04 Jim Meyering * getopt.c: Update from glibc. * obstack.c: Likewise. * obstack.h: Likewise. * regex.c: Likewise. NB: K&R compiler support is dropped for this file * regex.h: Likewise. * strndup.c: Likewise. * strnlen.c: New file, from glibc. 2000-05-01 Jim Meyering * full-write.c (full_write): Remove `FIXME' part of comment. 2000-04-29 Jim Meyering * path-concat.c: Declare strdup only if it's not defined. * canon-host.c: Likewise. 2000-04-28 Jim Meyering * rpmatch.c [HAVE_LIMITS_H]: Include limits.h before regex.h to avoid redefinition warning on some systems (HPUX). Otherwise, regex.h is included first, then limits.h is included by locale.h by libintl.h. From John David Anglin. 2000-04-25 Jim Meyering * makepath.c (S_IRWXUGO): Define. (make_path): Always perform explicit chmod if MODE specifies any of the `special' permission bits. Prompted by a bug report against install from Mate Wierdl and Joost van Baal. 2000-04-18 Jim Meyering * README: New file. * getpagesize.h [!getpagesize && HAVE_OS_H && B_PAGE_SIZE]: Define getpagesize. For BeOS. Based on a patch from Bruno Haible. 2000-04-17 Jim Meyering * strftime.c (my_strftime) [strftime]: Declare strftime here, since the definition of it to rpl_strftime also defined-away the system's declaration. 2000-04-15 Jim Meyering Use `C' to denote so-called `contiguous' files, the same way that tar does. * filemode.c (S_ISCTG) [!S_ISCTG && S_IFCTG]: Define. (ftypelet): Use S_ISCTG. From Michael Deutschmann. 2000-04-14 Jim Meyering * strftime.c (my_strftime) [#ifdef strftime]: Declare strftime. 2000-04-08 Jim Meyering * Makefile.am (charset.alias): Use t-$@, not $@-t so the DOS 8.3 names don't conflict. Reported by Eli Zaretskii. 2000-03-28 Bruno Haible * unicodeio.c (print_unicode_char): Avoid triggering Solaris iconv bug. Deal with the different error behavior of Irix iconv. 2000-04-07 Jim Meyering * putenv.c: Move inclusion of errno.h so it follows that of sys/types.h, to work around system header problems on AIX 3.2.5. From Bruno Haible. 2000-04-05 Jim Meyering Portability tweaks required for ultrix4.3. * readutmp.h [HAVE_UTMPX_H && !HAVE_DECL_GETUTENT]: Declare getutent. * readutmp.c: Include sys/types.h before sys/stat.h. * canon-host.c: Declare strdup. * path-concat.c: Likewise. From John David Anglin. 2000-04-04 Jim Meyering Be more DOS 8.3-friendly. * ref-add.sin: Renamed from ref-add.sed.in. * ref-del.sin: Renamed from ref-del.sed.in. * Makefile.am: Reflect renaming. Reported by Eli Zaretskii. Use a temporary file name that won't clash with `charset.alias' in the DOS 8.3 name space. * Makefile.am (charset_tmp): Define. (install-exec-local): Use $(charset_tmp) instead of $(charset_alias)-t. (uninstall-local): Likewise. Reported by Eli Zaretskii. 2000-03-29 Paul Eggert * time/strftime.c (my_strftime): Make sure we call the system strftime, not ourselves, when invoking the underlying strftime. 2000-03-24 Jim Meyering * Makefile.am (EXTRA_DIST): Add ref-add.sed.in and ref-del.sed.in. (charset_alias): Define. (install-exec-local): Factor out common code. (uninstall-local): Split lines longer than 80. (ref-add.sed, ref-del.sed): Remove rules... (do the following instead) (SUFFIXES): Define. (.sed.in.sed): New rule. Don't redirect directly to $@. (CLEANFILES): Add ref-add.sed and ref-del.sed. 2000-03-19 Bruno Haible * config.charset: Output a line containing "Packages using this file". * ref-add.sed.in, ref-del.sed.in: New files. * Makefile.am (install-exec-local, uninstall-local, ref-add.sed, ref-del.sed): New rules. 2000-03-17 Jim Meyering * unicodeio.c (): Include only #if HAVE_STRING_H. Otherwise, include 2000-03-17 Bruno Haible * unicodeio.c (utf8_wctomb): New function. (print_unicode_char): Pass the Unicode character to iconv in UTF-8 format instead of in UCS-4 with platform dependent endianness. 2000-03-07 Paul Eggert * savedir.c (savedir): Work even if directory size is negative; this can happen with some screwy NFS configurations. 2000-03-06 Jim Meyering * localcharset.c (get_charset_aliases): Don't try to free file_name if it's NULL (because we ran out of memory). From Bruno Haible. 2000-03-05 Jim Meyering * localcharset.c ("path-concat.h"): Include. (get_charset_aliases): Use path_concat instead of ANSI string concatenation. * unicodeio.h (PARAMS): Define. Use it to guard prototype. 2000-03-04 Jim Meyering * Makefile.am (install-exec-local): Create $(libdir) before installing into it. (uninstall-local): Uncomment this rule so `make distcheck' works once again. * unicodeio.c (): Include it. (errno): Declare if not defined. * localcharset.c: Add Bruno's comment justifying use of volatile. * config.charset: New version, incorporating remarks from a linux i18n mailing list. From Bruno Haible. 2000-03-02 Jim Meyering * Makefile.am (EXTRA_DIST): Add config.charset. 2000-03-01 Jim Meyering * localcharset.c: Guard some #includes with `#if HAVE_...'. * unicodeio.c: Likewise. 2000-02-02 Bruno Haible * config.charset: New file. * localcharset.c: New file. * unicodeio.h, unicodeio.c: New files. * Makefile.am (DEFS): Add -DLIBDIR=... (libfetish_a_SOURCES): Add localcharset.c and unicodeio.c. (noinst_HEADERS): Add unicodeio.h. (all-local, install-exec-local, charset.alias): New targets. 2000-02-28 Paul Eggert * quotearg.c (ALERT_CHAR): New macro. (quotearg_buffer_restyled): Use it. 2000-02-27 Jim Meyering * strtoumax.c: Fix typo in decl of strtoul: s/long long/long/. Guard declaration of strtoull also with `&& HAVE_UNSIGNED_LONG_LONG'. * backupfile.c: Guard inclusion of stdlib.h with `#if HAVE_STDLIB_H', not `#if STDC_HEADERS'. Declare malloc if needed. * backupfile.c: Use `#if !HAVE_DECL...' instead of `#ifndef HAVE_DECL..' now that autoconf always defines the HAVE_DECL_ symbols. * human.c: Likewise. * same.c: Likewise. * strtoumax.c: Likewise. * backupfile.c: Arrange for cpp to fail if the configure-time declaration check was not run. * hash.c: Likewise. * human.c: Likewise. * same.c: Likewise. * strtoumax.c: Likewise. * userspec.c (parse_user_spec): If there is no `:' but there is a `.', then first look up the entire `.'-containing string as a login name. 2000-02-18 Paul Eggert * getdate.y: Handle two-digit years with leading zeros correctly. (textint): New typedef. (parser_control): Member year changed from int to textint. All uses changed. (YYSTYPE): Removed; replaced by %union with int and textint members. (tDAY, tDAY_UNIT, tDAYZONE, tHOUR_UNIT, tID, tLOCAL_ZONE, tMERIDIAN, tMINUTE_UNIT, tMONTH, tMONTH_UNIT tSEC_UNIT, tSNUMBER, tUNUMBER, tYEAR_UNIT, tZONE, o_merid): Now of type . (tSNUMBER, tUNUMBER): Now of type . (date, number, to_year): Use width of number in digits, not its value, to determine whether it's a 2-digit year, or a 2-digit time. (yylex): Store number of digits of numeric tokens. Reported by John Kendall. (parser_control): Changed from struct parser_control to typedef (for consistency). All uses changed. (tID): Removed; not used. (yylex): Return '?' for unknown identifiers, rather than (unused) tID. 2000-02-14 Paul Eggert * getpagesize.h (getpagesize): Port to VMS for Alpha; adapted from changes to grep getpagesize.h by Martin P.J. Zinser. 2000-02-12 Jim Meyering * userspec.c (ISDIGIT): Define it. (isdigit): Remove definition. (is_number): Use ISDIGIT, not isdigit. : Include. (_ and N_): Define. (parse_user_spec): Mark translatable strings. 2000-02-10 Jim Meyering With these changes, nanosleep.[ch] are finally enough like the other lib/* replacement files to compile on a few more losing systems. * nanosleep.h: Don't include config.h. Remove prototype from declaration of nanosleep. (PARAMS): Remove now-unneeded definition. * nanosleep.c: #undef nanosleep. (rpl_nanosleep): Rename from nanosleep. 2000-02-03 Jim Meyering * readutmp.c (read_utmp): Guard with `#ifdef UTMP_NAME_FUNCTION', rather than with `#if HAVE_UTMPNAME'. 2000-02-01 Jim Meyering * readutmp.h (UT_USER): Add parens. From Andreas Schwab. 2000-01-31 Jim Meyering * nanosleep.h (nanosleep): Guard declaration with `#if ! HAVE_DECL_NANOSLEEP'. Without this, OFS gets a redeclaration error for rpl_nanosleep, due to the declaration in that vendor's sys/timers.h. Reported by Christian Krackowizer. * quotearg.c (ISASCII): Add #undef and move definition to follow inclusion of wctype.h to work around Solaris 2.6 namespace pollution. (ISPRINT): Likewise. Reported by Tom Tromey. 2000-01-30 Jim Meyering * readutmp.c (extract_trimmed_name): Use UT_USER instead of hard-coding uses of ->ut_name. The latter doesn't work with new Linux header files where only utmpx.ut_user is declared. * readutmp.h (UT_USER): Define. 2000-01-23 Jim Meyering * Makefile.am (libfetish_a_SOURCES): Remove explicit mention of obstack.c. 2000-01-22 Jim Meyering * strtoumax.c: [! HAVE_DECL_STRTOUL]: Declare strtoul. [! HAVE_DECL_STRTOULL]: Declare strtoull. Required for some AIX systems. Reported by Christian Krackowizer. [TESTING] (main): New function. 1997-10-17 Eli Zaretskii * dirname.c (dir_name): Support for DOS-style file names with drive letters. * quotearg.c [HAVE_WCTYPE_H]: Include for decl of iswprint. * strverscmp.c (ISDIGIT): Define. (strverscmp): Use ISDIGIT, not isdigit. 2000-01-17 Paul Eggert * nanosleep.c (nanosleep): Don't use SA_INTERRUPT to decide whether to call sigaction, as POSIX.1 doesn't require SA_INTERRUPT and some systems (e.g. Solaris 7) don't define it. Use SA_NOCLDSTOP instead; it's been part of POSIX.1 since day 1 (in 1988). 2000-01-17 Jim Meyering * interlock: Remove unused file. Reported by François Pinard. 2000-01-16 Paul Eggert * quotearg.c (quotearg_buffer_restyled): Do not quote alert, backslash, formfeed, and vertical tab unnecessarily in shell quoting style.