Relayouted all switch statements: case aligns with switch.
[mmh] / uip / mhshowsbr.c
index f79d42e..0136ca3 100644 (file)
@@ -200,7 +200,7 @@ DisplayMsgHeader(CT ct, char *form)
        char *vec[8];
 
        vecp = 0;
-       vec[vecp++] = r1bindex(mhlproc, '/');
+       vec[vecp++] = mhbasename(mhlproc);
        vec[vecp++] = "-form";
        vec[vecp++] = form;
        vec[vecp++] = "-nobody";
@@ -251,44 +251,42 @@ static int
 show_switch(CT ct, int serial, int alternate)
 {
        switch (ct->c_type) {
-               case CT_MULTIPART:
-                       return show_multi(ct, serial, alternate);
-                       break;
+       case CT_MULTIPART:
+               return show_multi(ct, serial, alternate);
+               break;
 
-               case CT_MESSAGE:
-                       switch (ct->c_subtype) {
-                               case MESSAGE_PARTIAL:
-                                       return show_partial(ct, serial,
-                                                       alternate);
-                                       break;
+       case CT_MESSAGE:
+               switch (ct->c_subtype) {
+                       case MESSAGE_PARTIAL:
+                               return show_partial(ct, serial, alternate);
+                               break;
 
-                               case MESSAGE_EXTERNAL:
-                                       return show_external(ct, serial,
-                                                       alternate);
-                                       break;
+                       case MESSAGE_EXTERNAL:
+                               return show_external(ct, serial, alternate);
+                               break;
 
-                               case MESSAGE_RFC822:
-                               default:
-                                       return show_message_rfc822(ct, serial,
-                                                       alternate);
-                                       break;
-                       }
-                       break;
+                       case MESSAGE_RFC822:
+                       default:
+                               return show_message_rfc822(ct, serial,
+                                               alternate);
+                               break;
+               }
+               break;
 
-               case CT_TEXT:
-                       return show_text(ct, serial, alternate);
-                       break;
+       case CT_TEXT:
+               return show_text(ct, serial, alternate);
+               break;
 
-               case CT_AUDIO:
-               case CT_IMAGE:
-               case CT_VIDEO:
-               case CT_APPLICATION:
-                       return show_content(ct, serial, alternate);
-                       break;
+       case CT_AUDIO:
+       case CT_IMAGE:
+       case CT_VIDEO:
+       case CT_APPLICATION:
+               return show_content(ct, serial, alternate);
+               break;
 
-               default:
-                       adios(NULL, "unknown content type %d", ct->c_type);
-                       break;
+       default:
+               adios(NULL, "unknown content type %d", ct->c_type);
+               break;
        }
 
        return 0;  /* NOT REACHED */
@@ -377,7 +375,7 @@ show_content_aux(CT ct, int serial, int alternate, char *cp, char *cracked)
                        switch (*++cp) {
                        case 'a':
                                /* insert parameters from Content-Type field */
-                       {
+                               {
                                char **ap, **ep;
                                char *s = "";
 
@@ -390,8 +388,8 @@ show_content_aux(CT ct, int serial, int alternate, char *cp, char *cracked)
                                        buflen -= len;
                                        s = " ";
                                }
-                       }
-                       break;
+                               }
+                               break;
 
                        case 'd':
                                /* insert content description */
@@ -607,35 +605,35 @@ show_content_aux2(CT ct, int serial, int alternate, char *cracked,
        for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++)
                sleep(5);
        switch (child_id) {
-               case NOTOK:
-                       advise("fork", "unable to");
-                       (*ct->c_ceclosefnx) (ct);
-                       return NOTOK;
+       case NOTOK:
+               advise("fork", "unable to");
+               (*ct->c_ceclosefnx) (ct);
+               return NOTOK;
 
-               case OK:
-                       if (cracked)
-                               chdir(cracked);
-                       if (!xstdin)
-                               dup2(fd, 0);
-                       close(fd);
-                       execvp("/bin/sh", vec);
-                       fprintf(stderr, "unable to exec ");
-                       perror("/bin/sh");
-                       _exit(-1);
-                       /* NOTREACHED */
-
-               default:
-                       if (!serial) {
-                               ct->c_pid = child_id;
-                               if (xtty)
-                                       xpid = child_id;
-                       } else {
-                               pidcheck(pidXwait(child_id, NULL));
-                       }
+       case OK:
+               if (cracked)
+                       chdir(cracked);
+               if (!xstdin)
+                       dup2(fd, 0);
+               close(fd);
+               execvp("/bin/sh", vec);
+               fprintf(stderr, "unable to exec ");
+               perror("/bin/sh");
+               _exit(-1);
+               /* NOTREACHED */
 
-                       if (fd != NOTOK)
-                               (*ct->c_ceclosefnx) (ct);
-                       return (alternate ? DONE : OK);
+       default:
+               if (!serial) {
+                       ct->c_pid = child_id;
+                       if (xtty)
+                               xpid = child_id;
+               } else {
+                       pidcheck(pidXwait(child_id, NULL));
+               }
+
+               if (fd != NOTOK)
+                       (*ct->c_ceclosefnx) (ct);
+               return (alternate ? DONE : OK);
        }
 }
 
