Module Name:    src
Committed By:   kre
Date:           Wed Jul  5 19:47:11 UTC 2017

Modified Files:
        src/bin/sh: trap.c

Log Message:
DEBUG and white space changes only.   Convert TRACE() calls for DEBUg mode
to the new style.   NFC (when not debugging sh).


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/bin/sh/trap.c

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

Modified files:

Index: src/bin/sh/trap.c
diff -u src/bin/sh/trap.c:1.40 src/bin/sh/trap.c:1.41
--- src/bin/sh/trap.c:1.40	Sun May  7 15:01:18 2017
+++ src/bin/sh/trap.c	Wed Jul  5 19:47:11 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.40 2017/05/07 15:01:18 kre Exp $	*/
+/*	$NetBSD: trap.c,v 1.41 2017/07/05 19:47:11 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)trap.c	8.5 (Berkeley) 6/5/95";
 #else
-__RCSID("$NetBSD: trap.c,v 1.40 2017/05/07 15:01:18 kre Exp $");
+__RCSID("$NetBSD: trap.c,v 1.41 2017/07/05 19:47:11 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -484,6 +484,9 @@ SHELLPROC {
 void
 onsig(int signo)
 {
+	CTRACE(DBG_SIG, ("Signal %d, had: pending %d, gotsig[%d]=%d\n",
+	    signo, pendingsigs, signo, gotsig[signo]));
+
 	signal(signo, onsig);
 	if (signo == SIGINT && trap[SIGINT] == NULL) {
 		onint();
@@ -518,6 +521,8 @@ dotrap(void)
 		}
 		gotsig[i] = 0;
 		savestatus=exitstatus;
+		CTRACE(DBG_TRAP|DBG_SIG, ("dotrap %d: \"%s\"\n", i,
+		    trap[i] ? trap[i] : "-NULL-"));
 		tr = savestr(trap[i]);		/* trap code may free trap[i] */
 		evalstring(tr, 0);
 		ckfree(tr);
@@ -566,7 +571,9 @@ exitshell(int status)
 	struct jmploc loc1, loc2;
 	char *p;
 
-	TRACE(("pid %d, exitshell(%d)\n", getpid(), status));
+	CTRACE(DBG_ERRS|DBG_PROCS|DBG_CMDS|DBG_TRAP,
+	    ("pid %d, exitshell(%d)\n", getpid(), status));
+
 	if (setjmp(loc1.loc)) {
 		goto l1;
 	}
@@ -576,13 +583,14 @@ exitshell(int status)
 	handler = &loc1;
 	if ((p = trap[0]) != NULL && *p != '\0') {
 		trap[0] = NULL;
+		VTRACE(DBG_TRAP, ("exit trap: \"%s\"\n", p));
 		evalstring(p, 0);
 	}
-l1:   handler = &loc2;			/* probably unnecessary */
+ l1:	handler = &loc2;			/* probably unnecessary */
 	flushall();
 #if JOBS
 	setjobctl(0);
 #endif
-l2:   _exit(status);
+ l2:	_exit(status);
 	/* NOTREACHED */
 }

Reply via email to