[Midnightbsd-cvs] src [10786] trunk/usr.bin/wc/wc.c: reset signinfo

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Jun 9 22:49:58 EDT 2018


Revision: 10786
          http://svnweb.midnightbsd.org/src/?rev=10786
Author:   laffer1
Date:     2018-06-09 22:49:57 -0400 (Sat, 09 Jun 2018)
Log Message:
-----------
reset signinfo

Modified Paths:
--------------
    trunk/usr.bin/wc/Makefile
    trunk/usr.bin/wc/wc.1
    trunk/usr.bin/wc/wc.c

Property Changed:
----------------
    trunk/usr.bin/wc/wc.1

Modified: trunk/usr.bin/wc/Makefile
===================================================================
--- trunk/usr.bin/wc/Makefile	2018-06-10 02:48:08 UTC (rev 10785)
+++ trunk/usr.bin/wc/Makefile	2018-06-10 02:49:57 UTC (rev 10786)
@@ -1,5 +1,6 @@
+# $MidnightBSD$
 #	@(#)Makefile	8.1 (Berkeley) 6/6/93
-# $MidnightBSD$
+# $FreeBSD: stable/10/usr.bin/wc/Makefile 201386 2010-01-02 10:27:05Z ed $
 
 PROG=	wc
 .include <bsd.prog.mk>

Modified: trunk/usr.bin/wc/wc.1
===================================================================
--- trunk/usr.bin/wc/wc.1	2018-06-10 02:48:08 UTC (rev 10785)
+++ trunk/usr.bin/wc/wc.1	2018-06-10 02:49:57 UTC (rev 10786)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -29,9 +30,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)wc.1	8.2 (Berkeley) 4/19/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/usr.bin/wc/wc.1 286759 2015-08-14 02:45:22Z pfg $
 .\"
-.Dd December 6, 2008
+.Dd August 24, 2015
 .Dt WC 1
 .Os
 .Sh NAME
@@ -70,7 +71,7 @@
 .It Fl L
 The number of characters in the longest input line
 is written to the standard output.
-When more then one
+When more than one
 .Ar file
 argument is specified, the longest input line of
 .Em all


Property changes on: trunk/usr.bin/wc/wc.1
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.bin/wc/wc.c
===================================================================
--- trunk/usr.bin/wc/wc.c	2018-06-10 02:48:08 UTC (rev 10785)
+++ trunk/usr.bin/wc/wc.c	2018-06-10 02:49:57 UTC (rev 10786)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1980, 1987, 1991, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -40,7 +41,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/wc/wc.c 282278 2015-04-30 18:07:48Z bdrewery $");
 
 #include <sys/param.h>
 #include <sys/stat.h>
@@ -58,8 +59,8 @@
 #include <wchar.h>
 #include <wctype.h>
 
-uintmax_t tlinect, twordct, tcharct, tlongline;
-int doline, doword, dochar, domulti, dolongline;
+static uintmax_t tlinect, twordct, tcharct, tlongline;
+static int doline, doword, dochar, domulti, dolongline;
 static volatile sig_atomic_t siginfo;
 
 static void	show_cnt(const char *file, uintmax_t linect, uintmax_t wordct,
@@ -74,6 +75,14 @@
 	siginfo = 1;
 }
 
+static void
+reset_siginfo(void)
+{
+
+	signal(SIGINFO, SIG_DFL);
+	siginfo = 0;
+}
+
 int
 main(int argc, char *argv[])
 {
@@ -207,6 +216,7 @@
 					} else
 						tmpll++;
 			}
+			reset_siginfo();
 			tlinect += linect;
 			if (dochar)
 				tcharct += charct;
@@ -229,6 +239,7 @@
 				return (1);
 			}
 			if (S_ISREG(sb.st_mode)) {
+				reset_siginfo();
 				charct = sb.st_size;
 				show_cnt(file, linect, wordct, charct, llct);
 				tcharct += charct;
@@ -289,6 +300,7 @@
 			}
 		}
 	}
+	reset_siginfo();
 	if (domulti && MB_CUR_MAX > 1)
 		if (mbrtowc(NULL, NULL, 0, &mbs) == (size_t)-1 && !warned)
 			warn("%s", file != NULL ? file : "stdin");



More information about the Midnightbsd-cvs mailing list