@@ -669,7 +667,7 @@ show_text(CT ct, int serial, int alternate)
                snprintf(buffer, sizeof(buffer), "%%p%s '%%F'",
                                progsw ? progsw : moreproc && *moreproc ?
                                moreproc : "more");
-               cp = (ct->c_showproc = add(buffer, NULL));
+               cp = (ct->c_showproc = getcpy(buffer));
                return show_content_aux(ct, serial, alternate, cp, NULL);
        }
 
@@ -770,25 +768,25 @@ show_multi_internal(CT ct, int serial, int alternate)
 
                        inneresult = show_switch(p, nowserial, nowalternate);
                        switch (inneresult) {
-                               case NOTOK:
-                                       if (alternate && !alternating) {
-                                               result = NOTOK;
-                                               goto out;
-                                       }
-                                       continue;
-
-                               case OK:
-                               case DONE:
-                                       if (alternating) {
-                                               result = DONE;
-                                               break;
-                                       }
-                                       if (alternate) {
-                                               alternate = nowalternate = 0;
-                                               if (result == NOTOK)
-                                                       result = inneresult;
-                                       }
-                                       continue;
+                       case NOTOK:
+                               if (alternate && !alternating) {
+                                       result = NOTOK;
+                                       goto out;
+                               }
+                               continue;
+
+                       case OK:
+                       case DONE:
+                               if (alternating) {
+                                       result = DONE;
+                                       break;
+                               }
+                               if (alternate) {
+                                       alternate = nowalternate = 0;
+                                       if (result == NOTOK)
+                                               result = inneresult;
+                               }
+                               continue;
                        }
                        break;
                }
@@ -884,7 +882,7 @@ show_multi_aux(CT ct, int serial, int alternate, char *cp)
                                return NOTOK;
 
                        /* I'm not sure if this is necessary? */
-                       p->c_storage = add(file, NULL);
+                       p->c_storage = getcpy(file);
 
                        if (p->c_showproc && !strcmp(p->c_showproc, "true"))
                                return (alternate ? DONE : OK);
@@ -909,7 +907,7 @@ show_multi_aux(CT ct, int serial, int alternate, char *cp)
                        switch (*++cp) {
                        case 'a':
                                /* insert parameters from Content-Type field */
-                       {
+                               {
                                char **ap, **ep;
                                char *s = "";
 
@@ -922,8 +920,8 @@ show_multi_aux(CT ct, int serial, int alternate, char *cp)
                                        buflen -= len;
                                        s = " ";
                                }
-                       }
-                       break;
+                               }
+                               break;
 
                        case 'd':
                                /* insert content description */
@@ -1098,7 +1096,7 @@ show_message_rfc822(CT ct, int serial, int alternate)
 
        /* default method for message/rfc822 */
        if (ct->c_subtype == MESSAGE_RFC822) {
-               cp = (ct->c_showproc = add("%pshow -file '%F'", NULL));
+               cp = (ct->c_showproc = getcpy("%pshow -file '%F'"));
                return show_content_aux(ct, serial, alternate, cp, NULL);
        }