diff options
author | sjg <sjg@FreeBSD.org> | 2015-05-27 01:19:58 +0000 |
---|---|---|
committer | sjg <sjg@FreeBSD.org> | 2015-05-27 01:19:58 +0000 |
commit | 65145fa4c81da358fcbc3b650156dab705dfa34e (patch) | |
tree | 55c065b6730aaac2afb6c29933ee6ec5fa4c4249 /usr.bin/wc | |
parent | 60ff4eb0dff94a04d75d0d52a3957aaaf5f8c693 (diff) | |
parent | e6b664c390af88d4a87208bc042ce503da664c3b (diff) | |
download | FreeBSD-src-65145fa4c81da358fcbc3b650156dab705dfa34e.zip FreeBSD-src-65145fa4c81da358fcbc3b650156dab705dfa34e.tar.gz |
Merge sync of head
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 6c67135..540e33d 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 79ac4a0..a6ca137 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"); |