Annotation of 42BSD/lib/libc/gen/system.c, revision 1.1.1.1

1.1       root        1: /* @(#)system.c        4.1 (Berkeley) 12/21/80 */
                      2: #include       <signal.h>
                      3: 
                      4: system(s)
                      5: char *s;
                      6: {
                      7:        int status, pid, w;
                      8:        register int (*istat)(), (*qstat)();
                      9: 
                     10:        if ((pid = vfork()) == 0) {
                     11:                execl("/bin/sh", "sh", "-c", s, 0);
                     12:                _exit(127);
                     13:        }
                     14:        istat = signal(SIGINT, SIG_IGN);
                     15:        qstat = signal(SIGQUIT, SIG_IGN);
                     16:        while ((w = wait(&status)) != pid && w != -1)
                     17:                ;
                     18:        if (w == -1)
                     19:                status = -1;
                     20:        signal(SIGINT, istat);
                     21:        signal(SIGQUIT, qstat);
                     22:        return(status);
                     23: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.