char *new_fs(char *, char *);
int pidwait(pid_t, int);
int pidstatus(int, FILE *, char *);
+int pidXwait(int, char *);
void print_help(char *, struct swit *, int);
void print_sw(char *, struct swit *, char *, FILE *);
void print_version(char *);
** return status;
*/
- /* If child process returned normally */
if (WIFEXITED(status)) {
+ /* child process returned normally */
if ((signum = WEXITSTATUS(status))) {
- if (cp)
+ if (cp) {
fprintf(fp, "%s: ", cp);
+ }
fprintf(fp, "exit %d\n", signum);
}
} else if (WIFSIGNALED(status)) {
- /* If child process terminated due to receipt of a signal */
+ /* child process terminated due to receipt of a signal */
signum = WTERMSIG(status);
- if (signum != SIGINT) {
- if (cp)
- fprintf(fp, "%s: ", cp);
- fprintf(fp, "signal %d", signum);
- if (signum >= 0 && signum < (int)sizeof(sigmsg) &&
- sigmsg[signum] != NULL)
- fprintf(fp, " (%s%s)\n", sigmsg[signum],
- WCOREDUMP(status) ?
- ", core dumped" : "");
- else
- fprintf(fp, "%s\n", WCOREDUMP(status) ?
- " (core dumped)" : "");
+ if (signum == SIGINT) {
+ return status;
+ }
+ if (cp) {
+ fprintf(fp, "%s: ", cp);
+ }
+ fprintf(fp, "signal %d", signum);
+ if (signum >= 0 && signum < (int)sizeof(sigmsg) &&
+ sigmsg[signum] != NULL) {
+ fprintf(fp, " (%s%s)\n", sigmsg[signum],
+ WCOREDUMP(status) ?
+ ", core dumped" : "");
+ } else {
+ fprintf(fp, "%s\n", WCOREDUMP(status) ?
+ " (core dumped)" : "");
}
}
return status;
}
+
+
+int
+pidXwait(int pid, char *cp)
+{
+ return pidstatus(pidwait(pid, -1), stdout, cp);
+}