Paul Eggert [Wed, 28 Jul 2004 06:59:27 +0000 (06:59 +0000)]
In src/printf.c, declare strtoimax and strtoumax if not already declared.
Paul Eggert [Wed, 28 Jul 2004 06:58:25 +0000 (06:58 +0000)]
(strtiomax, strtoumax): Declare if not already
declared: this fixes a portability bug with Solaris 8 + GCC.
(STRTOX): Parenthesize use of macro arg as expression.
(vstrtoimax, vstrtoumax, vstrtold): Remove now-unnecessary
parentheses.
Paul Eggert [Wed, 28 Jul 2004 06:58:09 +0000 (06:58 +0000)]
Check for declaration of strtoumax, for src/printf.c.
Paul Eggert [Wed, 28 Jul 2004 05:26:31 +0000 (05:26 +0000)]
Regenerate.
Paul Eggert [Wed, 28 Jul 2004 05:02:17 +0000 (05:02 +0000)]
Get eaccess from libgen if available; that's where it is on Solaris 9.
Paul Eggert [Wed, 28 Jul 2004 05:00:35 +0000 (05:00 +0000)]
(cp_LDADD, ginstall_LDADD, mv_LDADD,
pathchk_LDADD, rm_LDADD, test_LDADD): New vars, for eaccess.
Paul Eggert [Wed, 28 Jul 2004 05:00:10 +0000 (05:00 +0000)]
(gl_PREREQ_EUIDACCESS): Don't bother checking for
unistd.h, as autoconf does this for us. Check for libgen.h.
Also look for eaccess within -lgen, which is where it is in
Solaris. Set LIB_EACCESS accordingly.
Paul Eggert [Wed, 28 Jul 2004 04:59:44 +0000 (04:59 +0000)]
euidaccess.c [HAVE_LIBGEN_H]: Include <libgen.h>, for
eaccess on Solaris and SVR4-like systems.
(euidaccess): Use HAVE_EACCESS, not HAVE_DECL_EACCESS.
Paul Eggert [Wed, 28 Jul 2004 00:31:58 +0000 (00:31 +0000)]
cycle-check integer overflow fixup.
Paul Eggert [Wed, 28 Jul 2004 00:31:14 +0000 (00:31 +0000)]
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 <inttypes.h> and <stdint.h> 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.
Paul Eggert [Wed, 28 Jul 2004 00:30:45 +0000 (00:30 +0000)]
(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.
Paul Eggert [Wed, 28 Jul 2004 00:06:57 +0000 (00:06 +0000)]
Don't assume that we can remove the working directory in tests.
Paul Eggert [Tue, 27 Jul 2004 23:20:48 +0000 (23:20 +0000)]
Regenerate.
Paul Eggert [Tue, 27 Jul 2004 23:20:03 +0000 (23:20 +0000)]
Merged into backupfile.c.
Paul Eggert [Tue, 27 Jul 2004 23:15:05 +0000 (23:15 +0000)]
backupfile integer overflow fixups
Paul Eggert [Tue, 27 Jul 2004 23:14:53 +0000 (23:14 +0000)]
backupfile integer overflow fixups
Paul Eggert [Tue, 27 Jul 2004 23:14:30 +0000 (23:14 +0000)]
(do_link): find_backup_file_name no longer returns NULL, so don't
bother to check for this.
Paul Eggert [Tue, 27 Jul 2004 23:14:05 +0000 (23:14 +0000)]
(do_copy): find_backup_file_name no longer returns NULL, so don't
bother to check for this.
Paul Eggert [Tue, 27 Jul 2004 23:13:38 +0000 (23:13 +0000)]
(copy_internal): find_backup_file_name no longer
returns NULL, so don't bother to check for this.
Paul Eggert [Tue, 27 Jul 2004 23:13:17 +0000 (23:13 +0000)]
(gl_BACKUPFILE): AC_REQUIRE
gl_CHECK_TYPE_STRUCT_DIRENT_D_INO instead of invoking it directly.
Do not require AC_FUNC_CLOSEDIR_VOID.
Paul Eggert [Tue, 27 Jul 2004 23:12:56 +0000 (23:12 +0000)]
backupfile.c rewrite to avoid arbitrary limits on lengths of
numeric backup extensions.
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.
Paul Eggert [Tue, 27 Jul 2004 23:12:17 +0000 (23:12 +0000)]
backupfile.h (addext): Remove decl.
Paul Eggert [Tue, 27 Jul 2004 23:11:55 +0000 (23:11 +0000)]
(libfetish_a_SOURCES): Remove addext.c.
Paul Eggert [Mon, 26 Jul 2004 06:14:11 +0000 (06:14 +0000)]
Regenerate.
Paul Eggert [Mon, 26 Jul 2004 06:08:50 +0000 (06:08 +0000)]
(GET_NICE_VALUE): Renamed from GET_PRIORITY.
All uses changed.
(NZERO): New macro, if system doesn't define it already.
(usage): Distinguish priorities from nice values.
Don't assume NZERO is 20.
(main): Use bool instead of int where appropriate.
If user specifies an adjustment out of range, always truncate it
to an inrange value instead of sometimes giving an error message
and sometimes not.
Do not assume that -1 is an error return from "nice" or
"getpriority", as it might be the current nice value minus NZERO.
If nice/setpriority fails with errno == EPERM, go ahead and run
the command anyway; POSIX requires this.
Paul Eggert [Mon, 26 Jul 2004 06:08:18 +0000 (06:08 +0000)]
(nice invocation): Document the "nice value", and
how it affects the scheduling priority. (The old documentation
implied that the nice value equaled the scheduling priority, which
isn't accurate.) Document that the range of nice values might
exceed -20..19. Specify what happens when you give a nice value
that is out of range, or when you don't have permissions to lower
the nice value. Bash doesn't have a builtin 'nice', so don't say
"most shells" have one.
Paul Eggert [Mon, 26 Jul 2004 06:07:40 +0000 (06:07 +0000)]
Document portability and POSIX fixes for "nice".
Paul Eggert [Mon, 26 Jul 2004 06:07:04 +0000 (06:07 +0000)]
Portability and POSIX fixes for "nice".
Paul Eggert [Mon, 26 Jul 2004 06:06:30 +0000 (06:06 +0000)]
Portability and POSIX fixes for "nice".
Paul Eggert [Sun, 25 Jul 2004 23:01:23 +0000 (23:01 +0000)]
Remove setreuid/setregid test from gl_MACROS.
Paul Eggert [Sun, 25 Jul 2004 23:00:47 +0000 (23:00 +0000)]
Update serial number.
Paul Eggert [Sun, 25 Jul 2004 23:00:11 +0000 (23:00 +0000)]
(gl_MACROS): Remove test for setreuid and setregid,
as test.c no longer uses them directly.
Paul Eggert [Sun, 25 Jul 2004 07:48:17 +0000 (07:48 +0000)]
Regenerate.
Paul Eggert [Sun, 25 Jul 2004 07:40:32 +0000 (07:40 +0000)]
euidaccess fixes
Paul Eggert [Sun, 25 Jul 2004 07:39:02 +0000 (07:39 +0000)]
(R_OK, W_OK, X_OK, FOK): Remove; system.h defines them.
(eaccess): Remove. All users changed to use euidaccess instead.
Paul Eggert [Sun, 25 Jul 2004 07:38:39 +0000 (07:38 +0000)]
pathchk.c: Include euidaccess.h.
(dir_ok): Use euidaccess, not access.
Paul Eggert [Sun, 25 Jul 2004 07:38:19 +0000 (07:38 +0000)]
(gl_PREREQ): Invoke gl_FUNC_NONREENTRANT_EUIDACCESS,
not gl_FUNC_EUIDACCESS.
Paul Eggert [Sun, 25 Jul 2004 07:37:55 +0000 (07:37 +0000)]
(gl_FUNC_NONREENTRANT_EUIDACCESS): New macro.
(gl_FUNC_EUIDACCESS): Use AC_CHECK_DECLS_ONCE, not AC_CHECK_DECLS.
(gl_PREREQ_EUIDACCESS): Check for eaccess and setregid decls.
Require AC_HEADER_STAT.
Paul Eggert [Sun, 25 Jul 2004 07:37:22 +0000 (07:37 +0000)]
[!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 down by group-member.h.
No need to include <limits.h>.
(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 <stdlib.h>; don't include errno.h
twice; include <error.h> rather than "error.h".
Paul Eggert [Sat, 24 Jul 2004 08:03:55 +0000 (08:03 +0000)]
Move some changelog entries here from ../ChangeLog.
Paul Eggert [Sat, 24 Jul 2004 08:03:40 +0000 (08:03 +0000)]
Fix non-null-terminated-string bugs in who and uptime.
Paul Eggert [Sat, 24 Jul 2004 08:03:02 +0000 (08:03 +0000)]
(print_uptime) [defined BOOT_MSG]:
Don't assume ut_line is null-terminated.
Paul Eggert [Sat, 24 Jul 2004 08:01:49 +0000 (08:01 +0000)]
(print_line): New arguments USERLEN and LINELEN, since USER and LINE
might not be null terminated. All callers changed.
Paul Eggert [Fri, 23 Jul 2004 22:41:52 +0000 (22:41 +0000)]
Regenerate.
Paul Eggert [Fri, 23 Jul 2004 22:36:07 +0000 (22:36 +0000)]
Fix bug with tail -f and pipes, plus a few other problems with tail.
Paul Eggert [Fri, 23 Jul 2004 22:35:47 +0000 (22:35 +0000)]
Add fcntl-safer.
Paul Eggert [Fri, 23 Jul 2004 22:35:07 +0000 (22:35 +0000)]
(gl_PREREQ): Add gl_FCNTL_SAFER.
Paul Eggert [Fri, 23 Jul 2004 22:33:51 +0000 (22:33 +0000)]
Include fcntl-safer.h.
(COPY_TO_EOF): Set to UINTMAX_MAX, not OFF_T_MAX (which was wrong).
(COPY_A_BUFFER): New macro.
(struct File_spec): New members mtime, mode, blocking.
Remove member n_consecutive_size_changes.
(DEFAULT_MAX_N_CONSECUTIVE_SIZE_CHANGES,
max_n_consecutive_size_changes_between_opens,
MAX_CONSECUTIVE_SIZE_CHANGES_OPTION): Remove.
(long_options, tail_forever, parse_options):
Remove (non-)support for --max-consecutive-size-changes.
(record_open_fd): New function.
(recheck, tail_file): Use it. Don't assume that stdin is open.
(dump_remainder): Add support for new COPY_A_BUFFER special value.
Treat errno==EAGAIN like EOF, since it might be a nonblocking read.
(recheck): New arg BLOCKING, specifying whether to use blocking reads.
All uses changed.
(n_live_files): Remove, replacing with...
(any_live_files): New function. All uses changed.
(tail_forever): Use nonblocking I/O unless we know that blocking I/O
is safe; this avoids some hangs when reading from a fifo.
Avoid invoking fstat or sleep when using blocking I/O.
Do not check for changes to size if the file is not a regular file,
as the size is undefined in that case.
Check for changes to mtime or mode, too; this works for non-regular
files.
(tail_forever, main): Redo fflush strategy to work even when input
is nonblocking. Don't use unbuffered output; just flush when needed.
Paul Eggert [Fri, 23 Jul 2004 22:33:23 +0000 (22:33 +0000)]
(libfetish_a_SOURCES): Add fcntl-safer.h, open-safer.c.
Paul Eggert [Fri, 23 Jul 2004 22:31:32 +0000 (22:31 +0000)]
New file.
Paul Eggert [Fri, 23 Jul 2004 22:11:49 +0000 (22:11 +0000)]
(tail invocation): "size has remained the same"
-> "file has not changed", which is more accurate for fifos.
Paul Eggert [Fri, 23 Jul 2004 22:11:15 +0000 (22:11 +0000)]
tail: Fix bug with -f and pipes; remove --max-consecutive-size-changes.
Paul Eggert [Thu, 22 Jul 2004 20:58:52 +0000 (20:58 +0000)]
Regenerate.
Paul Eggert [Thu, 22 Jul 2004 20:55:12 +0000 (20:55 +0000)]
Add fix for "tail -f" when stdin is a pipe.
Paul Eggert [Thu, 22 Jul 2004 20:54:53 +0000 (20:54 +0000)]
Reinstate f-1 test, since we now pass.
Add a new commented-out f-2 test, which we still fail.
(test_vector): All f-* tests are special cases, not just f-1.
Paul Eggert [Thu, 22 Jul 2004 20:54:33 +0000 (20:54 +0000)]
(tail invocation): Do not ignore -f for
all pipes, just for when standard input is a pipe and no
file operand is specified.
Paul Eggert [Thu, 22 Jul 2004 20:54:04 +0000 (20:54 +0000)]
(main): Ignore -f if no file operand is specified
and standard input is a pipe.
Paul Eggert [Tue, 13 Jul 2004 00:07:26 +0000 (00:07 +0000)]
Prefer c_strtod to setlocale when scanning floating point.
Paul Eggert [Mon, 12 Jul 2004 18:19:38 +0000 (18:19 +0000)]
Include <errno.h>, <stdio.h>, <stdlib.h> 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 <limits.h>.
(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.
Paul Eggert [Mon, 12 Jul 2004 17:55:06 +0000 (17:55 +0000)]
Include c-strtod.h.
(print_uptime): Use c_strtod instead of setlocale and sscanf.
Use long int rather than int to count days (for 64-bit hosts),
and check for arithmetic overflow when converting double to time_t.
Paul Eggert [Mon, 12 Jul 2004 17:50:28 +0000 (17:50 +0000)]
(gl_C_STRTOD): Add gl_USE_SYSTEM_EXTENSIONS.
Paul Eggert [Mon, 12 Jul 2004 17:50:11 +0000 (17:50 +0000)]
(STRTOD_L): New macro.
(C_STRTOD) [defined LC_ALL_MASK]: Use it, so that the
code is reentrant on platforms that have strtod_l.
Paul Eggert [Mon, 12 Jul 2004 06:43:20 +0000 (06:43 +0000)]
Regenerate.
Paul Eggert [Mon, 12 Jul 2004 06:42:43 +0000 (06:42 +0000)]
Regenerate.
Paul Eggert [Mon, 12 Jul 2004 06:40:24 +0000 (06:40 +0000)]
printf now uses long double.
Paul Eggert [Mon, 12 Jul 2004 06:39:23 +0000 (06:39 +0000)]
New file.
Paul Eggert [Mon, 12 Jul 2004 06:36:55 +0000 (06:36 +0000)]
(vstrtold): Renamed from vstrtod.
Now returns long double. All uses changed.
(print_direc): Use "L" length modifier when printing floating point
numbers, since we're now printing long double.
Paul Eggert [Mon, 12 Jul 2004 06:36:02 +0000 (06:36 +0000)]
(gl_PREREQ): Add gl_C_STRTOLD.
Paul Eggert [Mon, 12 Jul 2004 06:31:53 +0000 (06:31 +0000)]
New file.
Paul Eggert [Mon, 12 Jul 2004 06:31:01 +0000 (06:31 +0000)]
(c_strtold): New decl.
Paul Eggert [Mon, 12 Jul 2004 06:30:36 +0000 (06:30 +0000)]
Include <config.h> first.
(C_STRTOD, DOUBLE, STRTOD): New macros.
(c_strtod): Use them.
Paul Eggert [Mon, 12 Jul 2004 06:29:59 +0000 (06:29 +0000)]
(libfetish_a_SOURCES): Add c-strtold.c.
Jim Meyering [Thu, 8 Jul 2004 14:04:35 +0000 (14:04 +0000)]
.
Jim Meyering [Thu, 8 Jul 2004 14:03:45 +0000 (14:03 +0000)]
*** empty log message ***
Jim Meyering [Thu, 8 Jul 2004 14:03:20 +0000 (14:03 +0000)]
printf cleanup, to avoid undefined behavior, to add support for
formats that Bash supports, and to support wide integers like
Bash does.
Add tests for the above.
Jim Meyering [Thu, 8 Jul 2004 14:01:59 +0000 (14:01 +0000)]
*** empty log message ***
Jim Meyering [Thu, 8 Jul 2004 14:01:49 +0000 (14:01 +0000)]
printf cleanup, to avoid undefined behavior, to add support for
formats that Bash supports, and to support wide integers like
Bash does.
(UNSPECIFIED): Remove. All uses now replaced by
booleans, so that we don't reserve any values for precision or
width (like Bash).
(STRTOX): Use prototype, not K&R-style definition.
(vstrtoimax): Renamed from xstrtol (to avoid confusion with xstrtol
in ../lib), with type change to intmax_t.
All uses changed.
(vstrtoumax): Renamed from xstrtoul, with type change to uintmax_t.
All uses changed.
(vstrtod): Renamed from xstrtod. All uses changed.
(print_direc): Use boolean arg instead of special value to indicate
a missing precision or width. LENGTH no longer includes
length modifiers or conversion character. New arg CONVERSION
now specifies conversion character.
Use intmax_t-width formatting for integers (like Bash).
Add support for C99 %a, %A, %F (like Bash).
Add support for field width with %c (POSIX requires this).
Add a FIXME for lack of support for field width and precision
for %b.
Add support for '\'', '0' flags.
Check for invalid combinations of flags, field width, precision,
and conversion, to prevent use of undefined behavior.
Allow multiple length modifiers, for formats like "%lld" (like Bash).
Add support for C99 'j', 't', 'z' length modifiers (like Bash).
In error message, output entire invalid conversion specification,
instead of merely outputting % followed by the conversion char.
Jim Meyering [Wed, 7 Jul 2004 15:54:54 +0000 (15:54 +0000)]
*** empty log message ***
Jim Meyering [Wed, 7 Jul 2004 15:54:51 +0000 (15:54 +0000)]
Don't infloop when MAXSYMLINKS is not defined.
Detect symlink loops much earlier (albeit lazily) on systems
with MAXSYMLINKS defined to a large value.
Include "cycle-check.h".
(canonicalize_filename_mode): Don't try to detect loops by counting
symlink-hops. Instead, use the cycle-check module.
Jim Meyering [Wed, 7 Jul 2004 15:07:08 +0000 (15:07 +0000)]
Include stdbool.h.
Forward-declare `struct stat'.
Jim Meyering [Wed, 7 Jul 2004 09:28:24 +0000 (09:28 +0000)]
*** empty log message ***
Jim Meyering [Wed, 7 Jul 2004 09:28:15 +0000 (09:28 +0000)]
(canonicalize_filename_mode): Remove do-while(0) loop.
Replace each corresponding `break' stmt with `continue'.
Jim Meyering [Tue, 6 Jul 2004 17:30:29 +0000 (17:30 +0000)]
.
Jim Meyering [Tue, 6 Jul 2004 17:00:53 +0000 (17:00 +0000)]
.
Jim Meyering [Tue, 6 Jul 2004 17:00:36 +0000 (17:00 +0000)]
Include "stat-macros.h".
(canonicalize_filename_mode): Remove #ifdef S_ISLNK, now that
S_ISLNK is guaranteed to be defined (via stat-macros.h).
Jim Meyering [Tue, 6 Jul 2004 16:56:30 +0000 (16:56 +0000)]
*** empty log message ***
Jim Meyering [Tue, 6 Jul 2004 16:56:21 +0000 (16:56 +0000)]
(libfetish_a_SOURCES): Add canonicalize.c unconditionally.
Jim Meyering [Tue, 6 Jul 2004 16:55:40 +0000 (16:55 +0000)]
(canonicalize_mode_t): New type.
Jim Meyering [Tue, 6 Jul 2004 16:55:26 +0000 (16:55 +0000)]
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.
Jim Meyering [Tue, 6 Jul 2004 16:17:25 +0000 (16:17 +0000)]
*** empty log message ***
Jim Meyering [Tue, 6 Jul 2004 16:17:10 +0000 (16:17 +0000)]
(AC_FUNC_CANONICALIZE_FILE_NAME): Do not add canonicalize.c here.
Jim Meyering [Tue, 6 Jul 2004 16:16:01 +0000 (16:16 +0000)]
*** empty log message ***
Jim Meyering [Tue, 6 Jul 2004 16:15:45 +0000 (16:15 +0000)]
(readlink invocation): Document new
"readlink -f" behaviour and new canonicalize options, -e and -m.
Jim Meyering [Tue, 6 Jul 2004 16:14:45 +0000 (16:14 +0000)]
.
Jim Meyering [Tue, 6 Jul 2004 16:14:40 +0000 (16:14 +0000)]
renamed from ../misc/readline
Jim Meyering [Tue, 6 Jul 2004 16:14:19 +0000 (16:14 +0000)]
.
Jim Meyering [Tue, 6 Jul 2004 16:14:15 +0000 (16:14 +0000)]
From Dmitry V. Levin
Jim Meyering [Tue, 6 Jul 2004 16:13:31 +0000 (16:13 +0000)]
(SUBDIRS): Add readlink.
Jim Meyering [Tue, 6 Jul 2004 16:13:17 +0000 (16:13 +0000)]
(AC_CONFIG_FILES): Add tests/readlink/Makefile.
Jim Meyering [Tue, 6 Jul 2004 16:13:01 +0000 (16:13 +0000)]
(TESTS): Remove basic readlink test.