Commit Graph
18331 Commits
Author SHA1 Message Date
Jim Meyering 431d661863 update from master 2004-04-26 13:59:35 +00:00
Jim Meyering 48d44f4301 . 2004-04-24 08:09:52 +00:00
Jim Meyering 5536fd32b1 . 2004-04-24 08:08:06 +00:00
Jim Meyering 9ba449c94b *** empty log message *** 2004-04-24 08:04:20 +00:00
Jim Meyering 58e4afaacf (gl_MACROS): Check for tcgetpgrp. 2004-04-24 08:03:46 +00:00
Jim Meyering adc30a8396 More signal-handling cleanup for ls.c. Do not allow signals to
happen between arbitrary output bytes, as the
restore-default-color sequence can bollix up multibyte chars or
color-change sequences in the ordinary output.  Instead, process
signals only between printing a file name and changing the color
back to non_filename_text color.  That way, if the signal handler
changes the color (to the default), 'ls' will change it back when
'ls' continues (after being suspended).

Also, do not bother with signal-handling unless stdout is a
controlling terminal; this lets stdio buffer better when "ls
--color" is piped or sent to a file.

(sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]: New macros.
Do not include "full-write.h"; no longer needed.
(tcgetpgrp) [! HAVE_TCGETPGRP]: New macro.
(put_indicator_direct): Remove.  All callers changed to use
put_indicator.
(caught_signals, interrupt_signal, stop_signal_count): New vars.
(restore_default_color): Don't bother checking for put_indicator
failure.
(sighandler): Don't handle SIGTSTP; that's another handler now.
Simply set interrupt_signal to the signal, then exit.
(stophandler, process_signals): New functions.
(main): Don't output any color changes until _after_ the signal
handlers are set up.  This fixes a race condition where 'ls'
could be interrupted while initializing colors, and leaving the
terminal in an undesirable state.
Don't mess with signal-handling if standard output is not a
controlling terminal.
When exiting, restore the default color, then restore the
default signal handling, then act on any signals that weren't
acted on yet.
Do not print //DIRED// etc. in colors; this avoids the need
to catch signals when printing them.
(print_name_with_quoting): Process signals just before switching
color back to non_filename_text.
2004-04-24 08:03:15 +00:00
Jim Meyering 8d90a31290 *** empty log message *** 2004-04-23 17:32:32 +00:00
Jim Meyering e356a9a6ea Avoid segfault on systems for which SIZE_MAX != (size_t) -1.
(quote_name): Use SIZE_MAX, not -1, in calls of quotearg_buffer.
Patch by Mikulas Patocka.
2004-04-23 17:32:25 +00:00
Jim Meyering 656883d775 *** empty log message *** 2004-04-23 17:27:20 +00:00
Jim Meyering d6079f7509 *** empty log message *** 2004-04-23 06:42:34 +00:00
Jim Meyering 096ac55884 Don't check for values.h; it's no longer used. 2004-04-23 06:42:31 +00:00
Jim Meyering 6a1ee7ca70 *** empty log message *** 2004-04-21 14:26:45 +00:00
Jim Meyering 57c7fbf44a *** empty log message *** 2004-04-21 14:26:17 +00:00
Jim Meyering ed4778772c (main): Do not ignore SIGPIPE, as POSIX 1003.1-2001
does not allow this.  This undoes the 1996-10-24 patch.
2004-04-21 14:26:09 +00:00
Jim Meyering b55c0ce8ee *** empty log message *** 2004-04-21 12:57:46 +00:00
Jim Meyering 8ab60c41be - csplit sometimes failed to remove files when interrupted.
- csplit didn't clean up if two signals arrived nearly simultaneously.

(sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]: Define.
(filename_space, prefix, suffix, digits, files_created, remove_files): Now volatile.
(caught_signals): New var.
(cleanup): Block signals while deleting all files.
(cleanup_fatal, handle_line_error, regexp_error):
Mark with ATTRIBUTE_NORETURN.
(create_output_file, close_output_file, interrupt_handler):
Block signals while changing the number of output files,
to fix some race conditions.
(delete_all_files): Do nothing if remove_files is zero.
Clear files_created.
(main): Don't mess with signals until after argument processing is done.

(main): Rewrite signal-catching code to make it
similar to other coreutils programs.  When processing signals,
block all signals that we catch, but do not block signals that we
don't catch.  Avoid problems with unsigned int warnings.

(interrupt_handler): Use void, not (obsolete) RETSIGTYPE.

(interrupt_handler) [defined SA_NOCLDSTOP]:
Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
2004-04-21 12:57:33 +00:00
Jim Meyering eae1b7f862 - ls could incorrectly restore color if multiple signals
arrived nearly simultaneously.

(main): Rewrite signal-catching code to make it
similar to other coreutils programs.  When processing signals,
block all signals that we catch, but do not block signals that we
don't catch.  Avoid problems with unsigned int warnings.

(sighandler) [defined SA_NOCLDSTOP]:
Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.

