Paul Eggert [Fri, 30 Jul 2004 23:24:03 +0000 (23:24 +0000)]
Improve comment for first_same_file.
Paul Eggert [Fri, 30 Jul 2004 21:09:04 +0000 (21:09 +0000)]
sort, system.h, tr int cleanup
Paul Eggert [Fri, 30 Jul 2004 21:08:48 +0000 (21:08 +0000)]
(to_uchar): Remove; now in system.h.
(is_char_class_member): Use bool when appropriate.
Paul Eggert [Fri, 30 Jul 2004 21:08:25 +0000 (21:08 +0000)]
(errno, CHAR_BIT): Remove decls;
no longer needed now we assume C89 or better.
Include <inttypes.h> before <stdint.h>, as it's the Autoconf-recommended pattern.
(to_uchar): New inline function, moved here from tr.c.
Use full names for int types, e.g. "long int" rather than "long".
Paul Eggert [Fri, 30 Jul 2004 21:08:02 +0000 (21:08 +0000)]
(UCHAR): Remove; all uses changed to to_uchar.
(IS_THOUSANDS_SEP): Use bool when appropriate.
(numcompare, main): Use char, not int, when the value is always a char.
(numcompare): Remove "register"; compilers are smart enough these days.
Paul Eggert [Fri, 30 Jul 2004 20:30:39 +0000 (20:30 +0000)]
makepath int cleanup
Paul Eggert [Fri, 30 Jul 2004 20:30:18 +0000 (20:30 +0000)]
mkdir.c int cleanup.
Paul Eggert [Fri, 30 Jul 2004 20:29:29 +0000 (20:29 +0000)]
(create_parents, main): Use bool when appropriate.
(main): Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
Paul Eggert [Fri, 30 Jul 2004 20:29:01 +0000 (20:29 +0000)]
(make_path, make_dir): Use bool, not int, since we're not setting errno.
Use mode_t for modes, not int. All uses changed.
(errno): Remove decl; no longer needed since we assume C89.
Paul Eggert [Fri, 30 Jul 2004 20:28:13 +0000 (20:28 +0000)]
Include <stdbool.h>.
(make_path, make_dir): Use bool, not int, since we're not setting errno.
Use mode_t for modes, not int. All uses changed.
Paul Eggert [Fri, 30 Jul 2004 08:02:27 +0000 (08:02 +0000)]
modechange.c now uses bool.
Paul Eggert [Fri, 30 Jul 2004 08:01:38 +0000 (08:01 +0000)]
int cleanups for chmod, rm, cp, install, mkfifo.
Paul Eggert [Fri, 30 Jul 2004 08:00:40 +0000 (08:00 +0000)]
(main): Use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1.
Paul Eggert [Fri, 30 Jul 2004 08:00:02 +0000 (08:00 +0000)]
(right_justify), full_filename_, AD_pop_and_chdir,
AD_push, prompt, remove_dir): Use bool when appropriate.
(top_dir, pop_dir, full_filename_):
Use size_t for sizes.
Paul Eggert [Fri, 30 Jul 2004 07:59:19 +0000 (07:59 +0000)]
(rm_option_init, main): Use bool when appropriate.
(main): Use EXIT_SUCCESS, EXIT_FAILURE instead of 0, 1.
Paul Eggert [Fri, 30 Jul 2004 07:58:07 +0000 (07:58 +0000)]
(remove_trailing_slashes, rm_option_init,
cp_option_init, do_move, movefile, main): Likewise.
* src/remove.c (right_justify), full_filename_, AD_pop_and_chdir,
AD_push, prompt, remove_dir): Likewise.
Paul Eggert [Fri, 30 Jul 2004 07:57:50 +0000 (07:57 +0000)]
(isdir, change_timestamps, change_attributes,
copy_file, install_file_to_path, install_file_in_dir,
install_file_in_file, strip_files, dir_arg, cp_option_init, main,
change_attributes, change_timestamps): Likewise.
Paul Eggert [Fri, 30 Jul 2004 07:57:27 +0000 (07:57 +0000)]
(struct dir_attr, flag_path, remove_trailing_slashes,
re_protect, make_path_private, target_directory_operand, do_copy,
cp_option_init, decode_preserve_arg, main): Use bool when appropriate.
(target_directory_operand): Do not clear *NEW_DST if stat
succeeds. It's not necessary in that case, as *NEW_DST is always
false already.
(do_copy): Rewrite slightly to avoid need for "unreachable" comment.
(main): Use EXIT_SUCCESS, EXIT_FAILURE instead of 0, 1.
Paul Eggert [Fri, 30 Jul 2004 07:55:59 +0000 (07:55 +0000)]
(remember_created): Use bool when appropriate.
Paul Eggert [Fri, 30 Jul 2004 07:55:33 +0000 (07:55 +0000)]
(remember_created): Use bool when appropriate.
Paul Eggert [Fri, 30 Jul 2004 07:51:59 +0000 (07:51 +0000)]
(copy_internal, is_ancestor, copy_dir, copy_reg,
same_file_ok, seen_file, copy_internal, valid_options, copy):
Use bool when appropriate.
Paul Eggert [Fri, 30 Jul 2004 07:49:39 +0000 (07:49 +0000)]
(struct cp_options): Use bool when appropriate.
Paul Eggert [Fri, 30 Jul 2004 05:25:17 +0000 (05:25 +0000)]
(hard_LC_COLLATE, only_file_1, only_file_2, both, compare_files, main):
Use bool when appropriate.
Paul Eggert [Fri, 30 Jul 2004 04:12:25 +0000 (04:12 +0000)]
(cksum, main): Use bool when appropriate.
Paul Eggert [Fri, 30 Jul 2004 04:06:41 +0000 (04:06 +0000)]
(recurse, force_silent, process_file, process_files, main): Use bool
when appropriate.
Paul Eggert [Fri, 30 Jul 2004 04:06:16 +0000 (04:06 +0000)]
Update copyright.
Paul Eggert [Fri, 30 Jul 2004 04:05:50 +0000 (04:05 +0000)]
Include <stdbool.h>.
(mode_compile): Use bool when appropriate.
Paul Eggert [Fri, 30 Jul 2004 00:55:09 +0000 (00:55 +0000)]
md5sum, sha1sum integer cleanups.
Paul Eggert [Fri, 30 Jul 2004 00:54:44 +0000 (00:54 +0000)]
(OPENOPTS, have_read_stdin, status_only, warn,
bsd_split_3, split_3, hex_digits, digest_file, digest_check, main):
Use bool when appropriate.
(digest_check): Increase limit of number of input lines to
UINTMAX_MAX from INT_MAX. Diagnose any overflows of this counter.
Use ngettext instead of hard-to-i18nize hardcoded stuff for plurals.
Paul Eggert [Fri, 30 Jul 2004 00:54:02 +0000 (00:54 +0000)]
Don't include any files other than checksum.h.
Paul Eggert [Fri, 30 Jul 2004 00:53:49 +0000 (00:53 +0000)]
Don't include config.h, sys/types.h, stdio.h: not needed.
(ALG_UNSPECIFIED): Remove.
(ALG_MDT): Don't make it equal to CHAR_MAX + 1; this isn't necessary.
Paul Eggert [Fri, 30 Jul 2004 00:53:23 +0000 (00:53 +0000)]
md5sum and sha1sum overflow detection.
Paul Eggert [Fri, 30 Jul 2004 00:40:40 +0000 (00:40 +0000)]
Fix copyright year.
Paul Eggert [Thu, 29 Jul 2004 17:34:38 +0000 (17:34 +0000)]
Use sizeof, not alignof, in memchr and memrchr.
Paul Eggert [Thu, 29 Jul 2004 17:34:20 +0000 (17:34 +0000)]
(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.
Paul Eggert [Thu, 29 Jul 2004 06:12:44 +0000 (06:12 +0000)]
'int' cleanup for "cat".
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.
Paul Eggert [Wed, 28 Jul 2004 23:59:37 +0000 (23:59 +0000)]
dcgen cleanup.
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.
Paul Eggert [Wed, 28 Jul 2004 23:39:12 +0000 (23:39 +0000)]
chown/chgrp cleanup.
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.
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.
Paul Eggert [Wed, 28 Jul 2004 23:37:21 +0000 (23:37 +0000)]
(main): int -> bool when appropriate.
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.
Paul Eggert [Wed, 28 Jul 2004 23:06:25 +0000 (23:06 +0000)]
userspec.c cleanup, e.g. for "chown 010 file".
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.
Paul Eggert [Wed, 28 Jul 2004 23:05:52 +0000 (23:05 +0000)]
Test for "chown 010 file".
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.
Paul Eggert [Wed, 28 Jul 2004 22:32:26 +0000 (22:32 +0000)]
Regenerate.
Paul Eggert [Wed, 28 Jul 2004 22:21:33 +0000 (22:21 +0000)]
memchr and memrchr portability fixes.
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.
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.
Paul Eggert [Wed, 28 Jul 2004 20:11:45 +0000 (20:11 +0000)]
md5, sha1 cleanups; getugroups change.
Paul Eggert [Wed, 28 Jul 2004 20:10:55 +0000 (20:10 +0000)]
md5, sha1 cleanups.
Paul Eggert [Wed, 28 Jul 2004 20:10:44 +0000 (20:10 +0000)]
(gl_SHA): Require AC_C_BIGENDIAN.
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.
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.
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.
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.
Paul Eggert [Wed, 28 Jul 2004 19:26:33 +0000 (19:26 +0000)]
Regenerate.
Paul Eggert [Wed, 28 Jul 2004 19:23:28 +0000 (19:23 +0000)]
Don't assume that Perl's getpwd agrees with ours.
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).
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.
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.
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 ".".
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.
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.