platform/upstream/coreutils.git
19 years ago(UNALIGNED_P): Use sizeof, not alignof.
Paul Eggert [Thu, 29 Jul 2004 17:34:20 +0000 (17:34 +0000)]
(UNALIGNED_P): Use sizeof, not alignof.

19 years ago(UNALIGNED_P): Use sizeof, not alignof.
Paul Eggert [Thu, 29 Jul 2004 17:33:38 +0000 (17:33 +0000)]
(UNALIGNED_P): Use sizeof, not alignof.

19 years ago'int' cleanup for "cat".
Paul Eggert [Thu, 29 Jul 2004 06:12:44 +0000 (06:12 +0000)]
'int' cleanup for "cat".

19 years ago(exit_status): Remove. Now done by passing a boolean
Paul Eggert [Thu, 29 Jul 2004 06:12:27 +0000 (06:12 +0000)]
(exit_status): Remove.  Now done by passing a boolean
'ok' flag around.
(simple_cat, cat): Return true if successful.  All callers changed.
(simple_cat, cat, main): Use bool for booleans.
(simple_cat): Use size_t for sizes.
(cat, main): Use the same names for parameters that we use for
long options, to avoid confusion.  This inverts the sense of the
show_tabs (formerly output_tabs) and number_nonblank
(formerly numbers_at_empty_lines) variables.
(main): Don't mess up (due to integer overflow) if we are given
INT_MAX - INT_MIN + 1 options.
[O_BINARY]: Don't invoke isatty unless the other options require it.
(main): When deciding whether to use simple_cat, don't worry
about binary option; it's irrelevant.

19 years agodcgen cleanup.
Paul Eggert [Wed, 28 Jul 2004 23:59:37 +0000 (23:59 +0000)]
dcgen cleanup.

19 years agoRemove comments, trailing white space, and empty
Paul Eggert [Wed, 28 Jul 2004 23:59:11 +0000 (23:59 +0000)]
Remove comments, trailing white space, and empty
lines from the output strings, to save space.
Use a narrower type like 'unsigned char' for line lengths, if
that will do.
Make the output variables static, not extern.

19 years agochown/chgrp cleanup.
Paul Eggert [Wed, 28 Jul 2004 23:39:12 +0000 (23:39 +0000)]
chown/chgrp cleanup.

19 years ago(chown_files): Return true/false, not 0/-1, since we don't set errno.
Paul Eggert [Wed, 28 Jul 2004 23:38:36 +0000 (23:38 +0000)]
(chown_files): Return true/false, not 0/-1, since we don't set errno.

19 years agoInclude inttostr.h.
Paul Eggert [Wed, 28 Jul 2004 23:37:49 +0000 (23:37 +0000)]
Include inttostr.h.
(UINT_MAX_DECIMAL_DIGITS, uint_to_string): Remove.
(gid_to_name, uid_to_name): Use imaxtostr/umaxtostr
instead of uint_to_string).
(describe_change): Instead of an int flag, use a char *
auxiliary; this avoids the need for casts.
Assume free (NULL) works.
(change_file_owner): Return true/false, not 0/-1, since
we don't set errno.  All callers changed.
Use bool when appropriate.
(chown_files): Likewise.

19 years ago(main): int -> bool when appropriate.
Paul Eggert [Wed, 28 Jul 2004 23:37:21 +0000 (23:37 +0000)]
(main): int -> bool when appropriate.

19 years ago(parse_group): Require base 10 when parsing groups as integers.
Paul Eggert [Wed, 28 Jul 2004 23:36:59 +0000 (23:36 +0000)]
(parse_group): Require base 10 when parsing groups as integers.
(main): int -> bool when appropriate.

19 years agouserspec.c cleanup, e.g. for "chown 010 file".
Paul Eggert [Wed, 28 Jul 2004 23:06:25 +0000 (23:06 +0000)]
userspec.c cleanup, e.g. for "chown 010 file".

19 years agoInclude <stdbool.h>, "inttostr.h".
Paul Eggert [Wed, 28 Jul 2004 23:06:11 +0000 (23:06 +0000)]
Include <stdbool.h>, "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.

19 years agoTest for "chown 010 file".
Paul Eggert [Wed, 28 Jul 2004 23:05:52 +0000 (23:05 +0000)]
Test for "chown 010 file".

19 years agoTest for proper handling of uids like
Paul Eggert [Wed, 28 Jul 2004 23:05:27 +0000 (23:05 +0000)]
Test for proper handling of uids like
"010", which must be parsed as decimal.

19 years agoRegenerate.
Paul Eggert [Wed, 28 Jul 2004 22:32:26 +0000 (22:32 +0000)]
Regenerate.

19 years agomemchr and memrchr portability fixes.
Paul Eggert [Wed, 28 Jul 2004 22:21:33 +0000 (22:21 +0000)]
memchr and memrchr portability fixes.

