X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fshow.c;h=0b143fd3079ec3a34622014912dad5c309ca724a;hb=49856d905bfbaf3025967cbfe7631440978bccc8;hp=5ab6370287182be486915eb7a66dff7e57202a11;hpb=1691e80890e5d8ba258c51c214a3e91880e1db2b;p=mmh diff --git a/uip/show.c b/uip/show.c index 5ab6370..0b143fd 100644 --- a/uip/show.c +++ b/uip/show.c @@ -2,11 +2,14 @@ /* * show.c -- show/list messages * - * $Id$ + * This code is Copyright (c) 2002, by the authors of nmh. See the + * COPYRIGHT file in the root directory of the nmh distribution for + * complete copyright information. */ #include #include +#include static struct swit switches[] = { #define CHECKMIMESW 0 @@ -37,9 +40,13 @@ static struct swit switches[] = { { "draft", 0 }, #define FILESW 13 { "file file", -4 }, /* interface from showfile */ -#define VERSIONSW 14 +#define FMTPROCSW 14 + { "fmtproc program", 0 }, +#define NFMTPROCSW 15 + { "nofmtproc", 0 }, +#define VERSIONSW 16 { "version", 0 }, -#define HELPSW 15 +#define HELPSW 17 { "help", 0 }, { NULL, 0 } }; @@ -63,7 +70,7 @@ main (int argc, char **argv) char *cp, *maildir, *file = NULL, *folder = NULL, *proc; char buf[BUFSIZ], **argp, **arguments; char *msgs[MAXARGS], *vec[MAXARGS]; - struct msgs *mp; + struct msgs *mp = NULL; #ifdef LOCALE setlocale(LC_ALL, ""); @@ -73,9 +80,9 @@ main (int argc, char **argv) /* read user profile/context */ context_read(); - if (!strcasecmp (invo_name, "next")) { + if (!mh_strcasecmp (invo_name, "next")) { mode = NEXT; - } else if (!strcasecmp (invo_name, "prev")) { + } else if (!mh_strcasecmp (invo_name, "prev")) { mode = PREV; } arguments = getarguments (invo_name, argc, argv, 1); @@ -89,6 +96,7 @@ main (int argc, char **argv) done (1); case UNKWNSW: case NPROGSW: + case NFMTPROCSW: vec[vecp++] = --cp; continue; @@ -97,10 +105,10 @@ main (int argc, char **argv) "%s [+folder] %s[switches] [switches for showproc]", invo_name, mode == SHOW ? "[msgs] ": ""); print_help (buf, switches, 1); - done (1); + done (0); case VERSIONSW: print_version(invo_name); - done (1); + done (0); case DRFTSW: if (file) @@ -139,6 +147,7 @@ usage: case PROGSW: case LENSW: case WIDTHSW: + case FMTPROCSW: vec[vecp++] = --cp; if (!(cp = *argp++) || *cp == '-') adios (NULL, "missing argument to %s", argp[-2]); @@ -171,7 +180,7 @@ usage: if (folder) adios (NULL, "only one folder at a time!"); else - folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF); + folder = pluspath (cp); } else { if (mode != SHOW) goto usage; @@ -275,7 +284,7 @@ go_to_it: ; proc = catproc; } else { /* check if any messages are non-text MIME messages */ - if (checkmime && !getenv ("NOMHNPROC")) { + if (checkmime) { if (!draftsw && !file) { /* loop through selected messages and check for MIME */ for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) @@ -315,6 +324,14 @@ go_to_it: ; vec[vecp] = NULL; } + /* If the "proc" is "mhshow", add "-file" if showing file or draft. + */ + if (strcmp (r1bindex (proc, '/'), "mhshow") == 0 && (draftsw || file) ) { + vec[vecp] = vec[vecp - 1]; + vec[vecp - 1] = "-file"; + vec[++vecp] = NULL; + } + /* * If "proc" is mhl, then run it internally * rather than exec'ing it. @@ -345,19 +362,7 @@ go_to_it: ; vec[0] = r1bindex (proc, '/'); execvp (proc, vec); adios (proc, "unable to exec"); -} - -/* - * Cheat: we are loaded with adrparse, which wants a routine called - * OfficialName(). We call adrparse:getm() with the correct arguments - * to prevent OfficialName() from being called. Hence, the following - * is to keep the loader happy. - */ - -char * -OfficialName (char *name) -{ - return name; + return 0; /* dead code to satisfy the compiler */ } @@ -368,7 +373,8 @@ static int is_nontext (char *msgnam) { int result, state; - char *bp, *cp, *dp; + unsigned char *bp, *dp; + char *cp; char buf[BUFSIZ], name[NAMESZ]; FILE *fp; @@ -383,7 +389,7 @@ is_nontext (char *msgnam) /* * Check Content-Type field */ - if (!strcasecmp (name, TYPE_FIELD)) { + if (!mh_strcasecmp (name, TYPE_FIELD)) { int passno; char c; @@ -438,7 +444,7 @@ invalid: if (!*bp) goto invalid; if (passno > 1) { - if ((result = (strcasecmp (bp, "plain") != 0))) + if ((result = (mh_strcasecmp (bp, "plain") != 0))) goto out; *dp = c; for (dp++; isspace (*dp); dp++) @@ -458,7 +464,7 @@ invalid: *bp = '\0'; } else { for (bp = dp; *bp; bp++) - if (isspace (*bp)) { + if (!istoken (*bp)) { *bp = '\0'; break; } @@ -470,7 +476,7 @@ invalid: /* Check the character set */ result = !check_charset (dp, strlen (dp)); } else { - if (!(result = (strcasecmp (bp, "text") != 0))) { + if (!(result = (mh_strcasecmp (bp, "text") != 0))) { *dp = c; bp = dp; passno = 2; @@ -489,7 +495,7 @@ out: /* * Check Content-Transfer-Encoding field */ - if (!strcasecmp (name, ENCODING_FIELD)) { + if (!mh_strcasecmp (name, ENCODING_FIELD)) { cp = add (buf, NULL); while (state == FLDPLUS) { state = m_getfld (state, name, buf, sizeof(buf), fp); @@ -500,9 +506,9 @@ out: for (dp = bp; istoken (*dp); dp++) continue; *dp = '\0'; - result = (strcasecmp (bp, "7bit") - && strcasecmp (bp, "8bit") - && strcasecmp (bp, "binary")); + result = (mh_strcasecmp (bp, "7bit") + && mh_strcasecmp (bp, "8bit") + && mh_strcasecmp (bp, "binary")); free (cp); if (result) {