|
DataMuseum.dkPresents historical artifacts from the history of: Commodore CBM-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Commodore CBM-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - download
Length: 590 (0x24e) Types: TextFile Notes: UNIX file Names: »system.c«
└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code └─⟦f4b8d8c84⟧ UNIX Filesystem └─ ⟦this⟧ »libc/gen/system.c«
/* * Call the system to execute a command line * which is passed as an argument. */ #include <stdio.h> #include <signal.h> system(line) char *line; { int status, pid; register wpid; register int (*intfun)(), (*quitfun)(); if ((pid = fork()) < 0) return (-1); if (pid == 0) { /* Child */ execl("/bin/sh", "sh", "-c", line, NULL); exit(0177); } intfun = signal(SIGINT, SIG_IGN); quitfun = signal(SIGQUIT, SIG_IGN); while ((wpid = wait(&status))!=pid && wpid>=0) ; if (wpid < 0) status = wpid; signal(SIGINT, intfun); signal(SIGQUIT, quitfun); return (status); }