(sighandler) [!defined SA_NOCLDSTOP]: Reset signal
handler to self, not to SIG_IGN, since SIGTSTP can be received more than once.
(main): Use SA_RESTART, as that is simpler than checking for EINTR
failures all over the place.
2004-04-21 12:51:27 +00:00
Jim Meyering 4441496397 install -s failed on System V if SIGCHLD was ignored.
Include <signal.h>.
(main) [defined SIGCHLD]: Set SIGCHLD handler to the default,
if -s is given, since System V fork+wait does not work if SIGCHLD
is ignored.
2004-04-21 12:25:18 +00:00
Jim Meyering 1119774873 *** empty log message *** 2004-04-20 18:13:54 +00:00
Jim Meyering f4e0a51788 (is_empty_dir): Clarify comment. 2004-04-20 18:13:43 +00:00
Jim Meyering d432ccecc8 (main) [!defined _POSIX_SOURCE]:
Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
2004-04-20 15:10:07 +00:00
Jim Meyering 7b6892c3df (main): Rewrite signal-catching code to make it
similar to other coreutils programs.  When processing signals,
block all signals that we catch, but do not block signals that we
don't catch.  Avoid problems with unsigned int warnings.

(sighandler) [defined SA_NOCLDSTOP]:
Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
2004-04-20 15:08:57 +00:00
Jim Meyering 31ef15a49f (sigill_handler, isaac_seed_machdep): Use void, not (obsolete) RETSIGTYPE. 2004-04-20 15:05:40 +00:00
Jim Meyering bb5a8d159c (main) [!defined _POSIX_SOURCE]:
Use simpler "signal (sig, SIG_IGN)" rather than sigaction equivalent.
2004-04-20 10:44:42 +00:00
Jim Meyering aa3d650a1b *** empty log message *** 2004-04-20 10:41:40 +00:00
Jim Meyering fead36411c (suspended): Change its type from int to sig_atomic_t volatile.
(first_call): Make it private to rpl_nanosleep, and have it
be zero initially as that's a bit faster.
(my_usleep): Round up fractional times instead of truncating them,
as this is the usual meaning for 'sleep'.
2004-04-20 10:41:36 +00:00
Jim Meyering 3d286f8c91 . 2004-04-20 10:18:48 +00:00
Jim Meyering 28d28cffea tweak --help output 2004-04-20 10:06:19 +00:00
Jim Meyering 74c610f8bd *** empty log message *** 2004-04-20 10:04:43 +00:00
Jim Meyering d8c64d085c (.x.1): Use help2man's new --program-name=NAME option. 2004-04-20 10:04:11 +00:00
Jim Meyering a378497e2b Accept new option: --program-name=NAME, so that we
can override the one in --version output.  This is needed solely
so that test.1 doesn't refer to `[' as the program name.
Reported by Benjamin Cutler as http://bugs.debian.org/205251.
2004-04-20 10:03:53 +00:00
Jim Meyering 9d77d864e7 *** empty log message *** 2004-04-20 10:01:51 +00:00
Jim Meyering 5976e470ac remove trailing blank 2004-04-20 09:35:17 +00:00
Jim Meyering 3d22e9548d *** empty log message *** 2004-04-20 09:34:48 +00:00
Jim Meyering d3cb92f9b8 Don't include pathmax.h; system.h already does it. 2004-04-20 09:34:43 +00:00
Jim Meyering 50469e2c80 . 2004-04-20 09:21:30 +00:00
Jim Meyering 3e7e4ac602 *** empty log message *** 2004-04-20 09:21:09 +00:00
Jim Meyering 32227588fc Change UTILS_ to gl_ in AC_DEFINE'd names.
Change utils_- and jm_-prefixed variables, too.
* host-os.m4 (gl_HOST_OS): Renamed from UTILS_HOST_OS.
2004-04-20 09:21:05 +00:00
Jim Meyering ae75db7d88 Change UTILS_ to gl_ in AC_DEFINE'd names.
Change utils_- and jm_-prefixed variables, too.
(gl_FUNC_MKSTEMP): Renamed from UTILS_FUNC_MKSTEP.
2004-04-20 09:19:52 +00:00
Jim Meyering 48f4d20c8b Reflect the renamings. 2004-04-20 09:19:27 +00:00
Jim Meyering 595b417f1d Change UTILS_ to gl_ in AC_DEFINE'd names.
Change utils_- and jm_-prefixed variables, too.

(gl_FUNC_MKDIR_TRAILING_SLASH): Renamed from
UTILS_FUNC_MKDIR_TRAILING_SLASH.
2004-04-20 09:19:09 +00:00
Jim Meyering eefa4f7f1a *** empty log message *** 2004-04-20 08:45:28 +00:00
Jim Meyering d0d80d0702 (gl_MACROS): Reflect the renaming: s/UTILS_FUNC_DIRFD/gl_FUNC_DIRFD/ 2004-04-20 08:45:24 +00:00
Jim Meyering 183dcb7d9a (gl_FUNC_DIRFD): Rename from UTILS_FUNC_DIRFD. 2004-04-20 08:44:55 +00:00
Jim Meyering 84fc961958 *** empty log message *** 2004-04-20 08:40:41 +00:00
Jim Meyering 461c760184 Don't emit trailing blanks. 2004-04-20 08:40:38 +00:00
Jim Meyering 47d0e71e75 *** empty log message *** 2004-04-20 06:51:15 +00:00
Jim Meyering 335e3339ff (getndelim2): Upon realloc failure, don't leak memory. 2004-04-20 06:51:07 +00:00
Jim Meyering 4ef7ed5d49 *** empty log message *** 2004-04-20 06:50:46 +00:00
Jim Meyering ffccc03ad8 (cut_fields): Free buffer upon getndelim2 failure. 2004-04-20 06:50:37 +00:00