platform/upstream/coreutils.git
19 years ago(change_timestamps): Fix int->bool conversion
Paul Eggert [Tue, 10 Aug 2004 20:32:19 +0000 (20:32 +0000)]
(change_timestamps): Fix int->bool conversion
bugs introduced on 2004-07-29.

19 years agoRegenerate.
Paul Eggert [Tue, 10 Aug 2004 06:54:15 +0000 (06:54 +0000)]
Regenerate.

19 years agoSync with gnulib.
Paul Eggert [Tue, 10 Aug 2004 05:43:11 +0000 (05:43 +0000)]
Sync with gnulib.

19 years agoreadlink.c cleanup
Paul Eggert [Mon, 9 Aug 2004 23:40:58 +0000 (23:40 +0000)]
readlink.c cleanup

19 years ago(canonicalize_fname): Remove unneeded proxy function.
Paul Eggert [Mon, 9 Aug 2004 23:40:49 +0000 (23:40 +0000)]
(canonicalize_fname): Remove unneeded proxy function.
(can_mode): Make variable local.

19 years agoImprove code to work in some cases when files are writeable but not readable.
Paul Eggert [Mon, 9 Aug 2004 23:35:15 +0000 (23:35 +0000)]
Improve code to work in some cases when files are writeable but not readable.

19 years ago(wipename): Work even if the directory is writeable
Paul Eggert [Mon, 9 Aug 2004 23:34:49 +0000 (23:34 +0000)]
(wipename): Work even if the directory is writeable
and not readable.  Prefer write access, since this should work
better with fdatasync.

