X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fmhparse.c;h=ece4e8fe6dfae7ad84588b3d39dd92548552b461;hp=1ac7ea9a1f34767a170a6aff3e0c557582b1cced;hb=5b92ee6942b9b466914f5faa5fa4c00a2ebc6d35;hpb=40821f5c1316e9205a08375e7075909cc9968e7d diff --git a/uip/mhparse.c b/uip/mhparse.c index 1ac7ea9..ece4e8f 100644 --- a/uip/mhparse.c +++ b/uip/mhparse.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -89,9 +88,6 @@ struct k2v SubApplication[] = { }; -/* ftpsbr.c */ -int ftp_get(char *, char *, char *, char *, char *, char *, int, int); - /* mhcachesbr.c */ int find_cache(CT, int, int *, char *, char *, int); @@ -199,7 +195,7 @@ parse_mime(char *file) /* ** Check if file is actually standard input */ - if ((is_stdin = !(strcmp(file, "-")))) { + if ((is_stdin = (strcmp(file, "-")==0))) { char *tfile = m_mktemp2(NULL, invo_name, NULL, &fp); if (tfile == NULL) { advise("mhparse", "unable to create temporary file"); @@ -1197,7 +1193,7 @@ InitMultiPart(CT ct) if (buffer[0] != '-' || buffer[1] != '-') continue; if (inout) { - if (strcmp(buffer + 2, m->mp_start)) + if (strcmp(buffer + 2, m->mp_start)!=0) continue; next_part: if ((part = (struct part *) calloc(1, sizeof(*part))) @@ -2476,6 +2472,8 @@ openFTP(CT ct, char **file) CE ce; static char *username = NULL; static char *password = NULL; + int child_id, vecp; + char *vec[9]; e = ct->c_ctexbody; ce = ct->c_cefile; @@ -2483,10 +2481,8 @@ openFTP(CT ct, char **file) if ((ftp = context_find(nmhaccessftp)) && !*ftp) ftp = NULL; -#ifndef BUILTIN_FTP if (!ftp) return NOTOK; -#endif switch (openExternal(e->eb_parent, e->eb_content, ce, file, &fd)) { case NOTOK: @@ -2587,61 +2583,42 @@ openFTP(CT ct, char **file) return NOTOK; } -#ifdef BUILTIN_FTP - if (ftp) -#endif - { - int child_id, i, vecp; - char *vec[9]; - - vecp = 0; - vec[vecp++] = mhbasename(ftp); - vec[vecp++] = e->eb_site; - vec[vecp++] = user; - vec[vecp++] = pass; - vec[vecp++] = e->eb_dir; - vec[vecp++] = e->eb_name; - vec[vecp++] = ce->ce_file, - vec[vecp++] = e->eb_mode && - !mh_strcasecmp(e->eb_mode, "ascii") ? - "ascii" : "binary"; - vec[vecp] = NULL; - - fflush(stdout); - - for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++) - sleep(5); - switch (child_id) { - case NOTOK: - adios("fork", "unable to"); - /* NOTREACHED */ + vecp = 0; + vec[vecp++] = mhbasename(ftp); + vec[vecp++] = e->eb_site; + vec[vecp++] = user; + vec[vecp++] = pass; + vec[vecp++] = e->eb_dir; + vec[vecp++] = e->eb_name; + vec[vecp++] = ce->ce_file, + vec[vecp++] = e->eb_mode && + !mh_strcasecmp(e->eb_mode, "ascii") ? + "ascii" : "binary"; + vec[vecp] = NULL; - case OK: - close(fileno(ce->ce_fp)); - execvp(ftp, vec); - fprintf(stderr, "unable to exec "); - perror(ftp); - _exit(-1); - /* NOTREACHED */ + fflush(stdout); - default: - if (pidXwait(child_id, NULL)) { -#ifdef BUILTIN_FTP -losing_ftp: -#endif - username = password = NULL; - ce->ce_unlink = 1; - return NOTOK; - } - break; + switch (child_id = fork()) { + case NOTOK: + adios("fork", "unable to"); + /* NOTREACHED */ + + case OK: + close(fileno(ce->ce_fp)); + execvp(ftp, vec); + fprintf(stderr, "unable to exec "); + perror(ftp); + _exit(-1); + /* NOTREACHED */ + + default: + if (pidXwait(child_id, NULL)) { + username = password = NULL; + ce->ce_unlink = 1; + return NOTOK; } + break; } -#ifdef BUILTIN_FTP - else if (ftp_get(e->eb_site, user, pass, e->eb_dir, e->eb_name, - ce->ce_file, e->eb_mode && !mh_strcasecmp(e->eb_mode, - "ascii"), 0) == NOTOK) - goto losing_ftp; -#endif if (cachefile[0]) { if (caching) @@ -2695,7 +2672,7 @@ InitMail(CT ct) static int openMail(CT ct, char **file) { - int child_id, fd, i, vecp; + int child_id, fd, vecp; int len, buflen; char *bp, buffer[BUFSIZ], *vec[7]; struct exbody *e = ct->c_ctexbody; @@ -2747,7 +2724,7 @@ openMail(CT ct, char **file) return NOTOK; vecp = 0; - vec[vecp++] = mhbasename(mailproc); + vec[vecp++] = "mhmail"; vec[vecp++] = e->eb_server; vec[vecp++] = "-subject"; vec[vecp++] = e->eb_subject ? e->eb_subject : "mail-server request"; @@ -2755,17 +2732,15 @@ openMail(CT ct, char **file) vec[vecp++] = e->eb_body; vec[vecp] = NULL; - for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++) - sleep(5); - switch (child_id) { + switch (child_id = fork()) { case NOTOK: advise("fork", "unable to"); return NOTOK; case OK: - execvp(mailproc, vec); + execvp(*vec, vec); fprintf(stderr, "unable to exec "); - perror(mailproc); + perror(*vec); _exit(-1); /* NOTREACHED */