19 years agoInclude <stddef.h>, not <stdlib.h> and <sys/types.h>.
Paul Eggert [Wed, 28 Jul 2004 22:21:18 +0000 (22:21 +0000)]
Include <stddef.h>, not <stdlib.h> and <sys/types.h>.
(LONG_MAX_32_BITS): Remove.
Include <inttypes.h> and <stdint.h> if available.
(alignof, UNALIGNEDP): New macro, portable to all C89 hosts.
(__memrchr): 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.

19 years agoInclude <stddef.h>, not <stdlib.h> and <sys/types.h>.
Paul Eggert [Wed, 28 Jul 2004 22:20:56 +0000 (22:20 +0000)]
Include <stddef.h>, not <stdlib.h> and <sys/types.h>.
(LONG_MAX_32_BITS): Remove.
Include <inttypes.h> and <stdint.h> 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.

19 years agomd5, sha1 cleanups; getugroups change.
Paul Eggert [Wed, 28 Jul 2004 20:11:45 +0000 (20:11 +0000)]
md5, sha1 cleanups; getugroups change.

19 years agomd5, sha1 cleanups.
Paul Eggert [Wed, 28 Jul 2004 20:10:55 +0000 (20:10 +0000)]
md5, sha1 cleanups.

19 years ago(gl_SHA): Require AC_C_BIGENDIAN.
Paul Eggert [Wed, 28 Jul 2004 20:10:44 +0000 (20:10 +0000)]
(gl_SHA): Require AC_C_BIGENDIAN.

19 years ago(gl_MD5): Do not require AC_C_INLINE, since it doesn't
Paul Eggert [Wed, 28 Jul 2004 20:10:18 +0000 (20:10 +0000)]
(gl_MD5): Do not require AC_C_INLINE, since it doesn't
use inline any more.  Require AC_C_BIGENDIAN, though.

19 years agoDon't include <sys/types.h> or <stdlib.h>; <stddef.h>
Paul Eggert [Wed, 28 Jul 2004 20:09:39 +0000 (20:09 +0000)]
Don't include <sys/types.h> or <stdlib.h>; <stddef.h>
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.

19 years agoInclude <stdint.h> if HAVE_STDINT_H || _LIBC, not
Paul Eggert [Wed, 28 Jul 2004 20:09:09 +0000 (20:09 +0000)]
Include <stdint.h> if HAVE_STDINT_H || _LIBC, not
ifdef _LIBC.
(md5_uint32): Use uint32_t if available.  Simplify fallback ifdefs.

19 years agoInclude <errno.h>.
Paul Eggert [Wed, 28 Jul 2004 19:41:08 +0000 (19:41 +0000)]
Include <errno.h>.
(EOVERFLOW): Define if not defined.
(getgroups): Return -1 with errno=EOVERFLOW if an integer overflow
occurs.

19 years agoRegenerate.
Paul Eggert [Wed, 28 Jul 2004 19:26:33 +0000 (19:26 +0000)]
Regenerate.

19 years agoDon't assume that Perl's getpwd agrees with ours.
Paul Eggert [Wed, 28 Jul 2004 19:23:28 +0000 (19:23 +0000)]
Don't assume that Perl's getpwd agrees with ours.

19 years agoDon't assume that Perl's getpwd agrees with our
Paul Eggert [Wed, 28 Jul 2004 19:23:07 +0000 (19:23 +0000)]
Don't assume that Perl's getpwd agrees with our
pwd when there are multiple names for the working directory
(which can happen with an automounter, sigh).

19 years agoIn src/Makefile.am, don't have 'groups' or 'localedir.h' depend on Makefile.
Paul Eggert [Wed, 28 Jul 2004 18:54:05 +0000 (18:54 +0000)]
In src/Makefile.am, don't have 'groups' or 'localedir.h' depend on Makefile.

19 years agothis causes Solaris 8 'make' to refuse to build "groups".
Paul Eggert [Wed, 28 Jul 2004 18:53:22 +0000 (18:53 +0000)]
this causes Solaris 8 'make' to refuse to build "groups".
(localedir.h): Don't depend on Makefile: this causes Solaris
8 'make' to build localedir.h unnecessarily.  The dependence
on Makefile is ineffective anyway, since $(localedir) might
change even if Makefile hasn't.

19 years ago* src/remove.c (remove_dir): If we can't save the state of the
Paul Eggert [Wed, 28 Jul 2004 14:50:25 +0000 (14:50 +0000)]
* src/remove.c (remove_dir): If we can't save the state of the
working directory, pretend we started from "/", not ".".

19 years ago(remove_dir): If we can't save the state of the
Paul Eggert [Wed, 28 Jul 2004 14:50:06 +0000 (14:50 +0000)]
(remove_dir): If we can't save the state of the
working directory, pretend we started from "/", not ".".
This avoids a bug on hosts like Solaris that don't let you
remove the working directory.

