Commit Graph
5033 Commits
Author SHA1 Message Date
Paul Eggert 786ebb2cec Include stdio_safer.h.
(check_file): Don't assume fopen cannot return stdin or stdout.
2005-04-11 20:13:26 +00:00
Paul Eggert 45e6c262b9 (next_file): Don't assume fopen cannot return stdin. 2005-04-11 20:13:10 +00:00
Paul Eggert 8e8520b0ba (have_read_stdin): Remove; no longer needed. All uses
removed.
(tsort): Do not assume fopen can't return stdin.
Close stdin before returning.  All uses changed.
2005-04-11 20:12:51 +00:00
Paul Eggert 39d496f075 Include unistd-safer.h.
(touch): Use fd_safer.
2005-04-11 20:12:32 +00:00
Paul Eggert 857b9db0e0 Include stdio-safer.h.
(tee): Use fopen_safer.
2005-04-11 20:12:17 +00:00
Paul Eggert 99eb6d3a02 Include unistd-safer.h rather than fcntl-safer.h.
(recheck, tail_file): Use fd_safer rather than open_safer.
2005-04-11 20:12:01 +00:00
Paul Eggert 9db4c89700 Include unistd-safer.h.
(copy_to_temp): Use fd_safer.
(tac_file): Don't assume fopen cannot return stdin.
2005-04-11 20:11:45 +00:00
Paul Eggert da5dc50751 (bsd_sum_file, sysv_sym_file):
Use same pattern as elsewhere for checking for stdin.
2005-04-11 20:11:27 +00:00
Paul Eggert a498869855 Include unistd-safer.h.
(cwrite): Use fd_safer.  Replace mystery constant 0666 with symbolic
version, as POSIX requires.
2005-04-11 20:11:08 +00:00
Paul Eggert 66729cdcd3 Include unistd-safer.h.
(create_temp_file): Use fd_safer.
(xfclose): Don't assume fileno (stdin) == STDIN_FILENO, etc.
2005-04-11 20:10:52 +00:00
Paul Eggert 0d49dd9de2 Include unistd-safer.h.
(wipename): Use fd_safer on directory file descriptor.
(wipefile): Remove special case for /dev/fd/* on older hosts.
It didn't work in general, and wasn't documented.
Use fd_safer.
2005-04-11 20:10:23 +00:00
Paul Eggert caca482cde (main): Don't assume fopen returns stdout after closing
stdout.  Use freopen instead.
2005-04-11 20:10:00 +00:00
Paul Eggert 02b7510866 Include stdio-safer.h.
(open_file): Use fopen_safer.
(close_file): Don't assume fopen does not return stdin.
2005-04-11 20:09:42 +00:00
Paul Eggert c2377708ec (paste_serial): Don't assume fopen does not return stdin. 2005-04-11 20:09:22 +00:00
Paul Eggert ab860aae65 (check_and_close): Don't assume fopen does not return stdin. 2005-04-11 20:09:01 +00:00
Paul Eggert 8e14d7ffbb Include unistd-safer.h.
(main): Don't dup stderr to stdin or stdout by mistake.
2005-04-11 20:08:30 +00:00
Paul Eggert e972b27d05 (digest_file, digest_check):
Don't assume that fopen does not return stdin.
2005-04-11 20:08:11 +00:00
Paul Eggert aba88afdce Include stdio-safer.h.
(main): Use fopen_safer.  Simplify the resulting code.
2005-04-11 20:07:54 +00:00
Paul Eggert ea778b6463 (head_file): Don't assume open does not return 0. 2005-04-11 20:07:37 +00:00
Paul Eggert cc4407f0fe (dc_parse_file): Don't assume fopen does not return stdin. 2005-04-11 20:07:22 +00:00
Paul Eggert 329448f75e Include stdio-safer.h.
(input_desc): Remove unnecessary static initialization.
(set_input_file): Use STDIN_FILENO, not 0.
(create_output_file): Use fopen_safer.
2005-04-11 20:07:00 +00:00
Paul Eggert 0b8c662cf2 Include unistd-safer.h.
(copy_reg): Use fd_safer.
2005-04-11 20:06:34 +00:00
Paul Eggert fd48557688 Include stdio-safer.h.
(compare_files): Exit right away on I/O error rather than continuing
and producing confusing output and error messages.
Return void, not int; all callers changed.
Use fopen_safer to avoid confusion with file descriptors.
2005-04-11 20:06:13 +00:00
Jim Meyering faac042790 (chopt_free): Mark parameter as unused. 2005-04-10 13:44:45 +00:00
Jim Meyering 493aba2ae5 (close_stdout_wrapper): Likewise.
Don't close STDOUT_FILENO explicitly; close_stdout does it.
2005-04-09 16:29:29 +00:00
Jim Meyering e115c60a2a (quit): Define with ATTRIBUTE_NORETURN.
Now that close_stdout closes standard output unconditionally,
these workarounds for dd and cat are no longer necessary.
(close_stdout_wrapper): Remove function.
(main): Call atexit with close_stdout, instead.
2005-04-09 14:15:22 +00:00
Jim Meyering 0eb83b6534 Readability nit:
Change this:
  #  define __attribute__(x)
  to this:
  #  define __attribute__(x) /* empty */
