Annotation of coherent/b/lib/libc/gen/system.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Call the system to execute a command line
                      3:  * which is passed as an argument.
                      4:  */
                      5: 
                      6: #include <stdio.h>
                      7: #include <signal.h>
                      8: 
                      9: system(line)
                     10: char *line;
                     11: {
                     12:        int status, pid;
                     13:        register wpid;
                     14:        register int (*intfun)(), (*quitfun)();
                     15: 
                     16:        if ((pid = fork()) < 0)
                     17:                return (-1);
                     18:        if (pid == 0) {         /* Child */
                     19:                execl("/bin/sh", "sh", "-c", line, NULL);
                     20:                exit(0177);
                     21:        }
                     22:        intfun = signal(SIGINT, SIG_IGN);
                     23:        quitfun = signal(SIGQUIT, SIG_IGN);
                     24:        while ((wpid = wait(&status))!=pid && wpid>=0)
                     25:                ;
                     26:        if (wpid < 0)
                     27:                status = wpid;
                     28:        signal(SIGINT, intfun);
                     29:        signal(SIGQUIT, quitfun);
                     30:        return (status);
                     31: }

unix.superglobalmegacorp.com

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