X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fmhshowsbr.c;h=68576f66806958c67fcad1f1b5a2584d843d2852;hp=be03d962a73857329a58dc041833e3ca15d142d3;hb=ced6090a330d3d83d0bce709f756aa3d7d65fea4;hpb=337338b404931f06f0db2119c9e145e8ca5a9860 diff --git a/uip/mhshowsbr.c b/uip/mhshowsbr.c index be03d96..68576f6 100644 --- a/uip/mhshowsbr.c +++ b/uip/mhshowsbr.c @@ -1,10 +1,10 @@ /* - * mhshowsbr.c -- routines to display the contents of MIME messages - * - * 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. - */ +** mhshowsbr.c -- routines to display the contents of MIME messages +** +** 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 @@ -24,9 +24,9 @@ #endif /* - * Just use sigjmp/longjmp on older machines that - * don't have sigsetjmp/siglongjmp. - */ +** Just use sigjmp/longjmp on older machines that +** don't have sigsetjmp/siglongjmp. +*/ #ifndef HAVE_SIGSETJMP # define sigjmp_buf jmp_buf # define sigsetjmp(env,mask) setjmp(env) @@ -67,19 +67,20 @@ int list_switch (CT, int, int, int, int); int list_content (CT, int, int, int, int); /* - * prototypes - */ +** prototypes +*/ void show_all_messages (CT *); int show_content_aux (CT, int, int, char *, char *); /* - * static prototypes - */ +** static prototypes +*/ static void show_single_message (CT, char *); static void DisplayMsgHeader (CT, char *); static int show_switch (CT, int, int); static int show_content (CT, int, int); -static int show_content_aux2 (CT, int, int, char *, char *, int, int, int, int, int); +static int show_content_aux2 (CT, int, int, char *, char *, + int, int, int, int, int); static int show_text (CT, int, int); static int show_multi (CT, int, int); static int show_multi_internal (CT, int, int); @@ -91,8 +92,8 @@ static RETSIGTYPE intrser (int); /* - * Top level entry point to show/display a group of messages - */ +** Top level entry point to show/display a group of messages +*/ void show_all_messages (CT *cts) @@ -100,15 +101,15 @@ show_all_messages (CT *cts) CT ct, *ctp; /* - * If form is not specified, then get default form - * for showing headers of MIME messages. - */ + ** If form is not specified, then get default form + ** for showing headers of MIME messages. + */ if (!formsw) formsw = getcpy (etcpath ("mhl.headers")); /* - * If form is "mhl.null", suppress display of header. - */ + ** If form is "mhl.null", suppress display of header. + */ if (!strcmp (formsw, "mhl.null")) formsw = NULL; @@ -123,8 +124,8 @@ show_all_messages (CT *cts) /* - * Entry point to show/display a single message - */ +** Entry point to show/display a single message +*/ static void show_single_message (CT ct, char *form) @@ -137,14 +138,16 @@ show_single_message (CT ct, char *form) int status; #endif - /* Allow user executable bit so that temporary directories created by - * the viewer (e.g., lynx) are going to be accessible */ + /* + ** Allow user executable bit so that temporary directories created by + ** the viewer (e.g., lynx) are going to be accessible + */ umask (ct->c_umask & ~(0100)); /* - * If you have a format file, then display - * the message headers. - */ + ** If you have a format file, then display + ** the message headers. + */ if (form) DisplayMsgHeader(ct, form); else @@ -186,8 +189,8 @@ show_single_message (CT ct, char *form) /* - * Use the mhlproc to show the header fields - */ +** Use the mhlproc to show the header fields +*/ static void DisplayMsgHeader (CT ct, char *form) @@ -204,9 +207,9 @@ DisplayMsgHeader (CT ct, char *form) vec[vecp++] = ct->c_file; /* - * If we've specified -(no)moreproc, - * then just pass that along. - */ + ** If we've specified -(no)moreproc, + ** then just pass that along. + */ if (nomore) { vec[vecp++] = "-nomoreproc"; } else if (progsw) { @@ -240,9 +243,9 @@ DisplayMsgHeader (CT ct, char *form) /* - * Switching routine. Call the correct routine - * based on content type. - */ +** Switching routine. Call the correct routine +** based on content type. +*/ static int show_switch (CT ct, int serial, int alternate) @@ -290,8 +293,8 @@ show_switch (CT ct, int serial, int alternate) /* - * Generic method for displaying content - */ +** Generic method for displaying content +*/ static int show_content (CT ct, int serial, int alternate) @@ -322,8 +325,8 @@ show_content (CT ct, int serial, int alternate) /* - * Parse the display string for displaying generic content - */ +** Parse the display string for displaying generic content +*/ int show_content_aux (CT ct, int serial, int alternate, char *cp, char *cracked) @@ -335,7 +338,8 @@ show_content_aux (CT ct, int serial, int alternate, char *cp, char *cracked) if (!ct->c_ceopenfnx) { if (!alternate) - content_error (NULL, ct, "don't know how to decode content"); + content_error (NULL, ct, + "don't know how to decode content"); return NOTOK; } @@ -374,8 +378,10 @@ show_content_aux (CT ct, int serial, int alternate, char *cp, char *cracked) char **ap, **ep; char *s = ""; - for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++) { - snprintf (bp, buflen, "%s%s=\"%s\"", s, *ap, *ep); + for (ap = ci->ci_attrs, ep = ci->ci_values; + *ap; ap++, ep++) { + snprintf (bp, buflen, "%s%s=\"%s\"", + s, *ap, *ep); len = strlen (bp); bp += len; buflen -= len; @@ -409,11 +415,13 @@ show_content_aux (CT ct, int serial, int alternate, char *cp, char *cracked) case 'f': /* insert filename containing content */ snprintf (bp, buflen, "'%s'", file); - /* since we've quoted the file argument, set things up - * to look past it, to avoid problems with the quoting - * logic below. (I know, I should figure out what's - * broken with the quoting logic, but..) - */ + /* + ** since we've quoted the file argument, + ** set things up to look past it, to avoid + ** problems with the quoting logic below. + ** (I know, I should figure out what's + ** broken with the quoting logic, but..) + */ len = strlen(bp); buflen -= len; bp += len; @@ -426,7 +434,9 @@ show_content_aux (CT ct, int serial, int alternate, char *cp, char *cracked) /* and fall... */ case 'l': - /* display listing prior to displaying content */ + /* + ** display listing prior to displaying content + */ xlist = !nolist; break; @@ -451,7 +461,10 @@ show_content_aux (CT ct, int serial, int alternate, char *cp, char *cracked) /* Did we actually insert something? */ if (bp != pp) { - /* Insert single quote if not inside quotes already */ + /* + ** Insert single quote if not inside quotes + ** already + */ if (!quoted && buflen) { len = strlen (pp); memmove (pp + 1, pp, len); @@ -469,7 +482,10 @@ show_content_aux (CT ct, int serial, int alternate, char *cp, char *cracked) buflen -= 3; bp += 3; } - /* If pp is still set, that means we ran out of space. */ + /* + ** If pp is still set, that means we ran + ** out of space. + */ if (pp) buflen = 0; if (!quoted && buflen) { @@ -490,10 +506,11 @@ raw: } if (buflen <= 0 || (ct->c_termproc && buflen <= strlen(ct->c_termproc))) { - /* content_error would provide a more useful error message - * here, except that if we got overrun, it probably would - * too. - */ + /* + ** content_error would provide a more useful error message + ** here, except that if we got overrun, it probably would + ** too. + */ fprintf(stderr, "Buffer overflow constructing show command!\n"); return NOTOK; } @@ -508,13 +525,13 @@ raw: got_command: return show_content_aux2 (ct, serial, alternate, cracked, buffer, - fd, xlist, xpause, xstdin, xtty); + fd, xlist, xpause, xstdin, xtty); } /* - * Routine to actually display the content - */ +** Routine to actually display the content +*/ static int show_content_aux2 (CT ct, int serial, int alternate, char *cracked, @@ -532,7 +549,8 @@ show_content_aux2 (CT ct, int serial, int alternate, char *cracked, if (ct->c_partno) fprintf (stderr, " part %s", ct->c_partno); if (cracked) - fprintf (stderr, " using command (cd %s; %s)\n", cracked, buffer); + fprintf (stderr, " using command (cd %s; %s)\n", + cracked, buffer); else fprintf (stderr, " using command %s\n", buffer); } @@ -620,8 +638,8 @@ show_content_aux2 (CT ct, int serial, int alternate, char *cracked, /* - * show content of type "text" - */ +** show content of type "text" +*/ static int show_text (CT ct, int serial, int alternate) @@ -641,9 +659,9 @@ show_text (CT ct, int serial, int alternate) return show_content_aux (ct, serial, alternate, cp, NULL); /* - * Use default method if content is text/plain, or if - * if it is not a text part of a multipart/alternative - */ + ** Use default method if content is text/plain, or if + ** if it is not a text part of a multipart/alternative + */ if (!alternate || ct->c_subtype == TEXT_PLAIN) { snprintf (buffer, sizeof(buffer), "%%p%s '%%F'", progsw ? progsw : moreproc && *moreproc ? moreproc : "more"); @@ -656,8 +674,8 @@ show_text (CT ct, int serial, int alternate) /* - * show message body of type "multipart" - */ +** show message body of type "multipart" +*/ static int show_multi (CT ct, int serial, int alternate) @@ -680,10 +698,10 @@ show_multi (CT ct, int serial, int alternate) return show_multi_aux (ct, serial, alternate, cp); /* - * Use default method to display this multipart content - * if it is not a (nested) part of a multipart/alternative, - * or if it is one of the known subtypes of multipart. - */ + ** Use default method to display this multipart content + ** if it is not a (nested) part of a multipart/alternative, + ** or if it is one of the known subtypes of multipart. + */ if (!alternate || ct->c_subtype != MULTI_UNKNOWN) return show_multi_internal (ct, serial, alternate); @@ -692,9 +710,9 @@ show_multi (CT ct, int serial, int alternate) /* - * show message body of subtypes of multipart that - * we understand directly (mixed, alternate, etc...) - */ +** show message body of subtypes of multipart that +** we understand directly (mixed, alternate, etc...) +*/ static int show_multi_internal (CT ct, int serial, int alternate) @@ -716,10 +734,10 @@ show_multi_internal (CT ct, int serial, int alternate) nowserial = serial; } else { /* - * multipart/mixed - * mutlipart/digest - * unknown subtypes of multipart (treat as mixed per rfc2046) - */ + ** multipart/mixed + ** mutlipart/digest + ** unknown subtypes of multipart (treat as mixed per rfc2046) + */ nowserial = serial; } @@ -734,9 +752,9 @@ show_multi_internal (CT ct, int serial, int alternate) } /* - * alternate -> we are a part inside an multipart/alternative - * alternating -> we are a multipart/alternative - */ +** alternate -> we are a part inside an multipart/alternative +** alternating -> we are a multipart/alternative +*/ result = alternate ? NOTOK : OK; @@ -832,9 +850,9 @@ out: /* - * Parse display string for multipart content - * and use external program to display it. - */ +** Parse display string for multipart content +** and use external program to display it. +*/ static int show_multi_aux (CT ct, int serial, int alternate, char *cp) @@ -891,8 +909,10 @@ show_multi_aux (CT ct, int serial, int alternate, char *cp) char **ap, **ep; char *s = ""; - for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++) { - snprintf (bp, buflen, "%s%s=\"%s\"", s, *ap, *ep); + for (ap = ci->ci_attrs, ep = ci->ci_values; + *ap; ap++, ep++) { + snprintf (bp, buflen, "%s%s=\"%s\"", + s, *ap, *ep); len = strlen (bp); bp += len; buflen -= len; @@ -927,7 +947,8 @@ show_multi_aux (CT ct, int serial, int alternate, char *cp) { char *s = ""; - for (part = m->mp_parts; part; part = part->mp_next) { + for (part = m->mp_parts; part; + part = part->mp_next) { p = part->mp_part; snprintf (bp, buflen, "%s'%s'", s, p->c_storage); @@ -936,9 +957,11 @@ show_multi_aux (CT ct, int serial, int alternate, char *cp) buflen -= len; s = " "; } - /* set our starting pointer back to bp, to avoid - * requoting the filenames we just added - */ + /* + ** set our starting pointer back to bp, + ** to avoid requoting the filenames we + ** just added + */ pp = bp; } break; @@ -949,7 +972,9 @@ show_multi_aux (CT ct, int serial, int alternate, char *cp) /* and fall... */ case 'l': - /* display listing prior to displaying content */ + /* + ** display listing prior to displaying content + */ xlist = !nolist; break; @@ -974,7 +999,10 @@ show_multi_aux (CT ct, int serial, int alternate, char *cp) /* Did we actually insert something? */ if (bp != pp) { - /* Insert single quote if not inside quotes already */ + /* + ** Insert single quote if not inside quotes + ** already + */ if (!quoted && buflen) { len = strlen (pp); memmove (pp + 1, pp, len); @@ -992,7 +1020,10 @@ show_multi_aux (CT ct, int serial, int alternate, char *cp) buflen -= 3; bp += 3; } - /* If pp is still set, that means we ran out of space. */ + /* + ** If pp is still set, that means we ran + ** out of space. + */ if (pp) buflen = 0; if (!quoted && buflen) { @@ -1013,10 +1044,11 @@ raw: } if (buflen <= 0 || (ct->c_termproc && buflen <= strlen(ct->c_termproc))) { - /* content_error would provide a more useful error message - * here, except that if we got overrun, it probably would - * too. - */ + /* + ** content_error would provide a more useful error message + ** here, except that if we got overrun, it probably would + ** too. + */ fprintf(stderr, "Buffer overflow constructing show command!\n"); return NOTOK; } @@ -1030,13 +1062,13 @@ raw: } return show_content_aux2 (ct, serial, alternate, NULL, buffer, - NOTOK, xlist, xpause, 0, xtty); + NOTOK, xlist, xpause, 0, xtty); } /* - * show content of type "message/rfc822" - */ +** show content of type "message/rfc822" +*/ static int show_message_rfc822 (CT ct, int serial, int alternate) @@ -1073,8 +1105,8 @@ show_message_rfc822 (CT ct, int serial, int alternate) /* - * Show content of type "message/partial". - */ +** Show content of type "message/partial". +*/ static int show_partial (CT ct, int serial, int alternate) @@ -1086,10 +1118,10 @@ show_partial (CT ct, int serial, int alternate) /* - * Show content of type "message/external". - * - * THE ERROR CHECKING IN THIS ONE IS NOT DONE YET. - */ +** Show content of type "message/external". +** +** THE ERROR CHECKING IN THIS ONE IS NOT DONE YET. +*/ static int show_external (CT ct, int serial, int alternate)