Annotation of 41BSD/libc/stdio/system.c, revision 1.1.1.1

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

unix.superglobalmegacorp.com

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