19 years agoIn src/printf.c, declare strtoimax and strtoumax if not already declared.
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.

19 years ago(strtiomax, strtoumax): Declare if not already
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.

19 years agoCheck for declaration of strtoumax, for src/printf.c.
Paul Eggert [Wed, 28 Jul 2004 06:58:09 +0000 (06:58 +0000)]
Check for declaration of strtoumax, for src/printf.c.

19 years agoRegenerate.
Paul Eggert [Wed, 28 Jul 2004 05:26:31 +0000 (05:26 +0000)]
Regenerate.

19 years agoGet eaccess from libgen if available; that's where it is on Solaris 9.
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.

19 years ago(cp_LDADD, ginstall_LDADD, mv_LDADD,
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.

19 years ago(gl_PREREQ_EUIDACCESS): Don't bother checking for
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.

19 years agoeuidaccess.c [HAVE_LIBGEN_H]: Include <libgen.h>, for
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.

19 years agocycle-check integer overflow fixup.
Paul Eggert [Wed, 28 Jul 2004 00:31:58 +0000 (00:31 +0000)]
cycle-check integer overflow fixup.

19 years agoRemove now-inaccurate comment about the files
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.

19 years ago(is_zero_or_power_of_two): Renamed from
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.

19 years agoDon't assume that we can remove the working directory in tests.
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.

19 years agoRegenerate.
Paul Eggert [Tue, 27 Jul 2004 23:20:48 +0000 (23:20 +0000)]
Regenerate.

19 years agoMerged into backupfile.c.
Paul Eggert [Tue, 27 Jul 2004 23:20:03 +0000 (23:20 +0000)]
Merged into backupfile.c.

19 years agobackupfile integer overflow fixups
Paul Eggert [Tue, 27 Jul 2004 23:15:05 +0000 (23:15 +0000)]
backupfile integer overflow fixups

19 years agobackupfile integer overflow fixups
Paul Eggert [Tue, 27 Jul 2004 23:14:53 +0000 (23:14 +0000)]
backupfile integer overflow fixups

19 years ago(do_link): find_backup_file_name no longer returns NULL, so don't
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.

19 years ago(do_copy): find_backup_file_name no longer returns NULL, so don't
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.

19 years ago(copy_internal): find_backup_file_name no longer
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.

19 years ago(gl_BACKUPFILE): AC_REQUIRE
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.

19 years agobackupfile.c rewrite to avoid arbitrary limits on lengths of
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.

19 years agobackupfile.h (addext): Remove decl.
Paul Eggert [Tue, 27 Jul 2004 23:12:17 +0000 (23:12 +0000)]
backupfile.h (addext): Remove decl.

19 years ago(libfetish_a_SOURCES): Remove addext.c.
Paul Eggert [Tue, 27 Jul 2004 23:11:55 +0000 (23:11 +0000)]
(libfetish_a_SOURCES): Remove addext.c.

19 years agoRegenerate.
Paul Eggert [Mon, 26 Jul 2004 06:14:11 +0000 (06:14 +0000)]
Regenerate.

19 years ago(GET_NICE_VALUE): Renamed from GET_PRIORITY.
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.

19 years ago(nice invocation): Document the "nice value", and
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.

19 years agoDocument portability and POSIX fixes for "nice".
Paul Eggert [Mon, 26 Jul 2004 06:07:40 +0000 (06:07 +0000)]
Document portability and POSIX fixes for "nice".

19 years agoPortability and POSIX fixes for "nice".
Paul Eggert [Mon, 26 Jul 2004 06:07:04 +0000 (06:07 +0000)]
Portability and POSIX fixes for "nice".

19 years agoPortability and POSIX fixes for "nice".
Paul Eggert [Mon, 26 Jul 2004 06:06:30 +0000 (06:06 +0000)]
Portability and POSIX fixes for "nice".

19 years agoRemove setreuid/setregid test from gl_MACROS.
Paul Eggert [Sun, 25 Jul 2004 23:01:23 +0000 (23:01 +0000)]
Remove setreuid/setregid test from gl_MACROS.

19 years agoUpdate serial number.
Paul Eggert [Sun, 25 Jul 2004 23:00:47 +0000 (23:00 +0000)]
Update serial number.

19 years ago(gl_MACROS): Remove test for setreuid and setregid,
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.

19 years agoRegenerate.
Paul Eggert [Sun, 25 Jul 2004 07:48:17 +0000 (07:48 +0000)]
Regenerate.

19 years agoeuidaccess fixes
Paul Eggert [Sun, 25 Jul 2004 07:40:32 +0000 (07:40 +0000)]
euidaccess fixes

19 years ago(R_OK, W_OK, X_OK, FOK): Remove; system.h defines them.
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.

19 years agopathchk.c: Include euidaccess.h.
Paul Eggert [Sun, 25 Jul 2004 07:38:39 +0000 (07:38 +0000)]
pathchk.c: Include euidaccess.h.
(dir_ok): Use euidaccess, not access.

19 years ago(gl_PREREQ): Invoke gl_FUNC_NONREENTRANT_EUIDACCESS,
Paul Eggert [Sun, 25 Jul 2004 07:38:19 +0000 (07:38 +0000)]
(gl_PREREQ): Invoke gl_FUNC_NONREENTRANT_EUIDACCESS,
not gl_FUNC_EUIDACCESS.

19 years ago(gl_FUNC_NONREENTRANT_EUIDACCESS): New macro.
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.

19 years ago[!defined LIBC]: Included group-member.h, stat-macros.h.
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".

20 years agoMove some changelog entries here from ../ChangeLog.
Paul Eggert [Sat, 24 Jul 2004 08:03:55 +0000 (08:03 +0000)]
Move some changelog entries here from ../ChangeLog.

20 years agoFix non-null-terminated-string bugs in who and uptime.
Paul Eggert [Sat, 24 Jul 2004 08:03:40 +0000 (08:03 +0000)]
Fix non-null-terminated-string bugs in who and uptime.

20 years ago(print_uptime) [defined BOOT_MSG]:
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.

20 years ago(print_line): New arguments USERLEN and LINELEN, since USER and LINE
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.

20 years agoRegenerate.
Paul Eggert [Fri, 23 Jul 2004 22:41:52 +0000 (22:41 +0000)]
Regenerate.

20 years agoFix bug with tail -f and pipes, plus a few other problems with tail.
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.

20 years agoAdd fcntl-safer.
Paul Eggert [Fri, 23 Jul 2004 22:35:47 +0000 (22:35 +0000)]
Add fcntl-safer.

20 years ago(gl_PREREQ): Add gl_FCNTL_SAFER.
Paul Eggert [Fri, 23 Jul 2004 22:35:07 +0000 (22:35 +0000)]
(gl_PREREQ): Add gl_FCNTL_SAFER.

20 years agoInclude fcntl-safer.h.
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.

20 years ago(libfetish_a_SOURCES): Add fcntl-safer.h, open-safer.c.
Paul Eggert [Fri, 23 Jul 2004 22:33:23 +0000 (22:33 +0000)]
(libfetish_a_SOURCES): Add fcntl-safer.h, open-safer.c.

20 years agoNew file.
Paul Eggert [Fri, 23 Jul 2004 22:31:32 +0000 (22:31 +0000)]
New file.

20 years ago(tail invocation): "size has remained the same"
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.

20 years agotail: Fix bug with -f and pipes; remove --max-consecutive-size-changes.
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.

20 years agoRegenerate.
Paul Eggert [Thu, 22 Jul 2004 20:58:52 +0000 (20:58 +0000)]
Regenerate.

20 years agoAdd fix for "tail -f" when stdin is a pipe.
Paul Eggert [Thu, 22 Jul 2004 20:55:12 +0000 (20:55 +0000)]
Add fix for "tail -f" when stdin is a pipe.

20 years agoReinstate f-1 test, since we now pass.
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.

20 years ago(tail invocation): Do not ignore -f for
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.

20 years ago(main): Ignore -f if 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.

20 years agoPrefer c_strtod to setlocale when scanning floating point.
Paul Eggert [Tue, 13 Jul 2004 00:07:26 +0000 (00:07 +0000)]
Prefer c_strtod to setlocale when scanning floating point.

20 years agoInclude <errno.h>, <stdio.h>, <stdlib.h> even
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.

20 years agoInclude c-strtod.h.
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.

20 years ago(gl_C_STRTOD): Add gl_USE_SYSTEM_EXTENSIONS.
Paul Eggert [Mon, 12 Jul 2004 17:50:28 +0000 (17:50 +0000)]
(gl_C_STRTOD): Add gl_USE_SYSTEM_EXTENSIONS.

20 years ago(STRTOD_L): New macro.
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.

20 years agoRegenerate.
Paul Eggert [Mon, 12 Jul 2004 06:43:20 +0000 (06:43 +0000)]
Regenerate.

20 years agoRegenerate.
Paul Eggert [Mon, 12 Jul 2004 06:42:43 +0000 (06:42 +0000)]
Regenerate.

20 years agoprintf now uses long double.
Paul Eggert [Mon, 12 Jul 2004 06:40:24 +0000 (06:40 +0000)]
printf now uses long double.

20 years agoNew file.
Paul Eggert [Mon, 12 Jul 2004 06:39:23 +0000 (06:39 +0000)]
New file.

20 years ago(vstrtold): Renamed from vstrtod.
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.