different approach, try signal compatibility package
[unix-history] / usr / src / bin / csh / csh.c
index 660bd36..0fc95ac 100644 (file)
@@ -1,4 +1,4 @@
-static char *sccsid = "@(#)csh.c 4.11 %G%";
+static char *sccsid = "@(#)csh.c 4.12 %G%";
 
 #include "sh.h"
 #include <sys/ioctl.h>
 
 #include "sh.h"
 #include <sys/ioctl.h>
@@ -111,7 +111,7 @@ main(c, av)
         * We catch it only if we are the login shell.
         */
        parintr = signal(SIGINT, SIG_IGN);      /* parents interruptibility */
         * We catch it only if we are the login shell.
         */
        parintr = signal(SIGINT, SIG_IGN);      /* parents interruptibility */
-       signal(SIGINT, parintr);                        /* ... restore */
+       sigset(SIGINT, parintr);                        /* ... restore */
        parterm = signal(SIGTERM, SIG_IGN);     /* parents terminability */
        signal(SIGTERM, parterm);                       /* ... restore */
        if (loginsh) {
        parterm = signal(SIGTERM, SIG_IGN);     /* parents terminability */
        signal(SIGTERM, parterm);                       /* ... restore */
        if (loginsh) {
@@ -258,8 +258,8 @@ main(c, av)
                **av = '-';
                if (!quitit)            /* Wary! */
                        signal(SIGQUIT, SIG_IGN);
                **av = '-';
                if (!quitit)            /* Wary! */
                        signal(SIGQUIT, SIG_IGN);
-               sigblock(mask(SIGINT));
-               signal(SIGINT, pintr);
+               sigset(SIGINT, pintr);
+               sighold(SIGINT);
                signal(SIGTERM, SIG_IGN);
                if (quitit == 0 && arginp == 0) {
                        signal(SIGTSTP, SIG_IGN);
                signal(SIGTERM, SIG_IGN);
                if (quitit == 0 && arginp == 0) {
                        signal(SIGTSTP, SIG_IGN);
@@ -283,9 +283,9 @@ retry:
                        if (ioctl(f, TIOCGPGRP, &tpgrp) == 0 && tpgrp != -1) {
                                int ldisc;
                                if (tpgrp != shpgrp) {
                        if (ioctl(f, TIOCGPGRP, &tpgrp) == 0 && tpgrp != -1) {
                                int ldisc;
                                if (tpgrp != shpgrp) {
-                                       int (*old)() = signal(SIGTTIN, SIG_DFL);
+                                       int (*old)() = sigsys(SIGTTIN, SIG_DFL);
                                        kill(0, SIGTTIN);
                                        kill(0, SIGTTIN);
-                                       signal(SIGTTIN, old);
+                                       sigsys(SIGTTIN, old);
                                        goto retry;
                                }
                                if (ioctl(f, TIOCGETD, &oldisc) != 0) 
                                        goto retry;
                                }
                                if (ioctl(f, TIOCGETD, &oldisc) != 0) 
@@ -314,7 +314,7 @@ notty:
        }
        if (setintr == 0 && parintr == SIG_DFL)
                setintr++;
        }
        if (setintr == 0 && parintr == SIG_DFL)
                setintr++;
-       signal(SIGCHLD, pchild);                /* while signals not ready */
+       sigset(SIGCHLD, pchild);                /* while signals not ready */
 
        /*
         * Set an exit here in case of an interrupt or error reading
 
        /*
         * Set an exit here in case of an interrupt or error reading
@@ -488,7 +488,7 @@ srcunit(unit, onlyown, hflg)
        getexit(oldexit);
        reenter = 0;
        if (setintr)
        getexit(oldexit);
        reenter = 0;
        if (setintr)
-               (void) sigblock(mask(SIGINT));
+               sighold(SIGINT);
        setexit();
        reenter++;
        if (reenter == 1) {
        setexit();
        reenter++;
        if (reenter == 1) {
@@ -507,14 +507,14 @@ srcunit(unit, onlyown, hflg)
                 * we let ourselves be interrupted.
                 */
                if (setintr)
                 * we let ourselves be interrupted.
                 */
                if (setintr)
-                       (void) sigrelse(mask(SIGINT));
+                       sigrelse(SIGINT);
 #ifdef TELL
                settell();
 #endif
                process(0);             /* 0 -> blow away on errors */
        }
        if (setintr)
 #ifdef TELL
                settell();
 #endif
                process(0);             /* 0 -> blow away on errors */
        }
        if (setintr)
-               (void) sigrelse(mask(SIGINT));
+               sigrelse(SIGINT);
        if (oSHIN >= 0) {
                register int i;
 
        if (oSHIN >= 0) {
                register int i;
 
@@ -578,7 +578,7 @@ goodbye()
 {
        if (loginsh) {
                signal(SIGQUIT, SIG_IGN);
 {
        if (loginsh) {
                signal(SIGQUIT, SIG_IGN);
-               signal(SIGINT, SIG_IGN);
+               sigset(SIGINT, SIG_IGN);
                signal(SIGTERM, SIG_IGN);
                setintr = 0;            /* No interrupts after "logout" */
                if (adrof("home"))
                signal(SIGTERM, SIG_IGN);
                setintr = 0;            /* No interrupts after "logout" */
                if (adrof("home"))
@@ -628,7 +628,7 @@ pintr1(wantnl)
        register char **v;
 
        if (setintr) {
        register char **v;
 
        if (setintr) {
-               (void) sigrelse(mask(SIGINT));
+               sigrelse(SIGINT);
                if (pjobs) {
                        pjobs = 0;
                        printf("\n");
                if (pjobs) {
                        pjobs = 0;
                        printf("\n");
@@ -637,8 +637,8 @@ pintr1(wantnl)
                }
        }
        if (setintr)
                }
        }
        if (setintr)
-               sigblock(mask(SIGINT));
-       sigrelse(mask(SIGCHLD));
+               sighold(SIGINT);
+       sigrelse(SIGCHLD);
        draino();
 
        /*
        draino();
 
        /*
@@ -693,7 +693,7 @@ process(catch)
                 * Interruptible during interactive reads
                 */
                if (setintr)
                 * Interruptible during interactive reads
                 */
                if (setintr)
-                       (void) sigrelse(mask(SIGINT));
+                       sigrelse(SIGINT);
 
                /*
                 * For the sake of reset()
 
                /*
                 * For the sake of reset()
@@ -771,7 +771,7 @@ process(catch)
                 * The parser may lose space if interrupted.
                 */
                if (setintr)
                 * The parser may lose space if interrupted.
                 */
                if (setintr)
-                       sigblock(mask(SIGINT));
+                       sighold(SIGINT);
 
                /*
                 * Save input text on the history list if 
 
                /*
                 * Save input text on the history list if