platform/upstream/coreutils.git
20 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.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

20 years agoJust include xstrtol.h rather than rolling our own include pattern.
Paul Eggert [Mon, 2 Aug 2004 22:55:59 +0000 (22:55 +0000)]
Just include xstrtol.h rather than rolling our own include pattern.

20 years agoJust include xstrtol.h rather than rolling our own include pattern.
Paul Eggert [Mon, 2 Aug 2004 22:55:32 +0000 (22:55 +0000)]
Just include xstrtol.h rather than rolling our own include pattern.

20 years agoLog today's int-related changes
Paul Eggert [Mon, 2 Aug 2004 22:55:12 +0000 (22:55 +0000)]
Log today's int-related changes

20 years ago(version_etc_va): Use size_t for sizes.
Paul Eggert [Mon, 2 Aug 2004 22:54:36 +0000 (22:54 +0000)]
(version_etc_va): Use size_t for sizes.

20 years agoInclude <stdbool.h>.
Paul Eggert [Mon, 2 Aug 2004 22:54:15 +0000 (22:54 +0000)]
Include <stdbool.h>.
(same_name): Return bool, not int.

20 years ago(errno): Remove decl; we now assume C89 or better.
Paul Eggert [Mon, 2 Aug 2004 22:53:41 +0000 (22:53 +0000)]
(errno): Remove decl; we now assume C89 or better.
(same_name): Return bool, not int.

20 years agoRewrite to avoid casts.
Paul Eggert [Mon, 2 Aug 2004 22:52:39 +0000 (22:52 +0000)]
Rewrite to avoid casts.

20 years agoInclude stdbool.h.
Paul Eggert [Mon, 2 Aug 2004 22:52:17 +0000 (22:52 +0000)]
Include stdbool.h.
(quotearg_buffer_restyled): Use bool for booleans.

20 years agonanosleep.c (errno): Remove decl; we now assume C89 or better.
Paul Eggert [Mon, 2 Aug 2004 22:51:56 +0000 (22:51 +0000)]
nanosleep.c (errno): Remove decl; we now assume C89 or better.
Include stdbool.h.
(rpl_nanosleep): Usee bool for booleans.

20 years agoUse Autoconf-suggested pattern for inttypes and stdint.
Paul Eggert [Mon, 2 Aug 2004 22:51:09 +0000 (22:51 +0000)]
Use Autoconf-suggested pattern for inttypes and stdint.

20 years agoUpdate copyright.
Paul Eggert [Mon, 2 Aug 2004 22:50:47 +0000 (22:50 +0000)]
Update copyright.

20 years agoUse Autoconf-suggested pattern for inttypes and stdint.
Paul Eggert [Mon, 2 Aug 2004 22:50:29 +0000 (22:50 +0000)]
Use Autoconf-suggested pattern for inttypes and stdint.

20 years agoUse Autoconf-suggested pattern for inttypes and stdint.
Paul Eggert [Mon, 2 Aug 2004 22:49:58 +0000 (22:49 +0000)]
Use Autoconf-suggested pattern for inttypes and stdint.

20 years ago(hash_string): Rewrite to avoid cast.
Paul Eggert [Mon, 2 Aug 2004 22:49:34 +0000 (22:49 +0000)]
(hash_string): Rewrite to avoid cast.

20 years agoInclude <stdbool.h>.
Paul Eggert [Mon, 2 Aug 2004 22:49:12 +0000 (22:49 +0000)]
Include <stdbool.h>.
(hard_locale): Return bool, not int.

20 years agohard-locale.c (hard_locale): Return bool, not int.
Paul Eggert [Mon, 2 Aug 2004 22:48:49 +0000 (22:48 +0000)]
hard-locale.c (hard_locale): Return bool, not int.

20 years agoInclude <stdbool.h>.
Paul Eggert [Mon, 2 Aug 2004 22:48:05 +0000 (22:48 +0000)]
Include <stdbool.h>.
(getloadavg_initialized): Use bool for booleans.

20 years ago(lookup_word): Rewrite to avoid cast.
Paul Eggert [Mon, 2 Aug 2004 22:47:44 +0000 (22:47 +0000)]
(lookup_word): Rewrite to avoid cast.

