X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fsend.c;h=51661a5284504091d13551f7ff1fce566f8c0b25;hp=c85ac8e52c74f3b5882eeb3035cbb5c83b168426;hb=5b92ee6942b9b466914f5faa5fa4c00a2ebc6d35;hpb=3caf9e298a8861729ca8b8a84f57022b6f3ea742 diff --git a/uip/send.c b/uip/send.c index c85ac8e..51661a5 100644 --- a/uip/send.c +++ b/uip/send.c @@ -67,33 +67,25 @@ static struct swit switches[] = { { "alias aliasfile", 0 }, #define DEBUGSW 1 { "debug", -5 }, -#define FILTSW 2 - { "filter filterfile", 0 }, -#define NFILTSW 3 - { "nofilter", 0 }, -#define FRMTSW 4 - { "format", 0 }, -#define NFRMTSW 5 - { "noformat", 0 }, -#define FORWSW 6 +#define FORWSW 2 { "forward", 0 }, -#define NFORWSW 7 +#define NFORWSW 3 { "noforward", 0 }, -#define PUSHSW 8 +#define PUSHSW 4 { "push", 0 }, -#define NPUSHSW 9 +#define NPUSHSW 5 { "nopush", 0 }, -#define VERBSW 10 +#define VERBSW 6 { "verbose", 0 }, -#define NVERBSW 11 +#define NVERBSW 7 { "noverbose", 0 }, -#define WATCSW 12 +#define WATCSW 8 { "watch", 0 }, -#define NWATCSW 13 +#define NWATCSW 9 { "nowatch", 0 }, -#define VERSIONSW 14 +#define VERSIONSW 10 { "version", 0 }, -#define HELPSW 15 +#define HELPSW 11 { "help", 0 }, { NULL, 0 } }; @@ -172,16 +164,12 @@ main(int argc, char **argv) case DEBUGSW: debugsw++; /* fall */ - case NFILTSW: - case FRMTSW: - case NFRMTSW: case WATCSW: case NWATCSW: vec[vecp++] = --cp; continue; case ALIASW: - case FILTSW: vec[vecp++] = --cp; if (!(cp = *argp++) || *cp == '-') { adios(NULL, "missing argument to %s", @@ -264,27 +252,17 @@ main(int argc, char **argv) if ((cp = getenv("mhdist")) && *cp && (distsw = atoi(cp)) && altmsg) { vec[vecp++] = "-dist"; - distfile = getcpy(m_mktemp2(altmsg, invo_name, NULL, NULL)); - if (link(altmsg, distfile) == NOTOK) { - if (errno != EXDEV) { - adios(distfile, "unable to link %s to", - altmsg); - } - free(distfile); - distfile = getcpy(m_mktemp2(NULL, invo_name, - NULL, NULL)); - if ((in = open(altmsg, O_RDONLY)) == NOTOK) { - adios(altmsg, "unable to open"); - } - fstat(in, &st2); - if ((out = creat(distfile, (int)st2.st_mode & 0777)) == - NOTOK) { - adios(distfile, "unable to write"); - } - cpydata(in, out, altmsg, distfile); - close(in); - close(out); + if ((in = open(altmsg, O_RDONLY)) == NOTOK) { + adios(altmsg, "unable to open for reading"); } + fstat(in, &st2); + distfile = getcpy(m_mktemp2(NULL, invo_name, NULL, NULL)); + if ((out = creat(distfile, (int)st2.st_mode & 0777))==NOTOK) { + adios(distfile, "unable to open for writing"); + } + cpydata(in, out, altmsg, distfile); + close(in); + close(out); } else { distfile = NULL; } @@ -507,7 +485,7 @@ attach(char *draft_file_name) fclose(body_file); /* Add a mhbuild MIME composition file line for the body */ - /* charset will be discovered/guessed by buildmimeproc */ + /* charset will be discovered/guessed by mhbuild */ fprintf(composition_file, "#text/plain %s\n", body_file_name); } @@ -534,12 +512,8 @@ attach(char *draft_file_name) } fclose(composition_file); - /* - ** We're ready to roll! Run mhbuild on the composition file. - ** Note that mhbuild is in the context as buildmimeproc. - */ - sprintf(buf, "%s %s", buildmimeproc, composition_file_name); - + /* We're ready to roll! */ + sprintf(buf, "mhbuild %s", composition_file_name); if (system(buf) != 0) { /* some problem */ clean_up_temporary_files(); @@ -643,7 +617,7 @@ static int sendaux(char **vec, int vecp, char *drft, struct stat *st) { pid_t child_id; - int i, status, fd; + int status, fd; char backup[BUFSIZ]; /* @@ -658,10 +632,7 @@ sendaux(char **vec, int vecp, char *drft, struct stat *st) } vec[vecp] = NULL; - for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++) { - sleep(5); - } - switch (child_id) { + switch (child_id = fork()) { case -1: /* oops -- fork error */ adios("fork", "unable to"); @@ -720,20 +691,16 @@ sendaux(char **vec, int vecp, char *drft, struct stat *st) /* ** Mail error notification (and possibly a copy of the -** message) back to the user, using the mailproc +** message) back to the user, using mhmail(1). */ static void alert(char *file, int out) { pid_t child_id; - int i, in; + int in; char buf[BUFSIZ]; - for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++) { - sleep(5); - } - - switch (child_id) { + switch (child_id = fork()) { case NOTOK: /* oops -- fork error */ advise("fork", "unable to"); @@ -768,11 +735,10 @@ alert(char *file, int out) /* create subject for error notification */ snprintf(buf, sizeof(buf), "send failed on %s", forwsw ? "enclosed draft" : file); - - execlp(mailproc, mhbasename(mailproc), getusername(), + execlp("mhmail", "mhmail", getusername(), "-subject", buf, NULL); fprintf(stderr, "unable to exec "); - perror(mailproc); + perror("mhmail"); _exit(-1); default: /* no waiting... */