1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-04-19 10:15:48 +02:00
Commit Graph

19148 Commits

Author SHA1 Message Date
Paul Eggert
86c940cf99 (silent, main): Use bool for booleans.
(main): 0 -> STDIN_FILENO.
2004-08-03 23:14:08 +00:00
Paul Eggert
53e793837a (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.
2004-08-03 23:13:20 +00:00
Paul Eggert
b2978936b3 (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.
2004-08-03 23:13:09 +00:00
Paul Eggert
d60286964d (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.
2004-08-03 23:03:04 +00:00
Paul Eggert
09f4eb4ee0 (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.
2004-08-03 22:40:28 +00:00
Paul Eggert
0fbc16c28b (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.
2004-08-03 22:40:15 +00:00
Paul Eggert
d2940e7cd4 (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.
2004-08-03 22:23:25 +00:00
Paul Eggert
cee6afd01e (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.
2004-08-03 20:30:45 +00:00
Paul Eggert
a74bfe2b9a (tee, append, ignore_interrupts, main, tee):
Use bool for booleans.
(tee): Use ssize_t for read returns.
2004-08-03 20:06:29 +00:00
Paul Eggert
734248fa5b (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.
2004-08-03 20:06:17 +00:00
Paul Eggert
f7f7ae46ea (empty_paths, ignore_fail_on_non_empty, verbose,
errno_rmdir_non_empty, remove_parents, main): Use bool for booleans.
2004-08-03 20:05:59 +00:00
Paul Eggert
005ffa4fb1 Add copyright notice.
(struct rm_options): Use bool for booleans.
2004-08-03 20:05:42 +00:00
Paul Eggert
216feb30f7 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.
2004-08-03 19:15:59 +00:00
Paul Eggert
9d06bbe298 (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.
2004-08-03 19:08:31 +00:00
Paul Eggert
cc3fc16d1c (cwrite, bytes_split, lines_split, line_bytes_split):
Use bool for booleans.
2004-08-03 19:08:01 +00:00
Paul Eggert
7ee3d54dc0 (struct Options, main): Use bool for booleans.
(isaac_seed_data, fillpattern, wipefile): Rewrite to avoid casts.
2004-08-03 19:07:51 +00:00
Paul Eggert
2d8c3edb26 (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.
2004-08-03 19:07:36 +00:00
Paul Eggert
1bd2155bd7 (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.
2004-08-03 19:07:11 +00:00
Paul Eggert
8cc9e3ce8b 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.
2004-08-03 18:26:32 +00:00
Paul Eggert
3518dcf753 int cleanup for nohup, paste, pathchk, printenv, od. 2004-08-03 15:37:00 +00:00
Paul Eggert
99f4d500fd (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).
2004-08-03 15:31:02 +00:00
Paul Eggert
f2de0ef762 (validate-path, main, portable_chars_only): Use bool for booleans.
(portable_chars_only): Use to_uchar rather than a cast.
2004-08-03 15:30:39 +00:00
Paul Eggert
3b78349314 (paste_parallel, paste_serial, main): Use bool for booleans. 2004-08-03 15:30:08 +00:00
Paul Eggert
4690e0aa35 (main): Use bool for booleans. 2004-08-03 15:29:48 +00:00
Paul Eggert
224059ad65 (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.
2004-08-03 14:38:53 +00:00
Paul Eggert
77f4620b24 int cleanups for nl, ln, ls, id, factor, setuidgid, fold, head, csplit, cut,
date, env, expr.
2004-08-03 07:02:23 +00:00
Paul Eggert
2ca9ac1f58 (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.
2004-08-03 06:59:28 +00:00
Paul Eggert
e96ea33902 (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.
2004-08-03 06:44:08 +00:00
Paul Eggert
76d72cdd2b (symbolic_link, interactive, remove_existing_files,
verbose, hard_dir_link, dereference_dest_dir_symlinks,
do_link, main): Use bool for booleans.
2004-08-03 06:43:43 +00:00
Paul Eggert
34042b9077 (main): Print uids/gids with %lu, not %ld. 2004-08-03 06:27:33 +00:00
Paul Eggert
3c838e94e5 (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.
2004-08-03 06:27:09 +00:00
Paul Eggert
b871878b29 (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.
2004-08-03 06:16:31 +00:00
Paul Eggert
3d3030da66 (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.
2004-08-03 06:16:05 +00:00
Paul Eggert
c8f4d13551 (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.
2004-08-03 06:15:49 +00:00
Paul Eggert
ae631658b0 (nextarg): Use bool for booleans. 2004-08-03 06:00:24 +00:00
Paul Eggert
609b271cc5 (main): Use bool for booleans. 2004-08-03 06:00:08 +00:00
Paul Eggert
b3c28cad1b (show_date, rfc_format, batch_convert, main): Use bool for booleans. 2004-08-03 05:59:36 +00:00
Paul Eggert
a982e48ca3 (cut_fields): Use to_uchar rather than a cast.
(cut_file, main): Use bool for booleans.
2004-08-03 05:59:14 +00:00
Paul Eggert
846cb63700 (struct line): Use size_t for sizes.
(main): Remove unnecessary cast.
2004-08-03 05:58:49 +00:00
Paul Eggert
ef9d1f67b2 int fixes for fmt, expand, dircolors, dd, seq, sleep, tail, hostname,
pinky, uptime, users, who, install, du, df.
2004-08-03 00:05:23 +00:00
Paul Eggert
8c454fe939 (wide-1, wide-2, bad-suffix): Adjust to today's fmt.c fixes. 2004-08-03 00:03:57 +00:00
Paul Eggert
c5c1463809 (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.
2004-08-03 00:00:49 +00:00
Paul Eggert
71377ec627 (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.
2004-08-02 23:49:31 +00:00
Paul Eggert
bfaa02d8a9 (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.
2004-08-02 23:36:33 +00:00
Paul Eggert
3bec629dc8 (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.
2004-08-02 23:29:39 +00:00
Paul Eggert
126d5f9437 Include limits.h, stdbool.h.
(CHAR_BIT): Remove.
(timespec_subtract, xnanosleep): Use bool for booleans.
2004-08-02 23:00:15 +00:00
Paul Eggert
3afb4dad99 unsigned -> unsigned int 2004-08-02 22:59:41 +00:00
Paul Eggert
aebe589261 unsigned -> unsigned int 2004-08-02 22:58:22 +00:00
Paul Eggert
e55f95fe97 Include <stdbool.h>.
(yesno): Return bool, not int.
2004-08-02 22:57:37 +00:00
Paul Eggert
8e4b7d7fa1 Include yesno.h first.
(yesno): Return bool, not int.
2004-08-02 22:57:13 +00:00