platform/upstream/coreutils.git
19 years ago(isdir): Remove decl.
Paul Eggert [Mon, 2 Aug 2004 20:14:39 +0000 (20:14 +0000)]
(isdir): Remove decl.
(install_file_to_path): Rely on make_path to fail if the destination
is not a directory, by passing preserve_existing==true to it.
Hence we no longer need to call isdir.
Free dest_dir immediately when it's no longer needed, rather than
waiting until the end of the function.
(copy_file): Don't bother calling isdir, as copy will do the
right thing if the destination is a directory.

19 years ago(fts_debug, opt_all, apparent_size, opt_count_all,
Paul Eggert [Mon, 2 Aug 2004 19:43:38 +0000 (19:43 +0000)]
(fts_debug, opt_all, apparent_size, opt_count_all,
print_grand_total, opt_separate_dirs, hash_ins, process_file, main):
Use bool for booleans.
(max_depth): Now size_t, not int, to avoid an arbitrary limit
of INT_MAX on depth.
(G_fail): Remove: no longer needed, now that the relevant
functions return bool.
(process_file): Use return value to signal success rather than
setting a global.  Remove first_call static var; not needed, since
we can look at n_alloc.  Use size_t for depths.  Remove FIXME
about size_t casts, as it's now fixed.  Use xnrealloc rather
than the obsolescent XREALLOC.  Don't bother to check whether
reallocation is needed unless level > prev_level.
(du_files): Invert sense of result, for consistency with
other coreutils code.  All callers changed.
(main): Allow --max-depth values up to SIZE_MAX.

19 years agoAdd an FSF copyright notice, since our changes are becoming nontrivial.
Paul Eggert [Mon, 2 Aug 2004 19:42:01 +0000 (19:42 +0000)]
Add an FSF copyright notice, since our changes are becoming nontrivial.
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.

19 years agoAdd an FSF copyright notice, since our changes are becoming nontrivial.
Paul Eggert [Mon, 2 Aug 2004 19:41:35 +0000 (19:41 +0000)]
Add an FSF copyright notice, since our changes are becoming nontrivial.
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.

19 years agoUse Autoconf-suggested pattern for inttypes and stdint.
Paul Eggert [Mon, 2 Aug 2004 18:44:11 +0000 (18:44 +0000)]
Use Autoconf-suggested pattern for inttypes and stdint.
Include unistd.h, for lseek.

19 years agoInclude <stdbool.h>.
Paul Eggert [Mon, 2 Aug 2004 18:43:56 +0000 (18:43 +0000)]
Include <stdbool.h>.
(struct fs_usage): Use uintmax_t for block sizes, so that they're
not limited to INT_MAX.
Use bool for booleans.

19 years ago(inode_format, show_all_fs, show_local_fs,
Paul Eggert [Mon, 2 Aug 2004 18:43:35 +0000 (18:43 +0000)]
(inode_format, show_all_fs, show_local_fs,
show_listed_fs, posix_format, require_sync, print_type,
selected_fstype, excluded_fstype, show_dev, show_point, main):
Use bool for booleans.
(df_readable, show_dev): Use UINTMAX_MAX instead of -1.
(show_dev, show_point, main):
Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
Don't assume disk name lengths are <= INT_MAX.
Rewrite pct calculation to avoid cast.
(show_point): Don't assume resolved length is <= SSIZE_MAX.

19 years ago(EXT): Use size_t for sizes, not ptrdiff_t, so that we don't have
Paul Eggert [Mon, 2 Aug 2004 18:21:05 +0000 (18:21 +0000)]
(EXT): Use size_t for sizes, not ptrdiff_t, so that we don't have
to worry about wraparound.

19 years agofnmatch_loop.c (EXT, FCT): Use bool when appropriate.
Paul Eggert [Mon, 2 Aug 2004 18:10:55 +0000 (18:10 +0000)]
fnmatch_loop.c (EXT, FCT): Use bool when appropriate.
(FCT): Use size_t, not unsigned int, for sizes.
(EXT): Use ptrdiff_t, not int, for a variable that has to
store a size-related quantity but might go negative.
ptrdiff_t is good enough here, since in practice the value
can't exceed SIZE_MAX/2.

19 years agoInclude <stdbool.h>.
Paul Eggert [Mon, 2 Aug 2004 18:10:35 +0000 (18:10 +0000)]
Include <stdbool.h>.
(errno): Remove decl; we now assume C89 or better.

19 years ago(strip_trailing_slashes): Now returns bool.
Paul Eggert [Mon, 2 Aug 2004 17:33:57 +0000 (17:33 +0000)]
(strip_trailing_slashes): Now returns bool.

19 years ago(dir_name): Use bool when appropriate.
Paul Eggert [Mon, 2 Aug 2004 17:33:37 +0000 (17:33 +0000)]
(dir_name): Use bool when appropriate.

19 years agoInclude <stdbool.h>.
Paul Eggert [Mon, 2 Aug 2004 17:33:24 +0000 (17:33 +0000)]
Include <stdbool.h>.
(strip_trailing_slashes): Now returns bool.

19 years ago(argmatch, __xargmatch_internal, argmatch_invalid):
Paul Eggert [Mon, 2 Aug 2004 17:24:00 +0000 (17:24 +0000)]
(argmatch, __xargmatch_internal, argmatch_invalid):
Use ptrdiff_t, not int, when counting arguments, to allow more
than INT_MAX arguments.
Use bool when appropriate.

19 years ago(argmatch, __xargmatch_internal, argmatch_invalid):
Paul Eggert [Mon, 2 Aug 2004 17:23:19 +0000 (17:23 +0000)]
(argmatch, __xargmatch_internal, argmatch_invalid):
Use ptrdiff_t, not int, when counting arguments, to allow more
than INT_MAX arguments.

19 years agoInstall safe-read fix for blocksizes greater than 2**31.
Paul Eggert [Mon, 2 Aug 2004 05:56:14 +0000 (05:56 +0000)]
Install safe-read fix for blocksizes greater than 2**31.

19 years ago(errno): Remove decl; we now assume C89 or better.
Paul Eggert [Mon, 2 Aug 2004 05:55:54 +0000 (05:55 +0000)]
(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.

19 years agoRegenerate.
Paul Eggert [Mon, 2 Aug 2004 05:30:48 +0000 (05:30 +0000)]
Regenerate.

19 years agoRegenerate.
Paul Eggert [Mon, 2 Aug 2004 05:29:29 +0000 (05:29 +0000)]
Regenerate.

19 years agoInitial revision
Paul Eggert [Mon, 2 Aug 2004 05:28:02 +0000 (05:28 +0000)]
Initial revision

19 years agouintptr_t and uint32_t port to Solaris 8.
Paul Eggert [Mon, 2 Aug 2004 05:26:59 +0000 (05:26 +0000)]
uintptr_t and uint32_t port to Solaris 8.

19 years ago(ptr_align): Use size_t; in practice, this is just as
Paul Eggert [Mon, 2 Aug 2004 05:26:19 +0000 (05:26 +0000)]
(ptr_align): Use size_t; in practice, this is just as
good as uintptr_t in checking for alignments, and has fewer
configuration hassles.

19 years ago(UINT_MAX_32_BITS): Remove.
Paul Eggert [Mon, 2 Aug 2004 05:26:01 +0000 (05:26 +0000)]
(UINT_MAX_32_BITS): Remove.
(word32): Remove.  All uses changed to uint32_t.
(isaac_seed_data): Remove unnecessary cast.

19 years ago(hash_int) [!defined UINTPTR_MAX]: Use size_t instead of uintptr_t.
Paul Eggert [Mon, 2 Aug 2004 05:25:33 +0000 (05:25 +0000)]
(hash_int) [!defined UINTPTR_MAX]: Use size_t instead of uintptr_t.

19 years agoInitial revision.
Paul Eggert [Mon, 2 Aug 2004 05:24:47 +0000 (05:24 +0000)]
Initial revision.

19 years ago(gl_MD5): Require gl_AC_TYPE_UINT32_T.
Paul Eggert [Mon, 2 Aug 2004 05:23:39 +0000 (05:23 +0000)]
(gl_MD5): Require gl_AC_TYPE_UINT32_T.

19 years ago(gl_CHECK_ALL_TYPES):
Paul Eggert [Mon, 2 Aug 2004 05:22:57 +0000 (05:22 +0000)]
(gl_CHECK_ALL_TYPES):
Require gl_AC_TYPE_UINTPTR_T instead of using AC_CHECK_TYPE
on uintptr_t.  Require gl_AC_TYPE_UINT32_T.

19 years ago(UNALIGNED_P): Use size_t; in practice, this is just as
Paul Eggert [Mon, 2 Aug 2004 05:22:22 +0000 (05:22 +0000)]
(UNALIGNED_P): Use size_t; in practice, this is just as
good as uintptr_t in checking for alignments, and has fewer
configuration hassles.

19 years agoDon't include inttypes.h or stdint.h.
Paul Eggert [Mon, 2 Aug 2004 05:21:47 +0000 (05:21 +0000)]
Don't include inttypes.h or stdint.h.
(UNALIGNED_P): Remove.
(__memrchr): Use size_t, not uintptr_t, to test alignment.

19 years agoDon't include inttypes.h or stdint.h.
Paul Eggert [Mon, 2 Aug 2004 05:21:12 +0000 (05:21 +0000)]
Don't include inttypes.h or stdint.h.
(UNALIGNED_P): Remove.
(__memchr): Use size_t, not uintptr_t, to test alignment.

19 years agoDon't include <limits.h>. Include <inttypes.h> if available,
Paul Eggert [Mon, 2 Aug 2004 05:20:05 +0000 (05:20 +0000)]
Don't include <limits.h>.  Include <inttypes.h> 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).

19 years ago(UNALIGNED_P): Use size_t; in practice, this is just as
Paul Eggert [Mon, 2 Aug 2004 05:19:30 +0000 (05:19 +0000)]
(UNALIGNED_P): Use size_t; in practice, this is just as
good as uintptr_t in checking for alignments, and has fewer
configuration hassles.

19 years agoFix typo: down -> done.
Paul Eggert [Sun, 1 Aug 2004 15:21:56 +0000 (15:21 +0000)]
Fix typo: down -> done.

19 years ago* src/Makefile.am (localedir.h): Make it readonly.
Paul Eggert [Sun, 1 Aug 2004 15:19:02 +0000 (15:19 +0000)]
* src/Makefile.am (localedir.h): Make it readonly.

19 years ago(localedir.h): Make it readonly; this
Paul Eggert [Sun, 1 Aug 2004 15:18:29 +0000 (15:18 +0000)]
(localedir.h): Make it readonly; this
undoes part of the 2004-07-27 patch.

19 years agoImprove comment for first_same_file.
Paul Eggert [Fri, 30 Jul 2004 23:24:03 +0000 (23:24 +0000)]
Improve comment for first_same_file.

19 years agosort, system.h, tr int cleanup
Paul Eggert [Fri, 30 Jul 2004 21:09:04 +0000 (21:09 +0000)]
sort, system.h, tr int cleanup

19 years ago(to_uchar): Remove; now in system.h.
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.

19 years ago(errno, CHAR_BIT): Remove decls;
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".

19 years ago(UCHAR): Remove; all uses changed to to_uchar.
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.

19 years agomakepath int cleanup
Paul Eggert [Fri, 30 Jul 2004 20:30:39 +0000 (20:30 +0000)]
makepath int cleanup

19 years agomkdir.c int cleanup.
Paul Eggert [Fri, 30 Jul 2004 20:30:18 +0000 (20:30 +0000)]
mkdir.c int cleanup.

19 years ago(create_parents, main): Use bool when appropriate.
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.

19 years ago(make_path, make_dir): Use bool, not int, since we're not setting errno.
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.

19 years agoInclude <stdbool.h>.
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.

20 years agomodechange.c now uses bool.
Paul Eggert [Fri, 30 Jul 2004 08:02:27 +0000 (08:02 +0000)]
modechange.c now uses bool.

20 years agoint cleanups for chmod, rm, cp, install, mkfifo.
Paul Eggert [Fri, 30 Jul 2004 08:01:38 +0000 (08:01 +0000)]
int cleanups for chmod, rm, cp, install, mkfifo.

20 years ago(main): Use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1.
Paul Eggert [Fri, 30 Jul 2004 08:00:40 +0000 (08:00 +0000)]
(main): Use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1.

20 years ago(right_justify), full_filename_, AD_pop_and_chdir,
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.

20 years ago(rm_option_init, main): Use bool when appropriate.
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.

20 years ago(remove_trailing_slashes, rm_option_init,
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.

20 years ago(isdir, change_timestamps, change_attributes,
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.

20 years ago(struct dir_attr, flag_path, remove_trailing_slashes,
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.

20 years ago(remember_created): Use bool when appropriate.
Paul Eggert [Fri, 30 Jul 2004 07:55:59 +0000 (07:55 +0000)]
(remember_created): Use bool when appropriate.

20 years ago(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.

20 years ago(copy_internal, is_ancestor, copy_dir, copy_reg,
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.

20 years ago(struct cp_options): Use bool when appropriate.
Paul Eggert [Fri, 30 Jul 2004 07:49:39 +0000 (07:49 +0000)]
(struct cp_options): Use bool when appropriate.

20 years ago(hard_LC_COLLATE, only_file_1, only_file_2, both, compare_files, main):
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.

20 years ago(cksum, main): Use bool when appropriate.
Paul Eggert [Fri, 30 Jul 2004 04:12:25 +0000 (04:12 +0000)]
(cksum, main): Use bool when appropriate.

20 years ago(recurse, force_silent, process_file, process_files, main): Use bool
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.

20 years agoUpdate copyright.
Paul Eggert [Fri, 30 Jul 2004 04:06:16 +0000 (04:06 +0000)]
Update copyright.

20 years agoInclude <stdbool.h>.
Paul Eggert [Fri, 30 Jul 2004 04:05:50 +0000 (04:05 +0000)]
Include <stdbool.h>.
(mode_compile): Use bool when appropriate.

20 years agomd5sum, sha1sum integer cleanups.
Paul Eggert [Fri, 30 Jul 2004 00:55:09 +0000 (00:55 +0000)]
md5sum, sha1sum integer cleanups.

20 years ago(OPENOPTS, have_read_stdin, status_only, warn,
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.

20 years agoDon't include any files other than checksum.h.
Paul Eggert [Fri, 30 Jul 2004 00:54:02 +0000 (00:54 +0000)]
Don't include any files other than checksum.h.

20 years agoDon't include config.h, sys/types.h, stdio.h: not needed.
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.

20 years agomd5sum and sha1sum overflow detection.
Paul Eggert [Fri, 30 Jul 2004 00:53:23 +0000 (00:53 +0000)]
md5sum and sha1sum overflow detection.

20 years agoFix copyright year.
Paul Eggert [Fri, 30 Jul 2004 00:40:40 +0000 (00:40 +0000)]
Fix copyright year.

20 years agoUse sizeof, not alignof, in memchr and memrchr.
Paul Eggert [Thu, 29 Jul 2004 17:34:38 +0000 (17:34 +0000)]
Use sizeof, not alignof, in memchr and memrchr.

20 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.

20 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.

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

20 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.

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

20 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.

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

20 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.

20 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.

20 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.

20 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.

20 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".

20 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.

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

20 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.

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

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

20 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.

20 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.

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

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

20 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.

20 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.

20 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.

20 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.

20 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.

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

20 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.

20 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).

20 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.

20 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.