Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/sh When we execute commands from a shell script, make su...



details:   https://anonhg.NetBSD.org/src/rev/85448d9cf66a
branches:  trunk
changeset: 467704:85448d9cf66a
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Mar 27 13:46:19 1999 +0000

description:
When we execute commands from a shell script, make sure that the signals
are being caught (reported by Alexis Rosen), similar to the -c case.

#!/bin/sh
vi "$@"

^C when the script is running...

diffstat:

 bin/sh/main.c |  11 +++++++----
 bin/sh/trap.c |   6 +++---
 2 files changed, 10 insertions(+), 7 deletions(-)

diffs (67 lines):

diff -r 372c18c54bc1 -r 85448d9cf66a bin/sh/main.c
--- a/bin/sh/main.c     Sat Mar 27 11:45:07 1999 +0000
+++ b/bin/sh/main.c     Sat Mar 27 13:46:19 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.32 1999/02/05 21:21:27 christos Exp $       */
+/*     $NetBSD: main.c,v 1.33 1999/03/27 13:46:19 christos Exp $       */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -46,7 +46,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c     8.7 (Berkeley) 7/19/95";
 #else
-__RCSID("$NetBSD: main.c,v 1.32 1999/02/05 21:21:27 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.33 1999/03/27 13:46:19 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -193,7 +193,7 @@
        }
 state3:
        state = 4;
-       if (minusc) {
+       if (sflag == 0 || minusc) {
                static int sigs[] =  {
                    SIGINT, SIGQUIT, SIGHUP, 
 #ifdef SIGTSTP
@@ -206,8 +206,11 @@
 
                for (i = 0; i < SIGSSIZE; i++)
                    setsignal(sigs[i]);
+       }
+
+       if (minusc)
                evalstring(minusc);
-       }
+
        if (sflag || minusc == NULL) {
 state4:        /* XXX ??? - why isn't this before the "if" statement */
                cmdloop(1);
diff -r 372c18c54bc1 -r 85448d9cf66a bin/sh/trap.c
--- a/bin/sh/trap.c     Sat Mar 27 11:45:07 1999 +0000
+++ b/bin/sh/trap.c     Sat Mar 27 13:46:19 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.20 1999/02/05 21:21:27 christos Exp $       */
+/*     $NetBSD: trap.c,v 1.21 1999/03/27 13:46:19 christos Exp $       */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)trap.c     8.5 (Berkeley) 6/5/95";
 #else
-__RCSID("$NetBSD: trap.c,v 1.20 1999/02/05 21:21:27 christos Exp $");
+__RCSID("$NetBSD: trap.c,v 1.21 1999/03/27 13:46:19 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -174,7 +174,7 @@
        if (rootshell && action == S_DFL) {
                switch (signo) {
                case SIGINT:
-                       if (iflag || minusc)
+                       if (iflag || minusc || sflag == 0)
                                action = S_CATCH;
                        break;
                case SIGQUIT:



Home | Main Index | Thread Index | Old Index