Revision 6952,
335 bytes
checked in by probe, 31 years ago
(diff) |
Initial revision
|
-
Property svn:executable set to
*
|
Rev | Line | |
---|
[6952] | 1 | #include <stdio.h> |
---|
| 2 | main() |
---|
| 3 | { |
---|
| 4 | |
---|
| 5 | int pid, pipefds[2]; |
---|
| 6 | FILE *f; |
---|
| 7 | |
---|
| 8 | pipe(pipefds); |
---|
| 9 | pid = vfork(); |
---|
| 10 | |
---|
| 11 | if (pid == 0) { |
---|
| 12 | dup2(pipefds[0], 0); |
---|
| 13 | execl("/bin/sh", "/bin/sh", "-s", 0); |
---|
| 14 | } else { |
---|
| 15 | f = fdopen(pipefds[1],"w"); |
---|
| 16 | fprintf(f,"/bin/echo testing\n"); |
---|
| 17 | fprintf(f,"kill $$\n"); |
---|
| 18 | fclose(f); |
---|
| 19 | } |
---|
| 20 | |
---|
| 21 | (void) wait(0); |
---|
| 22 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.