diff options
author | ache <ache@FreeBSD.org> | 2000-06-05 20:08:50 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2000-06-05 20:08:50 +0000 |
commit | bb8d736bb0eff1b56bcf9e860b34b8b6f80f1ec8 (patch) | |
tree | 21129c7746e6e6352147f5c3949ab93dacc18f8d /bin/ls | |
parent | f2b2cff75dc56f03de055849f2e1538ccb566024 (diff) | |
download | FreeBSD-src-bb8d736bb0eff1b56bcf9e860b34b8b6f80f1ec8.zip FreeBSD-src-bb8d736bb0eff1b56bcf9e860b34b8b6f80f1ec8.tar.gz |
Kill yourself in ^C handler, not exit(1) to allow script to sense signal
Diffstat (limited to 'bin/ls')
-rw-r--r-- | bin/ls/print.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/bin/ls/print.c b/bin/ls/print.c index 8d47501..1cdbf4f 100644 --- a/bin/ls/print.c +++ b/bin/ls/print.c @@ -46,11 +46,6 @@ static const char rcsid[] = #include <sys/param.h> #include <sys/stat.h> -#ifdef COLORLS -#include <ctype.h> -#include <termcap.h> -#include <term.h> /* for tparm */ -#endif #include <err.h> #include <errno.h> #include <fts.h> @@ -61,6 +56,12 @@ static const char rcsid[] = #include <string.h> #include <time.h> #include <unistd.h> +#ifdef COLORLS +#include <ctype.h> +#include <termcap.h> +#include <term.h> /* for tparm */ +#include <signal.h> +#endif #include "ls.h" #include "extern.h" @@ -463,12 +464,14 @@ char *cs; } } -/* ARGSUSED */ void colorquit(sig) int sig; { endcolor(); - exit(1); + fflush(stdout); + + (void) signal(sig, SIG_DFL); + (void) kill(getpid(), sig); } #endif /*COLORLS*/ |