19 years ago(diropen): New function.
Paul Eggert [Mon, 9 Aug 2004 23:34:15 +0000 (23:34 +0000)]
(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.

19 years ago(rpl_chown): Work even if the file is writeable but not readable.
Paul Eggert [Mon, 9 Aug 2004 23:33:53 +0000 (23:33 +0000)]
(rpl_chown): Work even if the file is writeable but not readable.

19 years agoSwitch to UTF-8.
Paul Eggert [Mon, 9 Aug 2004 23:27:55 +0000 (23:27 +0000)]
Switch to UTF-8.

19 years agoChange to UTF-8.
Paul Eggert [Mon, 9 Aug 2004 23:26:57 +0000 (23:26 +0000)]
Change to UTF-8.

19 years agoImport from gnulib.
Paul Eggert [Mon, 9 Aug 2004 23:26:08 +0000 (23:26 +0000)]
Import from gnulib.

19 years agoRegenerate.
Paul Eggert [Mon, 9 Aug 2004 18:51:05 +0000 (18:51 +0000)]
Regenerate.

19 years ago(xalloc_die): New function.
Paul Eggert [Mon, 9 Aug 2004 18:45:10 +0000 (18:45 +0000)]
(xalloc_die): New function.
(main): Remove now-obsolete initialization of xalloc_fail_func.

19 years agoRemove dependency of xalloc on error, etc.
Paul Eggert [Mon, 9 Aug 2004 18:44:46 +0000 (18:44 +0000)]
Remove dependency of xalloc on error, etc.

19 years agoAdjust to sha->sha1 renaming.
Paul Eggert [Mon, 9 Aug 2004 18:18:41 +0000 (18:18 +0000)]
Adjust to sha->sha1 renaming.

19 years agoFinish renaming sha -> sha1.
Paul Eggert [Mon, 9 Aug 2004 18:16:21 +0000 (18:16 +0000)]
Finish renaming sha -> sha1.

19 years ago(O_BINARY) [!O_BINARY && defined O_BINARY]:
Paul Eggert [Sun, 8 Aug 2004 03:04:21 +0000 (03:04 +0000)]
(O_BINARY) [!O_BINARY && defined O_BINARY]:
Do not define, to avoid annoying compiler messages on QNX 6.3.

19 years ago(O_BINARY) [!O_BINARY && defined O_BINARY]:
Paul Eggert [Sun, 8 Aug 2004 03:04:00 +0000 (03:04 +0000)]
(O_BINARY) [!O_BINARY && defined O_BINARY]:
Do not define, to avoid annoying compiler messages on QNX 6.3.

19 years agoMerge from gnulib.
Paul Eggert [Sat, 7 Aug 2004 07:16:54 +0000 (07:16 +0000)]
Merge from gnulib.

19 years agoRegenerate.
Paul Eggert [Thu, 5 Aug 2004 23:11:21 +0000 (23:11 +0000)]
Regenerate.

19 years agoNew file, imported from gnulib.
Paul Eggert [Thu, 5 Aug 2004 23:09:29 +0000 (23:09 +0000)]
New file, imported from gnulib.

19 years agoSync from gnulib.
Paul Eggert [Thu, 5 Aug 2004 23:01:03 +0000 (23:01 +0000)]
Sync from gnulib.

19 years agoFixes for OpenBSD 3.4.
Paul Eggert [Wed, 4 Aug 2004 22:51:23 +0000 (22:51 +0000)]
Fixes for OpenBSD 3.4.

19 years agoFixes for OpenBSD 3.4.
Paul Eggert [Wed, 4 Aug 2004 22:51:03 +0000 (22:51 +0000)]
Fixes for OpenBSD 3.4.

19 years agoFixes for OpenBSD 3.4.
Paul Eggert [Wed, 4 Aug 2004 22:50:41 +0000 (22:50 +0000)]
Fixes for OpenBSD 3.4.

19 years agoFix parenthesization typo.
Paul Eggert [Wed, 4 Aug 2004 22:35:37 +0000 (22:35 +0000)]
Fix parenthesization typo.

19 years agoRemove bogus "*/" from shell comment.
Paul Eggert [Wed, 4 Aug 2004 22:31:15 +0000 (22:31 +0000)]
Remove bogus "*/" from shell comment.

19 years agoRemove bogus "*/" from shell comment.
Paul Eggert [Wed, 4 Aug 2004 22:30:38 +0000 (22:30 +0000)]
Remove bogus "*/" from shell comment.

19 years agoInclude copyright notice.
Paul Eggert [Wed, 4 Aug 2004 22:27:36 +0000 (22:27 +0000)]
Include copyright notice.
(cu_PREREQ_STAT_PROG): Use the _ONCE variants when appropriate.
Include sys/param.h before testing for sys/mount.h.

19 years agoInclude copyright notice.
Paul Eggert [Wed, 4 Aug 2004 22:27:24 +0000 (22:27 +0000)]
Include copyright notice.
(gl_LIST_MOUNTED_FILE_SYSTEMS): Include sys/param.h before
testing for sys/mount.h.

19 years agoInclude copyright notice.
Paul Eggert [Wed, 4 Aug 2004 22:27:12 +0000 (22:27 +0000)]
Include copyright notice.
(gl_MACROS): Use the _ONCE variants when appropriate.
Include sys/param.h before testing for sys/sysctl.h and sys/mount.h;
needed for OpenBSD 3.4.

19 years agoAdd copyright notice.
Paul Eggert [Wed, 4 Aug 2004 22:27:00 +0000 (22:27 +0000)]
Add copyright notice.
(gl_FSUSAGE): Include sys/param.h before checking for sys/mount.h.
Needed for OpenBSD 3.4.

19 years agoAdd copyright notice.
Paul Eggert [Wed, 4 Aug 2004 22:26:42 +0000 (22:26 +0000)]
Add copyright notice.
(GNULIB_BOOT_TIME): Include sys/param.h before testing
for sys/sysctl.h; needed for OpenBSD 3.4.

19 years ago(PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX):
Paul Eggert [Wed, 4 Aug 2004 22:26:23 +0000 (22:26 +0000)]
(PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX):
Define to a concatenation of string literals, not to an expression;
needed for concatenation contexts.
(INTMAX_MAX, INTMAX_MIN): New macros.

19 years ago(SIZE_MAX): Define after including files, to avoid
Paul Eggert [Wed, 4 Aug 2004 22:08:33 +0000 (22:08 +0000)]
(SIZE_MAX): Define after including files, to avoid
a collision on OpenBSD 3.4.

19 years ago(print_stat): Don't assume st_ino / st_dev fits in
Paul Eggert [Wed, 4 Aug 2004 22:04:26 +0000 (22:04 +0000)]
(print_stat): Don't assume st_ino / st_dev fits in
unsigned long; this isn't true for st_ino on Solaris 9.

19 years ago(LONGEST_MODIFIER): New macro.
Paul Eggert [Wed, 4 Aug 2004 21:58:46 +0000 (21:58 +0000)]
(LONGEST_MODIFIER): New macro.
(PRIuMAX) [!PRI_MACROS_BROKEN && !defined PRIuMAX]: New macro.
(find_matching_ancestor): Use it for dev_t and ino_t.

19 years agoSync from gnulib.
Paul Eggert [Wed, 4 Aug 2004 20:58:57 +0000 (20:58 +0000)]
Sync from gnulib.

19 years agoWork around bug in OpenBSD 3.4 sterror_r: it
Paul Eggert [Wed, 4 Aug 2004 19:35:24 +0000 (19:35 +0000)]
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.

19 years agoAdd uname kludge to work around Mac OS X bug.
Paul Eggert [Wed, 4 Aug 2004 05:59:25 +0000 (05:59 +0000)]
Add uname kludge to work around Mac OS X bug.

19 years agoDo not depend on HAVE_SYSCTL when deciding
Paul Eggert [Wed, 4 Aug 2004 05:58:43 +0000 (05:58 +0000)]
Do not depend on HAVE_SYSCTL when deciding
whether to include files.  Include <sys/param.h> if
HAVE_SYS_PARAM_H (not HAVE_SYSCTL).
(main) [defined __POWERPC__]: Add a kludge to work around a
Mac OS X bug, so that uname -p defaults to "powerpc" if
sysctl ((int[]) {CTL_HW, HW_MACHINE_ARCH}, 2, buffer, &bufsize, 0, 0)
fails.  Problem reported by Petter Reinholdtsen in:
http://lists.gnu.org/archive/html/bug-gnu-utils/2003-02/msg00201.html

19 years agoint cleanups for uniq, wc, who, whoami, unexpand, touch, tsort, tty,
Paul Eggert [Tue, 3 Aug 2004 23:40:20 +0000 (23:40 +0000)]
int cleanups for uniq, wc, who, whoami, unexpand, touch, tsort, tty,
test, tac, su, stty, remove.h, tee, ptx, printf, shred, split, stat, pr.

19 years ago(main): Print uids using unsigned long int, not unsigned int.
Paul Eggert [Tue, 3 Aug 2004 23:38:40 +0000 (23:38 +0000)]
(main): Print uids using unsigned long int, not unsigned int.

19 years ago(scan_entries): 0 -> STDIN_FILENO.
Paul Eggert [Tue, 3 Aug 2004 23:38:21 +0000 (23:38 +0000)]
(scan_entries): 0 -> STDIN_FILENO.

19 years ago(iswspace, wc): Use to_uchar rather than a cast.
Paul Eggert [Tue, 3 Aug 2004 23:38:10 +0000 (23:38 +0000)]
(iswspace, wc): Use to_uchar rather than a cast.
(print_lines, print_words, print_chars, print_bytes, print_linelength,
have_read_stdin, wc, wc_file, main):
Use bool for booleans.
(exit_status): Remove.
(wc, wc_file): Return bool status.  All callers changed.

19 years ago(hard_LC_COLLATE, ignore_case, different, check_file,
Paul Eggert [Tue, 3 Aug 2004 23:37:56 +0000 (23:37 +0000)]
(hard_LC_COLLATE, ignore_case, different, check_file,
main): Use bool for booleans.
(writeline, check_file): Use uintmax_t for line counts.
(check_file): Check for and report line number overflow,
when that matters.

19 years agoInt cleanup and minor reorganization to be more like src/expand.c.
Paul Eggert [Tue, 3 Aug 2004 23:27:20 +0000 (23:27 +0000)]
Int cleanup and minor reorganization to be more like src/expand.c.
Include quote.h, xstrndup.h.
(TAB_STOP_SENTINEL): Increase from INT_MAX to INTMAX_MAX.
(convert_entire_line, have_read_stdin, parse_tabstops, next_file,
unexpand, main):
Use bool for booleans.
(tab_size, tab_list, add_tabstop, validate_tabstops, unexpand):
Use uintmax_t for column counts.
(first_free_tab, validate_tabstops, unexpand): Use size_t for sizes.
(add_tabstop, parse_tabstops, main): Don't reserve UINTMAX_MAX
as a tab stop.
(parse_tabstops): Don't use ISBLANK on possibly-signed char.
Detect overflow in tab stop string.
(next_file, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
(unexpand): Concatenate input files the same way expand does.

19 years ago(print_element): Use bool for booleans.
Paul Eggert [Tue, 3 Aug 2004 23:14:17 +0000 (23:14 +0000)]
(print_element): Use bool for booleans.

19 years ago(silent, main): Use bool for booleans.
Paul Eggert [Tue, 3 Aug 2004 23:14:08 +0000 (23:14 +0000)]
(silent, main): Use bool for booleans.
(main): 0 -> STDIN_FILENO.

19 years ago(struct item, n_strings): Use size_t for sizes.
Paul Eggert [Tue, 3 Aug 2004 23:13:20 +0000 (23:13 +0000)]
(struct item, n_strings): Use size_t for sizes.
(have_read_stdin, count_items, scan_zeros, detect_loop,
recurse_tree, walk_tree, tsort, main):
Use bool for booleans.
(exit_status): Remove.
(tsort): Return a success flag instead of storing into a global.
(main): Use it.

19 years ago(no_create, use_ref, posix_date, amtime_now,
Paul Eggert [Tue, 3 Aug 2004 23:13:09 +0000 (23:13 +0000)]
(no_create, use_ref, posix_date, amtime_now,
touch, main): Use bool for booleans.
(main): Avoid integer overflow when given more than INT_MAX
options.

19 years ago(TRUE, FALSE, SHELL_BOOLEAN, TRUTH_OR, TRUTH_AND):
Paul Eggert [Tue, 3 Aug 2004 23:03:04 +0000 (23:03 +0000)]
(TRUE, FALSE, SHELL_BOOLEAN, TRUTH_OR, TRUTH_AND):
Remove.  All uses replaced by C99 boolean primitives.
(TEST_TRUE, TEST_FALSE): New constants, for readability.
(test_unop, binop, unary_operator, binary_operator, two_arguments,
three_arguments, posixtest, expr, term, and, or, is_int, age_of,
one_argument, main): Use bool for booleans.
(advance, unary_advance): Now inline procedures rather than a macros.
(is_int): Renamed from isint, to avoid namespace clash with ctype.h.
(term, and, or): When it's easy, loop instead of recursing.
(term): Avoid integer overflow if there are INT_MAX-3 args (!).
(binary_operator, unary_operator): Simplify by systematically rewriting
true==FOO to FOO (where FOO is a boolean).
(unary_operator): Don't consider a file to be a regular file
merely because its mode&S_IFMT is zero.  Just use S_ISREG.
Remove unnecessary casts.  Remove ifdefs for things like
S_ISSOCK that are no longer needed, since stat-macros.h always
defines them now.

19 years ago(separator_ends_record, tac_seekable, tac_file,
Paul Eggert [Tue, 3 Aug 2004 22:40:28 +0000 (22:40 +0000)]
(separator_ends_record, tac_seekable, tac_file,
tac_stdin, tac_stdin_to_mem, main): Use bool for booleans.
(match_length, G_buffer_size, tac_seekable, main): Use size_t for sizes.
(tac_seekable): Use ptrdiff_t for pointer subtraction.
Report an error if the result is out of range.
(tac_seekable, main): Check for integer overflow in buffer size
calculations.
(main): Remove unnecessary casts.

19 years ago(buf_init_from_stdin, find_bol, tac_mem):
Paul Eggert [Tue, 3 Aug 2004 22:40:15 +0000 (22:40 +0000)]
(buf_init_from_stdin, find_bol, tac_mem):
Use bool for booleans.
(buf_init_from_stdin, buf_free, find_bol, print_line):
Use size_t for sizes.

19 years ago(run_shell): Pass a new n_additional_args arg, so that
Paul Eggert [Tue, 3 Aug 2004 22:23:25 +0000 (22:23 +0000)]
(run_shell): Pass a new n_additional_args arg, so that
the callee doesn't have to count 'em.  All callers changed.
Don't allocate more space for the arg vector than we'll need.
Use memcpy to copy the args rather than rolling our own loop.
Use size_t for sizes.
(fast_startup, simulate_login, change_environment, log_su,
correct_password, restricted_shell, main): Use bool for booleans.
(longopts): Don't assume change_environment is an int.
Use NULL, not 0, for pointers.
(xsetenv): New function, replacing xputenv and concat.
All callers changed.
(elements): Remove; no longer needed.
(log_su, correct_passwd, main): Prefer !x to x==NULL.
(log_su): 2 -> STDERR_FILENO.
(modify_environment, main): Don't assume that getenv's returned value
has an indefinite lifetime.
(modify_environment): Allocate a larger environ.
(main): Remove an impossible 'case 0'; if it happens now, it'll
get diagnosed.  Don't assume getpwnam results outlive endpwent.
Check for null or empty pw_name, pw_dir and for null pw_passwd.

19 years ago(VA_START): Remove. All callers now use va_start.
Paul Eggert [Tue, 3 Aug 2004 20:30:45 +0000 (20:30 +0000)]
(VA_START): Remove.  All callers now use va_start.
(_POSIX_VDISABLE): Remove unnecessary cast.
(struct control_info, visible): Use cc_t for control chars.
(struct control_info): Use size_t for sizes.
(recover_mode, set_mode, display_speed, display_window_size,
valid_options, main, display_changed):
Use bool for booleans.
(integer_arg): Return unsigned long int, not long int.
Accept new max arg; all callers changed, to specify a maximum
value for integer parameters instead of silently overflowing.
(wrap): Do not overrun the stack buffer if the output contains
more than 1024 bytes.  Instead, malloc a buffer.
(main): Remove a "what is this?!?" FIXME.  Nobody knows what it is.
Remove unnecessary casts.
(set_control_char): Allow int values only up to cc_t range.
(screen_columns): Don't reject INT_MAX.
(display_changed, display_all, display_speed, recover_mode):
Don't assume cc_t fits in int.

19 years ago(tee, append, ignore_interrupts, main, tee):
Paul Eggert [Tue, 3 Aug 2004 20:06:29 +0000 (20:06 +0000)]
(tee, append, ignore_interrupts, main, tee):
Use bool for booleans.
(tee): Use ssize_t for read returns.

19 years ago(have_read_stdin, bsd_sum_file, sysv_sum_file,
Paul Eggert [Tue, 3 Aug 2004 20:06:17 +0000 (20:06 +0000)]
(have_read_stdin, bsd_sum_file, sysv_sum_file,
main): Use bool for booleans.
(main): Don't dump core if invoked with argv[0]==NULL.

19 years ago(empty_paths, ignore_fail_on_non_empty, verbose,
Paul Eggert [Tue, 3 Aug 2004 20:05:59 +0000 (20:05 +0000)]
(empty_paths, ignore_fail_on_non_empty, verbose,
errno_rmdir_non_empty, remove_parents, main): Use bool for booleans.

19 years agoAdd copyright notice.
Paul Eggert [Tue, 3 Aug 2004 20:05:42 +0000 (20:05 +0000)]
Add copyright notice.
(struct rm_options): Use bool for booleans.

19 years agoAdd a FIXME mentioning that there are many
Paul Eggert [Tue, 3 Aug 2004 19:15:59 +0000 (19:15 +0000)]
Add a FIXME mentioning that there are many
unchecked integer overflows in this file.
(gnu_extensions, auto_reference, input_reference, right_reference,
ignore_case, initialize_regex, fix_output_parameters,
output_one_roff_line, output_one_text_line, output_one_dumb_line, main):
Use bool for booleans.
(SKIP_SOMETHING, compare_words, digest_break_file,
find_occurs_in_text, fix_output_parameters):
Use to_uchar instead of a caset.
(print_field): Rewrite to avoid cast.

19 years ago(G_fail): Remove.
Paul Eggert [Tue, 3 Aug 2004 19:08:31 +0000 (19:08 +0000)]
(G_fail): Remove.
(print_statfs): Print various gotta-be-nonnegative values using
unsigned long int, not long int or int.
(do_statfs, do_stat): Return a boolean success flag.
(do_stat, main): Use bool for booleans.

19 years ago(cwrite, bytes_split, lines_split, line_bytes_split):
Paul Eggert [Tue, 3 Aug 2004 19:08:01 +0000 (19:08 +0000)]
(cwrite, bytes_split, lines_split, line_bytes_split):
Use bool for booleans.

19 years ago(struct Options, main): Use bool for booleans.
Paul Eggert [Tue, 3 Aug 2004 19:07:51 +0000 (19:07 +0000)]
(struct Options, main): Use bool for booleans.
(isaac_seed_data, fillpattern, wipefile): Rewrite to avoid casts.

19 years ago(canonicalize): Remove. All uses now merely inspect can_mode.
Paul Eggert [Tue, 3 Aug 2004 19:07:36 +0000 (19:07 +0000)]
(canonicalize): Remove.  All uses now merely inspect can_mode.
(no_newline, verbose): Use bool for booleans.
(can_mode): Now of type int; use -1 to denote otherwise-uninitialized.

19 years ago(posixly_correct): Use bool for booleans.
Paul Eggert [Tue, 3 Aug 2004 19:07:11 +0000 (19:07 +0000)]
(posixly_correct): Use bool for booleans.
(verify, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
(STRTOX): Rewrite to avoid casts.
(print_esc_char): Arg is char, not int.

19 years agoAdd a FIXME mentioning that there are many
Paul Eggert [Tue, 3 Aug 2004 18:26:32 +0000 (18:26 +0000)]
Add a FIXME mentioning that there are many
unchecked integer overflows in this file.
(TRUE, FALSE): Remove.  All uses replaced by true and false.
(struct COLUMN, read_line, print_page, print_stored, open_file,
skip_to_page, init_fps, parallel_files, align_empty_cols,
empty_line, FF_only, explicit_columns, extremities, keep_FF,
print_a_FF, print_a_header, use_form_feed, have_read_stdin,
print_across_flag, storing_columns, balance_columns,
truncate_lines, join_lines, untabify_input, failed_opens,
numbered_lines, skip_count, use_esc_sequence, use_cntrl_prefix,
double_space, ignore_failed_opens, use_col_separator,
pad_vertically, last_line, main, init_parameters, skip_read,
read_line, print_stored):
Use bool for booleans.
(struct COLUMN, char_to_clump, store_char, print_char):
Use char for chars.
(clump_buff, print_clump): Use char[], not int[], for an array whose
elements are always chars.
(first_last_page, main, getoptarg, balance, add_line_number,
char_to_uclump): Remove unnecessary casts.
(init_parameters): Allocate chars, not ints, for clump_buff.
(print_char): Use to_uchar before invoking ISPRINT.
(char_to_clump): Convert to unsigned char before invoking ISPRINT.

19 years agoint cleanup for nohup, paste, pathchk, printenv, od.
Paul Eggert [Tue, 3 Aug 2004 15:37:00 +0000 (15:37 +0000)]
int cleanup for nohup, paste, pathchk, printenv, od.

19 years ago(main): Use bool for booleans.
Paul Eggert [Tue, 3 Aug 2004 15:31:02 +0000 (15:31 +0000)]
(main): Use bool for booleans.
Do not assume that the environ has at most one matching entry
for each option (integer overflow was possible otherwise).

19 years ago(validate-path, main, portable_chars_only): Use bool for booleans.
Paul Eggert [Tue, 3 Aug 2004 15:30:39 +0000 (15:30 +0000)]
(validate-path, main, portable_chars_only): Use bool for booleans.
(portable_chars_only): Use to_uchar rather than a cast.

19 years ago(paste_parallel, paste_serial, main): Use bool for booleans.
Paul Eggert [Tue, 3 Aug 2004 15:30:08 +0000 (15:30 +0000)]
(paste_parallel, paste_serial, main): Use bool for booleans.

19 years ago(main): Use bool for booleans.
Paul Eggert [Tue, 3 Aug 2004 15:29:48 +0000 (15:29 +0000)]
(main): Use bool for booleans.

19 years ago(FMT_BYTES_ALLOCATED): Now an enum, not a decimal
Paul Eggert [Tue, 3 Aug 2004 14:38:53 +0000 (14:38 +0000)]
(FMT_BYTES_ALLOCATED): Now an enum, not a decimal
constant.  Do not assume PRIdMAX etc. are strings of length 3 or
less.
(struct tspec): Use it.  fmt_string is now an array, not
a pointer, as there's little point to the indirection here.
(struct tspec, flag_dump_strings,
traditional, flag_pseudo_start, limit_bytes_to_format,
abbreviate_duplicate_blocks, have_read_stdin, simple_strtoul,
decode_one_format, open_next_file, check_and_close,
decode_format_string, skip, write_block, read_char, read_block,
parse_old_offset, dump, dump_strings, main):
Use bool for booleans.
(struct tspec): Use void *, not char *, for generic pointers.
(bytes_to_oct_digits, bytes_to_signed_dec_digits,
bytes_to_unsigned_dec_digits, bytes_to_hex_digits):
Use char, not unsigned int, since char suffices.
(print_s_char, print_char, print_s_short, print_short,
print_int, print_long, print_long_long, print_float,
print_double, print_long_double): Rewrite to avoid casts.
These now take void * arguments, instead of char *.
Use the same body for all functions, except for the choice
of type.  Assume C89 to simplify handling of signed char.
(dump_hexl_mode_trailer, print_named_ascii, print_ascii):
Rewrite to avoid casts.
(print_named_ascii, print_ascii): Now takes void *, not char *.
(decode_one_format): Use int for printf field widths, not
unsigned int.  Pass void * to subsidiary printers,
not char *.  Simplify handling of floating-point formats
by factoring out common code dealing with precision and field width.
(decode_format_string): Avoid need for temporary copy of
each decoded struct tspec.
(get_lcm): Remove unnecessary cast.
(main): Fix bug where more than INT_MAX failed decodes were ignored.

19 years agoint cleanups for nl, ln, ls, id, factor, setuidgid, fold, head, csplit, cut,
Paul Eggert [Tue, 3 Aug 2004 07:02:23 +0000 (07:02 +0000)]
int cleanups for nl, ln, ls, id, factor, setuidgid, fold, head, csplit, cut,
date, env, expr.

19 years ago(TRUE, FALSE): Remove; all uses changed to true, false.
Paul Eggert [Tue, 3 Aug 2004 06:59:28 +0000 (06:59 +0000)]
(TRUE, FALSE): Remove; all uses changed to true, false.
(enum number_format): Remove.
(FORMAT_RIGHT_NOLZ, FORMAT_RIGHT_LZ, FORMAT_LEFT): Now strings,
not enum values.
(DEFAULT_SECTION_DELIMITERS): Now an array constant, not a macro.
(section_del): Now const.
(print_fmt): Remove.
(starting_line_number, page_incr, blank_join, line_no,
print_lineno, proc_text, main):
Use intmax_t for line numbers.
(reset_numbers, have_read_stdin, build_type_arg, nl_file, main):
Use bool for booleans.
(lineno_format): Now a string, not an enum value.
(build_print_fmt): Remove.  All calls removed.  This work is
now doen within print_lineno.
(build_type_arg): Use size_t for sizes.
(print_lineno): Check for line number overflow.
(proc_text, main): Remove unnecessary cast.

19 years ago(struct fileinfo, file_interesting,
Paul Eggert [Tue, 3 Aug 2004 06:44:08 +0000 (06:44 +0000)]
(struct fileinfo, file_interesting,
extract_dirs_from_files, color_symlink_as_referent,
FILE_OR_LINK_MODE, sort_reverse, print_owner, print_group,
numeric_ids, print_block_size, dired, print_with_color,
check_symlink_color, print_inode, recursive, immediate_dirs,
all_files, really_all_files, qmark_funny_chars,
print_dir_name, format_needs_stat, format_needs_type, visit_dir,
main, decode_switches, parse_ls_color, print_dir, file_interesting,
gobble_file, make_link_path, basename_is_dot_or_dotdot,
extract_dirs_from_files, print_long_format):
Use bool for booleans.
(dir_defaulted): Remove; no longer needed.
(main): Use int to count files, since it suffices for argv.
Rewrite to avoid need for dir_defaulted.
(main, print_dir, gobble_file, get_link_name,
xstrcoll):
Set exit status to EXIT_SUCCES/EXIT_FAILURE rather than 0/1.
(decode_switches): Put back check for ws.ws_col <= SIZE_MAX.
Remove unnecessary cast to int.  Use int instead of unsigned
int to count from 0 to 1.
(get_funky_string, print_type_indicator): Use char for bytes, not int.
(make_link_path): Use NULL for null pointers.
(quote_name): Use to_uchar instead of cast.

19 years ago(symbolic_link, interactive, remove_existing_files,
Paul Eggert [Tue, 3 Aug 2004 06:43:43 +0000 (06:43 +0000)]
(symbolic_link, interactive, remove_existing_files,
verbose, hard_dir_link, dereference_dest_dir_symlinks,
do_link, main): Use bool for booleans.

19 years ago(main): Print uids/gids with %lu, not %ld.
Paul Eggert [Tue, 3 Aug 2004 06:27:33 +0000 (06:27 +0000)]
(main): Print uids/gids with %lu, not %ld.

19 years ago(use_name, main, print_user, xgetgroups, print_group_list,
Paul Eggert [Tue, 3 Aug 2004 06:27:09 +0000 (06:27 +0000)]
(use_name, main, print_user, xgetgroups, print_group_list,
print_full_info): Use bool for booleans.
(problems): Remove, replacing with....
(ok): New var (inverted from old sense).
(print_user, print_group, print_full_info):
Print uids/gids with %lu, not %u.
(xgetgroups): Don't run out of memory if getgroups or getugroups
returns -1.

19 years ago(presume_input_pipe, print_headers, have_read_stdin,
Paul Eggert [Tue, 3 Aug 2004 06:16:31 +0000 (06:16 +0000)]
(presume_input_pipe, print_headers, have_read_stdin,
write_header, elide_tail_bytes_pipe, elide_tail_bytes_file,
elide_tail_lines_pipe, elide_tail_lines_seekable,
elide_tail_lines_file, head_bytes, head_lines, head, head_file,
string_to_integer, main):
Use bool for booleans.
(main): Rewrite to avoid cast.

19 years ago(TAB_WIDTH): New macro; use it instead of "8".
Paul Eggert [Tue, 3 Aug 2004 06:16:05 +0000 (06:16 +0000)]
(TAB_WIDTH): New macro; use it instead of "8".
(fold_file, main): Use bool for booleans.
(fold_file, main): Use size_t for sizes.
(main): Allow -w options up to SIZE_MAX - TAB_WIDTH - 1, instead
of prohibiting widths greater than INT_MAX.

19 years ago(wheel_tab): Use unsigned char instead of unsigned
Paul Eggert [Tue, 3 Aug 2004 06:15:49 +0000 (06:15 +0000)]
(wheel_tab): Use unsigned char instead of unsigned
int, since it suffices.
(factor, print_factors): Use size_t for sizes.
(print_factors, do_stdin, main): Use bool for booleans.

19 years ago(nextarg): Use bool for booleans.
Paul Eggert [Tue, 3 Aug 2004 06:00:24 +0000 (06:00 +0000)]
(nextarg): Use bool for booleans.

19 years ago(main): Use bool for booleans.
Paul Eggert [Tue, 3 Aug 2004 06:00:08 +0000 (06:00 +0000)]
(main): Use bool for booleans.

19 years ago(show_date, rfc_format, batch_convert, main): Use bool for booleans.
Paul Eggert [Tue, 3 Aug 2004 05:59:36 +0000 (05:59 +0000)]
(show_date, rfc_format, batch_convert, main): Use bool for booleans.

19 years ago(cut_fields): Use to_uchar rather than a cast.
Paul Eggert [Tue, 3 Aug 2004 05:59:14 +0000 (05:59 +0000)]
(cut_fields): Use to_uchar rather than a cast.
(cut_file, main): Use bool for booleans.

19 years ago(struct line): Use size_t for sizes.
Paul Eggert [Tue, 3 Aug 2004 05:58:49 +0000 (05:58 +0000)]
(struct line): Use size_t for sizes.
(main): Remove unnecessary cast.

19 years agoint fixes for fmt, expand, dircolors, dd, seq, sleep, tail, hostname,
Paul Eggert [Tue, 3 Aug 2004 00:05:23 +0000 (00:05 +0000)]
int fixes for fmt, expand, dircolors, dd, seq, sleep, tail, hostname,
pinky, uptime, users, who, install, du, df.

19 years ago(wide-1, wide-2, bad-suffix): Adjust to today's fmt.c fixes.
Paul Eggert [Tue, 3 Aug 2004 00:03:57 +0000 (00:03 +0000)]
(wide-1, wide-2, bad-suffix): Adjust to today's fmt.c fixes.

19 years ago(COST, MAXWORDS): Add a comment describing some of
Paul Eggert [Tue, 3 Aug 2004 00:00:49 +0000 (00:00 +0000)]
(COST, MAXWORDS): Add a comment describing some of
fmt's arbitrary limits.
(TRUE, FALSE): Remove; all uses changed to (true, false).
(main): Use bool for booleans.
Limit maximum width to MAXCHARS / 2.  Use xstrtoul, not xstrtol,
to parse width.
(copy_rest): Remove unnecessary cast.
(get_prefix): Rewrite to avoid cast.
(check_punctuation): Use char *, not unsigned char *; C89 requires
this.  Avoid off-by-one buffer read overrun when line is empty.
(flush_paragraph): Don't assume wptr-parabuf is <= INT_MAX.
Remove unnecessary casts.

19 years ago(convert_entire_line, have_read_stdin, parse_tabstops,
Paul Eggert [Mon, 2 Aug 2004 23:49:31 +0000 (23:49 +0000)]
(convert_entire_line, have_read_stdin, parse_tabstops,
next_file, expand, main):
Use bool for booleans.
(tab_size, tab_list, add_tabstop, parse_tabstops, validate_tabstops,
expand, main):
Use uintmax_t for column counts.
(add_tabstop): Don't reserve -1 (now UINTMAX_MAX) as a special value.
All callers changed.
(parse_tabstops): Don't pass a negative char to isblank.
Avoid memory leak with large tab stops.
(validate_tabstops, expand): Don't assume number of tab stops is
<= INT_MAX.
(next_file, main): Use EXIT_SUCCESS/EXIT_FAILURE rather than 0/1 when
storing values into exit_status.
(expand): Use same pattern as unexpand for reading chars.
Report an error when input line is too long, instead of silently
screwing up.  Do not mishandle tab stops when backspacing left
over start of line.

19 years ago(have_read_stdin, append_quoted,
Paul Eggert [Mon, 2 Aug 2004 23:36:33 +0000 (23:36 +0000)]
(have_read_stdin, append_quoted,
dc_parse_stream, dc_parse_file, main): Use bool for booleans.
(dc_parse_stream): Use enum for state, rather than int.
Use ssize_t to store getline result.

19 years ago(translation_needed, parse_integer, scanargs,
Paul Eggert [Mon, 2 Aug 2004 23:29:39 +0000 (23:29 +0000)]
(translation_needed, parse_integer, scanargs,
apply_translations, char_is_saved, swab_buffer, skip_via_lseek):
Use bool for booleans.
(translate_buffer): Use to_uchar rather than a cast.
(swab_buffer, copy_simple, copy_with_unblock):
Use size_t for sizes.

19 years agoInclude limits.h, stdbool.h.
Paul Eggert [Mon, 2 Aug 2004 23:00:15 +0000 (23:00 +0000)]
Include limits.h, stdbool.h.
(CHAR_BIT): Remove.
(timespec_subtract, xnanosleep): Use bool for booleans.

19 years agounsigned -> unsigned int
Paul Eggert [Mon, 2 Aug 2004 22:59:41 +0000 (22:59 +0000)]
unsigned -> unsigned int

19 years agounsigned -> unsigned int
Paul Eggert [Mon, 2 Aug 2004 22:58:22 +0000 (22:58 +0000)]
unsigned -> unsigned int

19 years agoInclude <stdbool.h>.
Paul Eggert [Mon, 2 Aug 2004 22:57:37 +0000 (22:57 +0000)]
Include <stdbool.h>.
(yesno): Return bool, not int.

19 years agoInclude yesno.h first.
Paul Eggert [Mon, 2 Aug 2004 22:57:13 +0000 (22:57 +0000)]
Include yesno.h first.
(yesno): Return bool, not int.

19 years ago(errno): Remove decl; we now assume C89 or better.
Paul Eggert [Mon, 2 Aug 2004 22:56:56 +0000 (22:56 +0000)]
(errno): Remove decl; we now assume C89 or better.
(__xstrtol): Rewrite to avoid casts.