20 years ago(textutils_fileblocks_unused): Make it a typedef
Paul Eggert [Mon, 2 Aug 2004 22:47:25 +0000 (22:47 +0000)]
(textutils_fileblocks_unused): Make it a typedef
instead of an int, to save a few bytes in the object file.

20 years agoUpdate copyright.
Paul Eggert [Mon, 2 Aug 2004 22:47:00 +0000 (22:47 +0000)]
Update copyright.

20 years ago(enum canonicalize_mode_t): Reformat comments to fit in 80 columns.
Paul Eggert [Mon, 2 Aug 2004 22:42:37 +0000 (22:42 +0000)]
(enum canonicalize_mode_t): Reformat comments to fit in 80 columns.

20 years ago(errno): Remove decl; we now assume C89 or better.
Paul Eggert [Mon, 2 Aug 2004 22:41:37 +0000 (22:41 +0000)]
(errno): Remove decl; we now assume C89 or better.

20 years ago(struct File_spec, reopen_inaccessible_files, count_lines,
Paul Eggert [Mon, 2 Aug 2004 22:20:24 +0000 (22:20 +0000)]
(struct File_spec, reopen_inaccessible_files, count_lines,
forever, from_start, print_headers, have_read_stdin, valid_file_spec,
write_header, file_lines, pipe_lines, pipe_bytes, recheck,
tail_forever, tail_bytes, tail_lines, tail, tail_file,
parse_obsolescent_option, parse_options, main):
Use bool for booleans.
(struct File_spec, max_n_unchanged_stats_between_opens,
parse_options): Use uintmax_t, not unsigned int or unsigned long int,
for state counters.
(tail_bytes, tail_lines): Redo test of return value (-1, 0, 1) to
make it a bit clearer.

20 years ago(apply_suffix): Use bool for booleans.
Paul Eggert [Mon, 2 Aug 2004 22:19:27 +0000 (22:19 +0000)]
(apply_suffix):  Use bool for booleans.

20 years ago(equal_width, valid_format, main): Use bool for booleans.
Paul Eggert [Mon, 2 Aug 2004 22:19:01 +0000 (22:19 +0000)]
(equal_width, valid_format, main): Use bool for booleans.

20 years ago(xstrtod): Return bool, not int. Invert the sense of the boolean.
Paul Eggert [Mon, 2 Aug 2004 22:18:32 +0000 (22:18 +0000)]
(xstrtod): Return bool, not int.  Invert the sense of the boolean.
All uses changed.

20 years ago(xstrtod): Return bool, not int. Invert the sense of the boolean.
Paul Eggert [Mon, 2 Aug 2004 22:17:42 +0000 (22:17 +0000)]
(xstrtod): Return bool, not int.  Invert the sense of the boolean.
All uses changed.

20 years agoInclude "xgethostname.h".
Paul Eggert [Mon, 2 Aug 2004 21:52:28 +0000 (21:52 +0000)]
Include "xgethostname.h".
(xgethostname): Remove decl; xgethostname.h has it.
(sethostname) [!defined(HAVE_SETHOSTNAME) && defined(HAVE_SYSINFO)
&& defined (HAVE_SYS_SYSTEMINFO_H) && defined(HAVE_LIMITS_H)]: Use
prototypes rather than K&R form.  Assume any negative value from
sysinfo denotes failure, not just -1.
(main): Simplify use of sethostname.

20 years agoDon't include <sys/types.h> or "exit.h"; no longer needed.
Paul Eggert [Mon, 2 Aug 2004 21:52:07 +0000 (21:52 +0000)]
Don't include <sys/types.h> or "exit.h"; no longer needed.
(errno): Remove decl; we now assume C89 or better.
Include unistd.h if available, for gethostname.
(ENAMETOOLONG): Define to 0, not 9999, to avoid colliding with
existing errno values if any.
(gethostname): Remove decl, since unistd.h declares it (or doesn't,
in which case it's an older system and it should just work).
(xgethostname): Don't assume host name length is less than INT_MAX.
Exit if malloc fails, just as the comment says.

20 years agoInclude <stdbool.h>.
Paul Eggert [Mon, 2 Aug 2004 21:06:22 +0000 (21:06 +0000)]
Include <stdbool.h>.
(errno): Remove decl; we now assume C89 or better.
(save_cwd): Use bool for booleans.
(save_cwd, restore_cwd): Return -1 on failure, not 1, since we set
errno on failure.

20 years ago(do_lookup, short_list, short_output, include_idle,
Paul Eggert [Mon, 2 Aug 2004 20:56:46 +0000 (20:56 +0000)]
(do_lookup, short_list, short_output, include_idle,
include_heading, include_mesg, include_exit, need_boottime,
need_deadprocs, need_login, need_initspawn, need_clockchange,
need_runlevel, need_users, my_line_only, main): Use bool for booleans.
(print_runlevel): Use unsigned char for bytes.
(list_entries_who, scan_entries, who): Use size_t for sizes.
(main): No need to pass a non-NULL last arg to getopt_long.

20 years ago(list_entries_users, users): Use size_t for sizes.
Paul Eggert [Mon, 2 Aug 2004 20:56:30 +0000 (20:56 +0000)]
(list_entries_users, users): Use size_t for sizes.
(list_entries_users): Use char for bytes.
(main): No need to pass a non-NULL last arg to getopt_long.

20 years ago(print_uptime, uptime): Use size_t for sizes.
Paul Eggert [Mon, 2 Aug 2004 20:56:10 +0000 (20:56 +0000)]
(print_uptime, uptime): Use size_t for sizes.
(print_uptime): Remove unused local variable.
(main): No need to pass a non-NULL last arg to getopt_long.

20 years ago(include_idle, include_heading, include_fullname,
Paul Eggert [Mon, 2 Aug 2004 20:55:44 +0000 (20:55 +0000)]
(include_idle, include_heading, include_fullname,
include_project, include_plan, include_home_and_shell, do_short_format,
include_where, main): Use bool for booleans.
(count_ampersands, create_fullname, scan_entries, short_pinky):
Use size_t for sizes.
(create_fullname): Check for overflow in size calculations.
(idle_string): Don't assume that the number of idle days
is less than 10**8 and/or INT_MAX/(24*60*60).
(main): No need to pass a non-NULL last arg to getopt_long.

20 years ago(read_utmp): Don't assume that the number of users is less than INT_MAX.
Paul Eggert [Mon, 2 Aug 2004 20:55:14 +0000 (20:55 +0000)]
(read_utmp): Don't assume that the number of users is less than INT_MAX.
Check for integer overflow in size calculations.
Return -1 (not 1) on failure, since we set errno in that case.

20 years ago(UT_USER): Parenthesize properly.
Paul Eggert [Mon, 2 Aug 2004 20:54:45 +0000 (20:54 +0000)]
(UT_USER): Parenthesize properly.
(UT_USER_SIZE): New constant.
(read_utmp): Don't assume that the number of users is less than
INT_MAX.

20 years ago(posix_time_parse): Don't assume that the length of
Paul Eggert [Mon, 2 Aug 2004 20:34:27 +0000 (20:34 +0000)]
(posix_time_parse): Don't assume that the length of
the string being parsed is <= UINT_MAX.

20 years ago(read_file_system_list): Accept bool flag, not int.
Paul Eggert [Mon, 2 Aug 2004 20:27:45 +0000 (20:27 +0000)]
(read_file_system_list): Accept bool flag, not int.
(errno): Remove decl; we now assume C89 or better.
(xatoi): Remove; replaced by strtoul.  Hence device numbers can now
go up to ULONG_MAX.

20 years agoInclude <stdbool.h>.
Paul Eggert [Mon, 2 Aug 2004 20:27:16 +0000 (20:27 +0000)]
Include <stdbool.h>.
(read_file_system_list): Accept bool flag, not int.

20 years agoRegenerate.
Paul Eggert [Mon, 2 Aug 2004 20:17:31 +0000 (20:17 +0000)]
Regenerate.

20 years agoNo longer needed by 'install', so remove it.
Paul Eggert [Mon, 2 Aug 2004 20:15:49 +0000 (20:15 +0000)]
No longer needed by 'install', so remove it.

20 years ago(libfetish_a_SOURCES): Remove isdir.c.
Paul Eggert [Mon, 2 Aug 2004 20:14:53 +0000 (20:14 +0000)]
(libfetish_a_SOURCES): Remove isdir.c.

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

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

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

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

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

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

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

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

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