Module Name:    src
Committed By:   christos
Date:           Wed Mar 16 23:01:34 UTC 2016

Modified Files:
        src/bin/ksh: Makefile siglist.sh

Log Message:
We don't need all this magic to build the signals lists. Do the work at
compile time.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/bin/ksh/Makefile
cvs rdiff -u -r1.9 -r1.10 src/bin/ksh/siglist.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/Makefile
diff -u src/bin/ksh/Makefile:1.31 src/bin/ksh/Makefile:1.32
--- src/bin/ksh/Makefile:1.31	Thu Jan 29 15:46:31 2015
+++ src/bin/ksh/Makefile	Wed Mar 16 19:01:33 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.31 2015/01/29 20:46:31 joerg Exp $
+#	$NetBSD: Makefile,v 1.32 2016/03/16 23:01:33 christos Exp $
 
 WARNS=3
 CWARNFLAGS.clang+=	-Wno-error=cast-qual
@@ -22,7 +22,6 @@ USETBL= 
 
 # Environment for scripts executed during build.
 SCRIPT_ENV= \
-	AWK=${TOOL_AWK:Q} \
 	SED=${TOOL_SED:Q}
 
 CLEANFILES+=	siglist.out siglist.out.tmp

Index: src/bin/ksh/siglist.sh
diff -u src/bin/ksh/siglist.sh:1.9 src/bin/ksh/siglist.sh:1.10
--- src/bin/ksh/siglist.sh:1.9	Sun Jan 23 12:11:55 2011
+++ src/bin/ksh/siglist.sh	Wed Mar 16 19:01:33 2016
@@ -1,44 +1,14 @@
 #!/bin/sh
-#	$NetBSD: siglist.sh,v 1.9 2011/01/23 17:11:55 hauke Exp $
+#	$NetBSD: siglist.sh,v 1.10 2016/03/16 23:01:33 christos Exp $
 #
 # Script to generate a sorted, complete list of signals, suitable
 # for inclusion in trap.c as array initializer.
 #
 
-set -e
-
-: ${AWK:=awk}
 : ${SED:=sed}
 
-in=tmpi$$.c
-out=tmpo$$.c
-ecode=1
-trapsigs='0 1 2 13 15'
-trap 'rm -f $in $out; trap 0; exit $ecode' $trapsigs
-
-CPP="${1-cc -E}"
-
 # The trap here to make up for a bug in bash (1.14.3(1)) that calls the trap
-(trap $trapsigs;
- echo '#include "sh.h"';
- echo '	{ QwErTy SIGNALS , "DUMMY" , "hook for number of signals" },';
- ${SED} -e '/^[	 ]*#/d' -e 's/^[	 ]*\([^ 	][^ 	]*\)[	 ][	 ]*\(.*[^ 	]\)[ 	]*$/#ifdef SIG\1\
-	{ QwErTy .signal = SIG\1 , .name = "\1", .mess = "\2" },\
-#endif/') > $in
-$CPP $in  > $out
-${SED} -n 's/{ QwErTy/{/p' < $out | ${AWK} '{print NR, $0}' | sort -k 5n -k 1n |
-    ${SED} 's/^[0-9]* //' |
-    ${AWK} 'BEGIN { last=0; nsigs=0; }
-	{
-	    if ($4 ~ /^[0-9][0-9]*$/ && $5 == ",") {
-		n = $4;
-		if (n > 0 && n != last) {
-		    while (++last < n) {
-			printf "\t{ .signal = %d , .name = NULL, .mess = `Signal %d` } ,\n", last, last;
-		    }
-		    print;
-		}
-	    }
-	}' |
-    tr '`' '"' | grep -v '"DUMMY"'
-ecode=0
+
+${SED} -e '/^[	 ]*#/d' -e 's/^[	 ]*\([^ 	][^ 	]*\)[	 ][	 ]*\(.*[^ 	]\)[ 	]*$/#ifdef SIG\1\
+	{ .signal = SIG\1 , .name = "\1", .mess = "\2" },\
+#endif/'

Reply via email to