2005-04-09 13:57:51 +00:00
Jim Meyering 113bb1ac7b (usage): Mention that --recursive removes listed
directories too, not just their contents.
Say that by default, rm does not remove directories.
2005-04-09 10:39:17 +00:00
Jim Meyering 6cd4eed0ba Don't include "timespec.h". system.h does that. 2005-04-09 07:23:50 +00:00
Paul Eggert 8ae46b55b4 (iread, iwrite): Use char * buffer, not void *, so we can do pointer
arithmetic on it.
2005-04-09 06:16:14 +00:00
Paul Eggert ed74cc7c26 (SA_NOCLDSTOP): Define to 0 if not defined.
All uses changed.
(siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
(main) [! SA_NOCLDSTOP]: Use it.
2005-04-09 04:57:37 +00:00
Paul Eggert 9fd2c631bf Remove all uses of signals; modern hosts have
/dev/random and don't need this gorp.
Do not include signal.h.
(env, sigill_handler, isaac_seed_machdep): Remove.  All uses removed.
2005-04-09 04:57:15 +00:00
Paul Eggert bc7c9f0ebc (SA_NOCLDSTOP): Define to 0 if not defined.
All uses changed.
(siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
(main) [! SA_NOCLDSTOP]: Use it.
2005-04-09 04:56:10 +00:00
Paul Eggert 4f0b9dbd17 Do not include safe-read.h or full-write; no longer needed.
(process_signals): Add forward decl.
(SA_NOCLDSTOP, sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
New macros.
(siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
(SA_NODEFER) [!defined SA_NODEFER]: New macro.
(SA_RESETHAND) [!defined SA_RESETHAND]: New macro.
(caught_signals, interrupt_signal, info_signal_count, catch_siginfo):
New vars.
(usage): Mention -USR1 versus -INFO.
(cleanup): Don't invoke print_stats; the caller must do it now.
All callers changed.
(quit): Process signals just before exiting.
(interrupt_handler): Simply record the signal and return.
(siginfo_handler): Simply increment the signal counter and return.
(install_handler): Remove, replacing with:
(install_signal_handlers, process_signals, iread, iwrite):
New functions.  All callers to safe_read and full_write replaced
by iread and iwrite.  All callers to install_handler replaced by
install_handlers.

Do not include inttostr.h, no longer needed.
(print_stats, main): Rewrite and simplify formats to use PRIuMAX
instead of umaxtostr.
(print_stats): Work even in languages that have special
forms for two of things, for r_truncate and w_bytes.  We can't
fix delta_s in this way, since ngettext doesn't support floating-point.
(main): Rewrite to avoid casts.
2005-04-09 04:55:40 +00:00
Paul Eggert f33b6dab82 (SA_NOCLDSTOP): Define to 0 if not defined.
All uses changed.
(siginterrupt) [!HAVE_SIGINTERRUPT]: New macro.
(delete_all_files): New arg IN_SIGNAL_HANDLER, to avoid undefined
behavior when called from a signal handler.  All uses changed.
(main) [!defined SA_NOCLDSTOP]:
Use siginterrupt to specify that system calls should be interrupted.
2005-04-09 04:55:05 +00:00
Paul Eggert 65d8e81ce7 (RETSIGTYPE): Remove; no longer needed. All uses replaced with void. 2005-04-09 04:54:23 +00:00
Jim Meyering 66374c61ee (binary_operator) [LINT]: Initialize lt and rt to 0. 2005-04-07 20:10:03 +00:00
Jim Meyering 3bad149c95 (digest_check) [LINT]: Initialize hex_digest to NULL. 2005-04-07 20:09:46 +00:00
Jim Meyering d736105221 (binop): Move function definition to precede first use so we can...
(binop): ...remove prototype.
2005-04-07 17:14:14 +00:00
Jim Meyering d55d4b6c81 (is_int, age_of, binop): Declare char *' parameters to be const'. 2005-04-07 17:12:27 +00:00
Paul Eggert e8a0c946f5 (usage): Add examples. 2005-04-05 22:21:50 +00:00
Jim Meyering 44ebdc8d01 (usage): Mention that some shells provide a built-in function by the same name. 2005-04-05 11:53:47 +00:00
Jim Meyering e4a293284f (usage): Mention that some shells provide a
built-in function by the same name.
2005-04-05 11:53:38 +00:00
Jim Meyering 6d619b4ab7 . 2005-04-05 11:45:49 +00:00
Jim Meyering dce4a77a99 (tee): When closing files, do not close stdout,
leave this job to close_stdout() instead.
From Dmitry V. Levin.
2005-04-05 11:40:53 +00:00
Jim Meyering e3cb2a0a05 (usage): Move USAGE_BUILTIN_WARNING to end of --help output. 2005-04-04 22:30:57 +00:00
Jim Meyering ce1ecb48b7 (USAGE_BUILTIN_WARNING): remove trailing newline 2005-04-04 22:30:22 +00:00
Jim Meyering 8c3ce409f1 . 2005-04-04 22:29:37 +00:00
Jim Meyering 3905751383 (usage): Mention that some shells provide a built-in
function by the same name.
2005-04-04 21:57:45 +00:00
Jim Meyering d3632f3571 (usage): Mention that some shells provide a built-in
function by the same name.
2005-04-04 21:57:04 +00:00