diff options
author | Simon J. Gerraty <sjg@FreeBSD.org> | 2015-05-27 01:19:58 +0000 |
---|---|---|
committer | Simon J. Gerraty <sjg@FreeBSD.org> | 2015-05-27 01:19:58 +0000 |
commit | 98e0ffaefb0f241cda3a72395d3be04192ae0d47 (patch) | |
tree | 55c065b6730aaac2afb6c29933ee6ec5fa4c4249 /usr.bin/wc | |
parent | b17ff922d4072ae132ece458f5b5d74a236880ac (diff) | |
parent | e81032ad243db32b8fd615b2d55ee94b9f6a5b6a (diff) | |
download | src-test2-98e0ffaefb0f241cda3a72395d3be04192ae0d47.tar.gz src-test2-98e0ffaefb0f241cda3a72395d3be04192ae0d47.zip |
Merge sync of head
Notes
Notes:
svn path=/projects/bmake/; revision=283595
Diffstat (limited to 'usr.bin/wc')
-rw-r--r-- | usr.bin/wc/Makefile | 3 | ||||
-rw-r--r-- | usr.bin/wc/wc.c | 15 |
2 files changed, 15 insertions, 3 deletions
diff --git a/usr.bin/wc/Makefile b/usr.bin/wc/Makefile index 6c671353be69..540e33d15c92 100644 --- a/usr.bin/wc/Makefile +++ b/usr.bin/wc/Makefile @@ -2,7 +2,6 @@ # $FreeBSD$ PROG= wc -DPADD= ${LIBXO} -LDADD= -lxo +LIBADD= xo .include <bsd.prog.mk> diff --git a/usr.bin/wc/wc.c b/usr.bin/wc/wc.c index 79ac4a020f3d..a6ca137d9856 100644 --- a/usr.bin/wc/wc.c +++ b/usr.bin/wc/wc.c @@ -76,6 +76,14 @@ siginfo_handler(int sig __unused) siginfo = 1; } +static void +reset_siginfo(void) +{ + + signal(SIGINFO, SIG_DFL); + siginfo = 0; +} + int main(int argc, char *argv[]) { @@ -140,12 +148,14 @@ main(int argc, char *argv[]) } while(*++argv); } + xo_close_list("file"); + if (total > 1) { xo_open_container("total"); show_cnt("total", tlinect, twordct, tcharct, tlongline); xo_close_container("total"); } - xo_close_list("file"); + xo_close_container("wc"); xo_finish(); exit(errors == 0 ? 0 : 1); @@ -227,6 +237,7 @@ cnt(const char *file) } else tmpll++; } + reset_siginfo(); tlinect += linect; if (dochar) tcharct += charct; @@ -249,6 +260,7 @@ cnt(const char *file) return (1); } if (S_ISREG(sb.st_mode)) { + reset_siginfo(); charct = sb.st_size; show_cnt(file, linect, wordct, charct, llct); tcharct += charct; @@ -309,6 +321,7 @@ word: gotsp = 1; } } } + reset_siginfo(); if (domulti && MB_CUR_MAX > 1) if (mbrtowc(NULL, NULL, 0, &mbs) == (size_t)-1 && !warned) xo_warn("%s", file != NULL ? file : "stdin"); |