Mercurial > hg > toybox
comparison lib/xwrap.c @ 1327:85f297591693 draft
Introduce xfork() and make commands use it, and make some WEXITSTATUS() use WIFEXITED() and WTERMSIG()+127.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sat, 31 May 2014 12:33:24 -0500 |
parents | 955169e818d0 |
children | 9fd2bcedbeb5 |
comparison
equal
deleted
inserted
replaced
1326:78a3eaf5555f | 1327:85f297591693 |
---|---|
109 } | 109 } |
110 | 110 |
111 void xflush(void) | 111 void xflush(void) |
112 { | 112 { |
113 if (fflush(stdout) || ferror(stdout)) perror_exit("write");; | 113 if (fflush(stdout) || ferror(stdout)) perror_exit("write");; |
114 } | |
115 | |
116 pid_t xfork(void) | |
117 { | |
118 pid_t pid = fork(); | |
119 | |
120 if (pid < 0) perror_exit("fork"); | |
121 | |
122 return pid; | |
114 } | 123 } |
115 | 124 |
116 // Call xexec with a chunk of optargs, starting at skip. (You can't just | 125 // Call xexec with a chunk of optargs, starting at skip. (You can't just |
117 // call xexec() directly because toy_init() frees optargs.) | 126 // call xexec() directly because toy_init() frees optargs.) |
118 void xexec_optargs(int skip) | 127 void xexec_optargs(int skip) |