- if ((child_id = fork()) == NOTOK) {
- /* report failure and then send it */
- adios(NULL, "unable to fork");
- } else if (child_id) {
- /* parent process */
- if ((status = pidXwait(child_id, postproc))) {
- fprintf(stderr, "Letter saved in dead.letter\n");
- execl("/bin/mv", "mv", tmpfil, "dead.letter", NULL);
- execl("/usr/bin/mv", "mv", tmpfil, "dead.letter",
- NULL);
- perror("mv");
- _exit(-1);
+ if ((status = execprog(*vec, vec))) {
+ /* spost failed, save draft as dead.letter */
+ int in, out;
+
+ in = open(tmpfil, O_RDONLY);
+ out = creat("dead.letter", 0600);
+ if (in == -1 || out == -1) {
+ fprintf(stderr, "Letter left at %s.\n",
+ tmpfil);
+ /* sysexits.h exit-status from spost */
+ exit(status ? 1 : 0);