which expect to send mail automatically to various
addresses. It was also used by various
.B nmh
-commands to mail various
-error notifications.
+commands to mail various error notifications.
.PP
-When invoked without arguments, it had simply invokes
+When invoked without arguments, it had once simply invoked
.B inc
to incorporate new messages from the user's maildrop.
+It does this no longer.
.SH BUGS
.B mhmail
FILE *fp = NULL;
struct mcomp *c1;
- switch (setjmp(env)) {
- case OK:
+ if (setjmp(env) == 0) {
if (fname) {
fp = fopen(fname, "r");
if (fp == NULL) {
}
SIGNAL(SIGINT, intrser);
mhlfile(fp, fname, ofilen, ofilec);
- /* FALL THROUGH! */
- default:
- SIGNAL(SIGINT, SIG_IGN);
- if (fp != stdin)
- fclose(fp);
- if (holder.c_text) {
- free(holder.c_text);
- holder.c_text = NULL;
- }
- free_queue(&msghd, &msgtl);
- for (c1 = fmthd; c1; c1 = c1->c_next)
- c1->c_flags &= ~HDROUTPUT;
- break;
}
+
+ SIGNAL(SIGINT, SIG_IGN);
+ if (fp != stdin)
+ fclose(fp);
+ if (holder.c_text) {
+ free(holder.c_text);
+ holder.c_text = NULL;
+ }
+ free_queue(&msghd, &msgtl);
+ for (c1 = fmthd; c1; c1 = c1->c_next)
+ c1->c_flags &= ~HDROUTPUT;
}
int
main(int argc, char **argv)
{
- pid_t child_id;
int status, iscc = 0, nvec;
char *cp, *tolist = NULL, *cclist = NULL, *subject = NULL;
char *from = NULL, *body = NULL, **argp, **arguments;
vec[nvec++] = tmpfil;
vec[nvec] = NULL;
- if ((child_id = fork()) == NOTOK) {
- /* report failure and then send it */
- adios(NULL, "unable to fork");
-
- } else if (child_id == 0) {
- /* child process */
- execvp(*vec, vec);
- fprintf(stderr, "unable to exec ");
- perror(*vec);
- _exit(-1);
-
- } else {
- /* parent process */
- if ((status = pidXwait(child_id, *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);
- }
- cpydata(in, out, tmpfil, "dead.letter");
- close(in);
- close(out);
- fprintf(stderr, "Letter saved in dead.letter\n");
+ 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);
}
- unlink(tmpfil);
- /* sysexits.h exit status from spost */
- exit(status ? 1 : 0);
+ cpydata(in, out, tmpfil, "dead.letter");
+ close(in);
+ close(out);
+ fprintf(stderr, "Letter saved in dead.letter\n");
}
-
- return 0; /* dead code to satisfy the compiler */
+ unlink(tmpfil);
+ /* sysexits.h exit status from spost */
+ exit(status ? 1 : 0);
}