X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/685dd439ef0166954c59c3f8a2f6903d0a7cbab9..a1dac9c9d05f7660d30a69bbbaaac34ec6c86e8d:/uip/show.c?ds=inline diff --git a/uip/show.c b/uip/show.c index dc426130..4a53c914 100644 --- a/uip/show.c +++ b/uip/show.c @@ -30,6 +30,11 @@ X("nofmtproc", 0, NFMTPROCSW) \ X("version", 0, VERSIONSW) \ X("help", 0, HELPSW) \ + /* \ + * switches for mhlproc \ + */ \ + X("concat", -6, CONCATSW) \ + X("noconcat", -8, NCONCATSW) \ #define X(sw, minchars, id) id, DEFINE_SWITCH_ENUM(SHOW); @@ -53,7 +58,7 @@ int main (int argc, char **argv) { int draftsw = 0, headersw = 1; - int nshow = 0, checkmime = 1, mime; + int nshow = 0, checkmime = 1, mime = 0; int isdf = 0, mode = SHOW, msgnum; char *cp, *maildir, *file = NULL, *folder = NULL, *proc, *program; char buf[BUFSIZ], **argp, **arguments; @@ -61,17 +66,11 @@ main (int argc, char **argv) struct msgs_array msgs = { 0, 0, NULL }; struct msgs_array vec = { 0, 0, NULL }; -#ifdef LOCALE - setlocale(LC_ALL, ""); -#endif - invo_name = r1bindex (argv[0], '/'); + if (nmh_init(argv[0], 1)) { return 1; } - /* read user profile/context */ - context_read(); - - if (!mh_strcasecmp (invo_name, "next")) { + if (!strcasecmp (invo_name, "next")) { mode = NEXT; - } else if (!mh_strcasecmp (invo_name, "prev")) { + } else if (!strcasecmp (invo_name, "prev")) { mode = PREV; } arguments = getarguments (invo_name, argc, argv, 1); @@ -83,6 +82,13 @@ main (int argc, char **argv) case AMBIGSW: ambigsw (cp, switches); done (1); + + case CONCATSW: + case NCONCATSW: + /* Use showmimeproc if one of these switches was + specified because mhl doesn't understand them. */ + mime = 1; + /* fall thru */ case UNKWNSW: case NPROGSW: case NFMTPROCSW: @@ -191,14 +197,6 @@ usage: goto go_to_it; } -#ifdef WHATNOW - if (!msgs.size && !folder && mode == SHOW && (cp = getenv ("mhdraft")) && *cp) { - draftsw++; - app_msgarg(&vec, cp); - goto go_to_it; - } -#endif /* WHATNOW */ - if (!msgs.size) { switch (mode) { case NEXT: @@ -221,7 +219,7 @@ usage: adios (maildir, "unable to change directory to"); /* read folder and create message structure */ - if (!(mp = folder_read (folder))) + if (!(mp = folder_read (folder, 1))) adios (NULL, "unable to read folder %s", folder); /* check for empty folder */ @@ -263,12 +261,11 @@ go_to_it: ; /* * Decide which "proc" to use */ - mime = 0; if (nshow) { proc = catproc; } else { /* check if any messages are non-text MIME messages */ - if (checkmime) { + if (! mime && checkmime) { if (!draftsw && !file) { /* loop through selected messages and check for MIME */ for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) @@ -346,7 +343,7 @@ is_nontext (char *msgnam) /* * Check Content-Type field */ - if (!mh_strcasecmp (name, TYPE_FIELD)) { + if (!strcasecmp (name, TYPE_FIELD)) { int passno; char c; @@ -402,7 +399,7 @@ invalid: if (!*bp) goto invalid; if (passno > 1) { - if ((result = (mh_strcasecmp (bp, "plain") != 0))) + if ((result = (strcasecmp (bp, "plain") != 0))) goto out; *dp = c; for (dp++; isspace ((unsigned char) *dp); dp++) @@ -434,7 +431,7 @@ invalid: /* Check the character set */ result = !check_charset (dp, strlen (dp)); } else { - if (!(result = (mh_strcasecmp (bp, "text") != 0))) { + if (!(result = (strcasecmp (bp, "text") != 0))) { *dp = c; bp = dp; passno = 2; @@ -454,7 +451,7 @@ out: /* * Check Content-Transfer-Encoding field */ - if (!mh_strcasecmp (name, ENCODING_FIELD)) { + if (!strcasecmp (name, ENCODING_FIELD)) { cp = add (buf, NULL); while (state == FLDPLUS) { bufsz = sizeof buf; @@ -466,9 +463,9 @@ out: for (dp = bp; istoken ((unsigned char) *dp); dp++) continue; *dp = '\0'; - result = (mh_strcasecmp (bp, "7bit") - && mh_strcasecmp (bp, "8bit") - && mh_strcasecmp (bp, "binary")); + result = (strcasecmp (bp, "7bit") + && strcasecmp (bp, "8bit") + && strcasecmp (bp, "binary")); free (cp); if (result) {