Relayouted all switch statements: case aligns with switch.
authormarkus schnalke <meillo@marmaro.de>
Tue, 3 Jan 2012 05:16:30 +0000 (06:16 +0100)
committermarkus schnalke <meillo@marmaro.de>
Tue, 3 Jan 2012 05:16:30 +0000 (06:16 +0100)
Desired style is:
switch (n) {
case foo:
...
}

61 files changed:
sbr/addrsbr.c
sbr/context_save.c
sbr/cpydgst.c
sbr/fmt_new.c
sbr/fmt_scan.c
sbr/folder_read.c
sbr/getans.c
sbr/m_getfld.c
sbr/mf.c
sbr/mts.c
sbr/push.c
sbr/readconfig.c
sbr/refile.c
sbr/seq_read.c
uip/ali.c
uip/aliasbr.c
uip/anno.c
uip/annosbr.c
uip/ap.c
uip/burst.c
uip/comp.c
uip/conflict.c
uip/dist.c
uip/distsbr.c
uip/dp.c
uip/dropsbr.c
uip/fmtdump.c
uip/folder.c
uip/forw.c
uip/ftpsbr.c
uip/mhcachesbr.c
uip/mhfree.c
uip/mhlistsbr.c
uip/mhlsbr.c
uip/mhmail.c
uip/mhoutsbr.c
uip/mhparam.c
uip/mhparse.c
uip/mhpath.c
uip/mhshowsbr.c
uip/mhstoresbr.c
uip/msgchk.c
uip/new.c
uip/packf.c
uip/picksbr.c
uip/prompter.c
uip/rcvdist.c
uip/rcvpack.c
uip/rcvtty.c
uip/repl.c
uip/replsbr.c
uip/rmf.c
uip/scan.c
uip/scansbr.c
uip/send.c
uip/sendsbr.c
uip/show.c
uip/slocal.c
uip/spost.c
uip/viamail.c
uip/whatnowsbr.c

index 77b6baa..4cc0006 100644 (file)
@@ -377,23 +377,23 @@ ismymbox(struct mailname *np)
                return 0;
 
        switch (np->m_type) {
-               case NETHOST:
-                       len = strlen(cp = LocalName());
-                       if (!uprf(np->m_host, cp) || np->m_host[len] != '.')
-                               break;
-                       goto local_test;
-
-               case UUCPHOST:
-                       if (mh_strcasecmp(np->m_host, SystemName()))
-                               break;  /* fall */
-               case LOCALHOST:
-local_test: ;
-                       if (!mh_strcasecmp(np->m_mbox, mq.m_mbox))
-                               return 1;
+       case NETHOST:
+               len = strlen(cp = LocalName());
+               if (!uprf(np->m_host, cp) || np->m_host[len] != '.')
                        break;
+               goto local_test;
 
-               default:
-                       break;
+       case UUCPHOST:
+               if (mh_strcasecmp(np->m_host, SystemName()))
+                       break;  /* fall */
+       case LOCALHOST:
+local_test: ;
+               if (!mh_strcasecmp(np->m_mbox, mq.m_mbox))
+                       return 1;
+               break;
+
+       default:
+               break;
        }
 
        /*
@@ -408,22 +408,22 @@ local_test: ;
                        < (i = strlen(pp = mp->m_mbox)))
                        continue;
                switch (mp->m_type & W_MBOX) {
-                       case W_NIL:
-                               if (mh_strcasecmp(cp, pp))
-                                       continue;
-                               break;
-                       case W_MBEG:
-                               if (mh_strcasecmp(cp + len - i, pp))
-                                       continue;
-                               break;
-                       case W_MEND:
-                               if (!uprf(cp, pp))
-                                       continue;
-                               break;
-                       case W_MBEG | W_MEND:
-                               if (stringdex(pp, cp) < 0)
-                                       continue;
-                               break;
+               case W_NIL:
+                       if (mh_strcasecmp(cp, pp))
+                               continue;
+                       break;
+               case W_MBEG:
+                       if (mh_strcasecmp(cp + len - i, pp))
+                               continue;
+                       break;
+               case W_MEND:
+                       if (!uprf(cp, pp))
+                               continue;
+                       break;
+               case W_MBEG | W_MEND:
+                       if (stringdex(pp, cp) < 0)
+                               continue;
+                       break;
                }
 
                if (mp->m_nohost)
@@ -434,22 +434,22 @@ local_test: ;
                        < (i = strlen(pp = mp->m_host)))
                        continue;
                switch (mp->m_type & W_HOST) {
-                       case W_NIL:
-                               if (mh_strcasecmp(cp, pp))
-                                       continue;
-                               break;
-                       case W_HBEG:
-                               if (mh_strcasecmp (cp + len - i, pp))
-                                       continue;
-                               break;
-                       case W_HEND:
-                               if (!uprf(cp, pp))
-                                       continue;
-                               break;
-                       case W_HBEG | W_HEND:
-                               if (stringdex(pp, cp) < 0)
-                                       continue;
-                               break;
+               case W_NIL:
+                       if (mh_strcasecmp(cp, pp))
+                               continue;
+                       break;
+               case W_HBEG:
+                       if (mh_strcasecmp (cp + len - i, pp))
+                               continue;
+                       break;
+               case W_HEND:
+                       if (!uprf(cp, pp))
+                               continue;
+                       break;
+               case W_HBEG | W_HEND:
+                       if (stringdex(pp, cp) < 0)
+                               continue;
+                       break;
                }
                return 1;
        }
index e62aca8..44542b5 100644 (file)
@@ -78,17 +78,17 @@ m_chkids(void)
                sleep(5);
 
        switch (pid) {
-               case -1:
-                       break;
+       case -1:
+               break;
 
-               case 0:
-                       setgid(getgid());
-                       setuid(getuid());
-                       break;
+       case 0:
+               setgid(getgid());
+               setuid(getuid());
+               break;
 
-               default:
-                       pidwait(pid, -1);
-                       break;
+       default:
+               pidwait(pid, -1);
+               break;
        }
 
        return pid;
index 86211cf..b788fef 100644 (file)
@@ -45,18 +45,18 @@ cpydgst(int in, int out, char *ifile, char *ofile)
                        if (*cp == '\0')
                                continue;
                        switch (state) {
-                               case S1:
-                                       if (*cp == '-') {
-                                               output('-');
-                                               output(' ');
-                                       }
-                                       state = S2;  /* fall */
+                       case S1:
+                               if (*cp == '-') {
+                                       output('-');
+                                       output(' ');
+                               }
+                               state = S2;  /* fall */
 
-                               case S2:
-                                       output(*cp);
-                                       if (*cp == '\n')
-                                               state = S1;
-                                       break;
+                       case S2:
+                               output(*cp);
+                               if (*cp == '\n')
+                                       state = S1;
+                               break;
                        }
                }
 
index 4e56378..c7c519f 100644 (file)
@@ -71,34 +71,34 @@ normalize(char *cp)
                        *dp++ = *cp;
                } else {
                        switch (*++cp) {
-                               case 'b':
-                                       *dp++ = '\b';
-                                       break;
-
-                               case 'f':
-                                       *dp++ = '\f';
-                                       break;
-
-                               case 'n':
-                                       *dp++ = '\n';
-                                       break;
-
-                               case 'r':
-                                       *dp++ = '\r';
-                                       break;
-
-                               case 't':
-                                       *dp++ = '\t';
-                                       break;
-
-                               case '\n':
-                                       break;
-
-                               case 0:
-                                       cp--;  /* fall */
-                               default:
-                                       *dp++ = *cp;
-                                       break;
+                       case 'b':
+                               *dp++ = '\b';
+                               break;
+
+                       case 'f':
+                               *dp++ = '\f';
+                               break;
+
+                       case 'n':
+                               *dp++ = '\n';
+                               break;
+
+                       case 'r':
+                               *dp++ = '\r';
+                               break;
+
+                       case 't':
+                               *dp++ = '\t';
+                               break;
+
+                       case '\n':
+                               break;
+
+                       case 0:
+                               cp--;  /* fall */
+                       default:
+                               *dp++ = *cp;
+                               break;
                        }
                }
        }
index ac98883..4f9bce0 100644 (file)
@@ -622,12 +622,12 @@ fmt_scan(struct format *format, char *scanl, int width, int *dat)
                        if (!(((tws = fmt->f_comp->c_tws)->tw_flags) & (TW_SEXP|TW_SIMP)))
                                set_dotw(tws);
                        switch (fmt->f_comp->c_tws->tw_flags & TW_SDAY) {
-                               case TW_SEXP:
-                                       value = 1; break;
-                               case TW_SIMP:
-                                       value = 0; break;
-                               default:
-                                       value = -1; break;
+                       case TW_SEXP:
+                               value = 1; break;
+                       case TW_SIMP:
+                               value = 0; break;
+                       default:
+                               value = -1; break;
                        }
                case FT_LV_ZONEF:
                        if ((fmt->f_comp->c_tws->tw_flags & TW_SZONE) == TW_SZEXP)
@@ -740,18 +740,18 @@ fmt_scan(struct format *format, char *scanl, int width, int *dat)
 
                                while ( str[n] != '\0') {
                                        switch ( str[n] ) {
-                                               case '\\':
-                                                       n++;
-                                                       if ( str[n] != '\0')
-                                                               buffer2[m++] = str[n++];
-                                                       break;
-                                               case '"':
-                                                       n++;
-                                                       break;
-                                               default:
+                                       case '\\':
+                                               n++;
+                                               if ( str[n] != '\0')
                                                        buffer2[m++] = str[n++];
-                                                       break;
-                                               }
+                                               break;
+                                       case '"':
+                                               n++;
+                                               break;
+                                       default:
+                                               buffer2[m++] = str[n++];
+                                               break;
+                                       }
                                }
                                buffer2[m] = '\0';
                                str = buffer2;
index c28b430..cdbf344 100644 (file)
@@ -99,31 +99,32 @@ folder_read(char *name)
 
                } else {
                        switch (dp->d_name[0]) {
-                               case '.':
-                               case ',':
+                       case '.':
+                       case ',':
 #ifdef MHE
-                               case '+':
+                       case '+':
 #endif /* MHE */
+                               continue;
+
+                       default:
+                               /*
+                               ** skip any files beginning with
+                               ** backup prefix
+                               */
+                               if (!strncmp(dp->d_name, backup_prefix,
+                                               prefix_len))
                                        continue;
 
-                               default:
-                                       /*
-                                       ** skip any files beginning with
-                                       ** backup prefix
-                                       */
-                                       if (!strncmp(dp->d_name, backup_prefix, prefix_len))
-                                               continue;
-
-                                       /* skip the altmsg link file */
-                                       if (!strcmp(dp->d_name, altmsglink))
-                                               continue;
-
-                                       /*
-                                       ** indicate that there are other
-                                       ** files in folder
-                                       */
-                                       set_other_files(mp);
+                               /* skip the altmsg link file */
+                               if (!strcmp(dp->d_name, altmsglink))
                                        continue;
+
+                               /*
+                               ** indicate that there are other
+                               ** files in folder
+                               */
+                               set_other_files(mp);
+                               continue;
                        }
                }
        }
index 919fd32..af882d5 100644 (file)
@@ -52,15 +52,15 @@ getans(char *prompt, struct swit *ansp)
                }
                cpp = brkstring(ansbuf, " ", NULL);
                switch (smatch(*cpp, ansp)) {
-                       case AMBIGSW:
-                               ambigsw(*cpp, ansp);
-                               continue;
-                       case UNKWNSW:
-                               printf(" -%s unknown. Hit <CR> for help.\n", *cpp);
-                               continue;
-                       default:
-                               SIGNAL(SIGINT, istat);
-                               return cpp;
+               case AMBIGSW:
+                       ambigsw(*cpp, ansp);
+                       continue;
+               case UNKWNSW:
+                       printf(" -%s unknown. Hit <CR> for help.\n", *cpp);
+                       continue;
+               default:
+                       SIGNAL(SIGINT, istat);
+                       return cpp;
                }
        }
 }
index 586876a..db509fc 100644 (file)
@@ -231,403 +231,384 @@ m_getfld(int state, unsigned char *name, unsigned char *buf,
        }
 
        switch (state) {
-               case FLDEOF:
-               case BODYEOF:
-               case FLD:
-                       if (c == '\n' || c == '-') {
-                               /* we hit the header/body separator */
-                               while (c != '\n' && (c = getc(iob)) >= 0)
-                                       ;
-
-                               if (c < 0 || (c = getc(iob)) < 0 || eom(c, iob)) {
-                                       if (! eom_action) {
-                                               /* flush null messages */
-                                               while ((c = getc(iob)) >= 0 && eom(c, iob))
-                                                       ;
-                                               if (c >= 0)
-                                                       ungetc(c, iob);
-                                       }
-                                       msg_count = 0;
-                                       *buf = 0;
-                                       return FILEEOF;
+       case FLDEOF:
+       case BODYEOF:
+       case FLD:
+               if (c == '\n' || c == '-') {
+                       /* we hit the header/body separator */
+                       while (c != '\n' && (c = getc(iob)) >= 0)
+                               ;
+
+                       if (c < 0 || (c = getc(iob)) < 0 || eom(c, iob)) {
+                               if (! eom_action) {
+                                       /* flush null messages */
+                                       while ((c = getc(iob)) >= 0 && eom(c, iob))
+                                               ;
+                                       if (c >= 0)
+                                               ungetc(c, iob);
                                }
-                               state = BODY;
-                               goto body;
+                               msg_count = 0;
+                               *buf = 0;
+                               return FILEEOF;
                        }
-                       /*
-                       ** get the name of this component.  take characters up
-                       ** to a ':', a newline or NAMESZ-1 characters,
-                       ** whichever comes first.
-                       */
-                       cp = name;
-                       i = NAMESZ - 1;
-                       for (;;) {
+                       state = BODY;
+                       goto body;
+               }
+               /*
+               ** get the name of this component.  take characters up
+               ** to a ':', a newline or NAMESZ-1 characters,
+               ** whichever comes first.
+               */
+               cp = name;
+               i = NAMESZ - 1;
+               for (;;) {
 #ifdef LINUX_STDIO
-                               bp = sp = (unsigned char *) iob->_IO_read_ptr - 1;
-                               j = (cnt = ((long) iob->_IO_read_end -
-                                       (long) iob->_IO_read_ptr)  + 1) < i ? cnt : i;
+                       bp = sp = (unsigned char *) iob->_IO_read_ptr - 1;
+                       j = (cnt = ((long) iob->_IO_read_end -
+                               (long) iob->_IO_read_ptr)  + 1) < i ? cnt : i;
 #elif defined(__DragonFly__)
-                               bp = sp = (unsigned char *) ((struct __FILE_public *)iob)->_p - 1;
-                               j = (cnt = ((struct __FILE_public *)iob)->_r+1) < i ? cnt : i;
+                       bp = sp = (unsigned char *) ((struct __FILE_public *)iob)->_p - 1;
+                       j = (cnt = ((struct __FILE_public *)iob)->_r+1) < i ? cnt : i;
 #else
-                               bp = sp = (unsigned char *) iob->_ptr - 1;
-                               j = (cnt = iob->_cnt+1) < i ? cnt : i;
+                       bp = sp = (unsigned char *) iob->_ptr - 1;
+                       j = (cnt = iob->_cnt+1) < i ? cnt : i;
 #endif
-                               while (--j >= 0 && (c = *bp++) != ':' && c != '\n')
-                                       *cp++ = c;
+                       while (--j >= 0 && (c = *bp++) != ':' && c != '\n')
+                               *cp++ = c;
 
-                               j = bp - sp;
-                               if ((cnt -= j) <= 0) {
+                       j = bp - sp;
+                       if ((cnt -= j) <= 0) {
 #ifdef LINUX_STDIO
-                                       iob->_IO_read_ptr = iob->_IO_read_end;
-                                       if (__underflow(iob) == EOF) {
+                               iob->_IO_read_ptr = iob->_IO_read_end;
+                               if (__underflow(iob) == EOF) {
 #elif defined(__DragonFly__)
-                                       if (__srget(iob) == EOF) {
+                               if (__srget(iob) == EOF) {
 #else
-                                       if (_filbuf(iob) == EOF) {
+                               if (_filbuf(iob) == EOF) {
 #endif
-                                               *cp = *buf = 0;
-                                               advise(NULL, "eof encountered in field \"%s\"", name);
-                                               return FMTERR;
-                                       }
+                                       *cp = *buf = 0;
+                                       advise(NULL, "eof encountered in field \"%s\"", name);
+                                       return FMTERR;
+                               }
 #ifdef LINUX_STDIO
-                                       iob->_IO_read_ptr++; /* NOT automatic in __underflow()! */
+                               iob->_IO_read_ptr++; /* NOT automatic in __underflow()! */
 #endif
-                               } else {
+                       } else {
 #ifdef LINUX_STDIO
-                                       iob->_IO_read_ptr = bp + 1;
+                               iob->_IO_read_ptr = bp + 1;
 #elif defined(__DragonFly__)
-                                       ((struct __FILE_public *)iob)->_p = bp + 1;
-                                       ((struct __FILE_public *)iob)->_r = cnt - 1;
+                               ((struct __FILE_public *)iob)->_p = bp + 1;
+                               ((struct __FILE_public *)iob)->_r = cnt - 1;
 #else
-                                       iob->_ptr = bp + 1;
-                                       iob->_cnt = cnt - 1;
+                               iob->_ptr = bp + 1;
+                               iob->_cnt = cnt - 1;
 #endif
-                               }
-                               if (c == ':')
-                                       break;
+                       }
+                       if (c == ':')
+                               break;
 
+                       /*
+                       ** something went wrong.  possibilities are:
+                       **  . hit a newline (error)
+                       **  . got more than namesz chars. (error)
+                       **  . hit the end of the buffer. (loop)
+                       */
+                       if (c == '\n') {
                                /*
-                               ** something went wrong.  possibilities are:
-                               **  . hit a newline (error)
-                               **  . got more than namesz chars. (error)
-                               **  . hit the end of the buffer. (loop)
+                               ** We hit the end of the line without
+                               ** seeing ':' to terminate the field name.
+                               ** This is usually (always?)  spam.  But,
+                               ** blowing up is lame, especially when
+                               ** scan(1)ing a folder with such messages.
+                               ** Pretend such lines are the first of
+                               ** the body (at least mutt also handles
+                               ** it this way).
                                */
-                               if (c == '\n') {
-                                       /*
-                                       ** We hit the end of the line
-                                       ** without seeing ':' to terminate
-                                       ** the field name.  This is usually
-                                       ** (always?)  spam.  But, blowing
-                                       ** up is lame, especially when
-                                       ** scan(1)ing a folder with such
-                                       ** messages.  Pretend such lines are
-                                       ** the first of the body (at least
-                                       ** mutt also handles it this way).
-                                       */
 
+                               /*
+                               ** See if buf can hold this line, since we
+                               ** were assuming we had a buffer of NAMESZ,
+                               ** not bufsz.
+                               */
+                               /* + 1 for the newline */
+                               if (bufsz < j + 1) {
                                        /*
-                                       ** See if buf can hold this line,
-                                       ** since we were assuming we had
-                                       ** a buffer of NAMESZ, not bufsz.
-                                       */
-                                       /* + 1 for the newline */
-                                       if (bufsz < j + 1) {
-                                               /*
-                                               ** No, it can't.  Oh well,
-                                               ** guess we'll blow up.
-                                               */
-                                               *cp = *buf = 0;
-                                               advise(NULL, "eol encountered in field \"%s\"", name);
-                                               state = FMTERR;
-                                               goto finish;
-                                       }
-                                       memcpy(buf, name, j - 1);
-                                       buf[j - 1] = '\n';
-                                       buf[j] = '\0';
-                                       /*
-                                       ** mhparse.c:get_content wants to
-                                       ** find the position of the body
-                                       ** start, but it thinks there's a
-                                       ** blank line between the header
-                                       ** and the body (naturally!), so
-                                       ** seek back so that things line
-                                       ** up even though we don't have
-                                       ** that blank line in this case.
-                                       ** Simpler parsers (e.g. mhl)
-                                       ** get extra newlines, but that
-                                       ** should be harmless enough, right?
-                                       ** This is a corrupt message anyway.
+                                       ** No, it can't.  Oh well,
+                                       ** guess we'll blow up.
                                        */
-                                       fseek(iob, ftell(iob) - 2, SEEK_SET);
-                                       return BODY;
-                               }
-                               if ((i -= j) <= 0) {
                                        *cp = *buf = 0;
-                                       advise(NULL, "field name \"%s\" exceeds %d bytes", name, NAMESZ - 2);
-                                       state = LENERR;
+                                       advise(NULL, "eol encountered in field \"%s\"", name);
+                                       state = FMTERR;
                                        goto finish;
                                }
+                               memcpy(buf, name, j - 1);
+                               buf[j - 1] = '\n';
+                               buf[j] = '\0';
+                               /*
+                               ** mhparse.c:get_content wants to find
+                               ** the position of the body start, but
+                               ** it thinks there's a blank line between
+                               ** the header and the body (naturally!),
+                               ** so seek back so that things line up
+                               ** even though we don't have that blank
+                               ** line in this case.  Simpler parsers
+                               ** (e.g. mhl) get extra newlines, but
+                               ** that should be harmless enough, right?
+                               ** This is a corrupt message anyway.
+                               */
+                               fseek(iob, ftell(iob) - 2, SEEK_SET);
+                               return BODY;
                        }
+                       if ((i -= j) <= 0) {
+                               *cp = *buf = 0;
+                               advise(NULL, "field name \"%s\" exceeds %d bytes", name, NAMESZ - 2);
+                               state = LENERR;
+                               goto finish;
+                       }
+               }
 
-                       while (isspace(*--cp) && cp >= name)
-                               ;
-                       *++cp = 0;
-                       /* fall through */
-
-               case FLDPLUS:
-                       /*
-                       ** get (more of) the text of a field.  take
-                       ** characters up to the end of this field (newline
-                       ** followed by non-blank) or bufsz-1 characters.
-                       */
-                       cp = buf; i = bufsz-1;
-                       for (;;) {
+               while (isspace(*--cp) && cp >= name)
+                       ;
+               *++cp = 0;
+               /* fall through */
+
+       case FLDPLUS:
+               /*
+               ** get (more of) the text of a field.  take
+               ** characters up to the end of this field (newline
+               ** followed by non-blank) or bufsz-1 characters.
+               */
+               cp = buf; i = bufsz-1;
+               for (;;) {
 #ifdef LINUX_STDIO
-                               cnt = (long) iob->_IO_read_end - (long) iob->_IO_read_ptr;
-                               bp = (unsigned char *) --iob->_IO_read_ptr;
+                       cnt = (long) iob->_IO_read_end - (long) iob->_IO_read_ptr;
+                       bp = (unsigned char *) --iob->_IO_read_ptr;
 #elif defined(__DragonFly__)
-                               cnt = ((struct __FILE_public *)iob)->_r++;
-                               bp = (unsigned char *) --((struct __FILE_public *)iob)->_p;
+                       cnt = ((struct __FILE_public *)iob)->_r++;
+                       bp = (unsigned char *) --((struct __FILE_public *)iob)->_p;
 #else
-                               cnt = iob->_cnt++;
-                               bp = (unsigned char *) --iob->_ptr;
+                       cnt = iob->_cnt++;
+                       bp = (unsigned char *) --iob->_ptr;
 #endif
-                               c = cnt < i ? cnt : i;
-                               while ((ep = locc( c, bp, '\n' ))) {
-                                       /*
-                                       ** if we hit the end of this field,
-                                       ** return.
-                                       */
-                                       if ((j = *++ep) != ' ' && j != '\t') {
+                       c = cnt < i ? cnt : i;
+                       while ((ep = locc( c, bp, '\n' ))) {
+                               /*
+                               ** if we hit the end of this field,
+                               ** return.
+                               */
+                               if ((j = *++ep) != ' ' && j != '\t') {
 #ifdef LINUX_STDIO
-                                               j = ep - (unsigned char *) iob->_IO_read_ptr;
-                                               memcpy(cp, iob->_IO_read_ptr, j);
-                                               iob->_IO_read_ptr = ep;
+                                       j = ep - (unsigned char *) iob->_IO_read_ptr;
+                                       memcpy(cp, iob->_IO_read_ptr, j);
+                                       iob->_IO_read_ptr = ep;
 #elif defined(__DragonFly__)
-                                               j = ep - (unsigned char *) ((struct __FILE_public *)iob)->_p;
-                                               memcpy(cp, ((struct __FILE_public *)iob)->_p, j);
-                                               ((struct __FILE_public *)iob)->_p = ep;
-                                               ((struct __FILE_public *)iob)->_r -= j;
+                                       j = ep - (unsigned char *) ((struct __FILE_public *)iob)->_p;
+                                       memcpy(cp, ((struct __FILE_public *)iob)->_p, j);
+                                       ((struct __FILE_public *)iob)->_p = ep;
+                                       ((struct __FILE_public *)iob)->_r -= j;
 #else
-                                               j = ep - (unsigned char *) iob->_ptr;
-                                               memcpy(cp, iob->_ptr, j);
-                                               iob->_ptr = ep;
-                                               iob->_cnt -= j;
+                                       j = ep - (unsigned char *) iob->_ptr;
+                                       memcpy(cp, iob->_ptr, j);
+                                       iob->_ptr = ep;
+                                       iob->_cnt -= j;
 #endif
-                                               cp += j;
-                                               state = FLD;
-                                               goto finish;
-                                       }
-                                       c -= ep - bp;
-                                       bp = ep;
+                                       cp += j;
+                                       state = FLD;
+                                       goto finish;
                                }
-                               /*
-                               ** end of input or dest buffer - copy what
-                               ** we've found.
-                               */
+                               c -= ep - bp;
+                               bp = ep;
+                       }
+                       /*
+                       ** end of input or dest buffer - copy what
+                       ** we've found.
+                       */
 #ifdef LINUX_STDIO
-                               c += bp - (unsigned char *) iob->_IO_read_ptr;
-                               memcpy(cp, iob->_IO_read_ptr, c);
+                       c += bp - (unsigned char *) iob->_IO_read_ptr;
+                       memcpy(cp, iob->_IO_read_ptr, c);
 #elif defined(__DragonFly__)
-                               c += bp - (unsigned char *) ((struct __FILE_public *)iob)->_p;
-                               memcpy(cp, ((struct __FILE_public *)iob)->_p, c);
+                       c += bp - (unsigned char *) ((struct __FILE_public *)iob)->_p;
+                       memcpy(cp, ((struct __FILE_public *)iob)->_p, c);
 #else
-                               c += bp - (unsigned char *) iob->_ptr;
-                               memcpy(cp, iob->_ptr, c);
+                       c += bp - (unsigned char *) iob->_ptr;
+                       memcpy(cp, iob->_ptr, c);
 #endif
-                               i -= c;
-                               cp += c;
-                               if (i <= 0) {
-                                       /* the dest buffer is full */
+                       i -= c;
+                       cp += c;
+                       if (i <= 0) {
+                               /* the dest buffer is full */
 #ifdef LINUX_STDIO
-                                       iob->_IO_read_ptr += c;
+                               iob->_IO_read_ptr += c;
 #elif defined(__DragonFly__)
-                                       ((struct __FILE_public *)iob)->_r -= c;
-                                       ((struct __FILE_public *)iob)->_p += c;
+                               ((struct __FILE_public *)iob)->_r -= c;
+                               ((struct __FILE_public *)iob)->_p += c;
 #else
-                                       iob->_cnt -= c;
-                                       iob->_ptr += c;
+                               iob->_cnt -= c;
+                               iob->_ptr += c;
 #endif
-                                       state = FLDPLUS;
-                                       break;
-                               }
-                               /*
-                               ** There's one character left in the input
-                               ** buffer.  Copy it & fill the buffer.
-                               ** If the last char was a newline and the
-                               ** next char is not whitespace, this is
-                               ** the end of the field.  Otherwise loop.
-                               */
-                               --i;
+                               state = FLDPLUS;
+                               break;
+                       }
+                       /*
+                       ** There's one character left in the input
+                       ** buffer.  Copy it & fill the buffer.
+                       ** If the last char was a newline and the
+                       ** next char is not whitespace, this is
+                       ** the end of the field.  Otherwise loop.
+                       */
+                       --i;
 #ifdef LINUX_STDIO
-                               *cp++ = j = *(iob->_IO_read_ptr + c);
-                               iob->_IO_read_ptr = iob->_IO_read_end;
-                               c = __underflow(iob);
-                               iob->_IO_read_ptr++;  /* NOT automatic! */
+                       *cp++ = j = *(iob->_IO_read_ptr + c);
+                       iob->_IO_read_ptr = iob->_IO_read_end;
+                       c = __underflow(iob);
+                       iob->_IO_read_ptr++;  /* NOT automatic! */
 #elif defined(__DragonFly__)
-                               *cp++ =j = *(((struct __FILE_public *)iob)->_p + c);
-                               c = __srget(iob);
+                       *cp++ =j = *(((struct __FILE_public *)iob)->_p + c);
+                       c = __srget(iob);
 #else
-                               *cp++ = j = *(iob->_ptr + c);
-                               c = _filbuf(iob);
+                       *cp++ = j = *(iob->_ptr + c);
+                       c = _filbuf(iob);
 #endif
-                               if (c == EOF ||
-                                 ((j == '\0' || j == '\n') && c != ' ' && c != '\t')) {
-                                       if (c != EOF) {
+                       if (c == EOF ||
+                         ((j == '\0' || j == '\n') && c != ' ' && c != '\t')) {
+                               if (c != EOF) {
 #ifdef LINUX_STDIO
-                                               --iob->_IO_read_ptr;
+                                       --iob->_IO_read_ptr;
 #elif defined(__DragonFly__)
-                                               --((struct __FILE_public *)iob)->_p;
-                                               ++((struct __FILE_public *)iob)->_r;
+                                       --((struct __FILE_public *)iob)->_p;
+                                       ++((struct __FILE_public *)iob)->_r;
 #else
-                                               --iob->_ptr;
-                                               ++iob->_cnt;
+                                       --iob->_ptr;
+                                       ++iob->_cnt;
 #endif
-                                       }
-                                       state = FLD;
-                                       break;
                                }
+                               state = FLD;
+                               break;
                        }
-                       break;
-
-               case BODY:
-               body:
-                       /*
-                       ** get the message body up to bufsz characters or
-                       ** the end of the message.  Sleazy hack: if bufsz
-                       ** is negative we assume that we were called to
-                       ** copy directly into the output buffer and we
-                       ** don't add an eos.
-                       */
-                       i = (bufsz < 0) ? -bufsz : bufsz-1;
+               }
+               break;
+
+       case BODY:
+       body:
+               /*
+               ** get the message body up to bufsz characters or
+               ** the end of the message.  Sleazy hack: if bufsz
+               ** is negative we assume that we were called to
+               ** copy directly into the output buffer and we
+               ** don't add an eos.
+               */
+               i = (bufsz < 0) ? -bufsz : bufsz-1;
 #ifdef LINUX_STDIO
-                       bp = (unsigned char *) --iob->_IO_read_ptr;
-                       cnt = (long) iob->_IO_read_end - (long) iob->_IO_read_ptr;
+               bp = (unsigned char *) --iob->_IO_read_ptr;
+               cnt = (long) iob->_IO_read_end - (long) iob->_IO_read_ptr;
 #elif defined(__DragonFly__)
-                       bp = (unsigned char *) --((struct __FILE_public *)iob)->_p;
-                       cnt = ++((struct __FILE_public *)iob)->_r;
+               bp = (unsigned char *) --((struct __FILE_public *)iob)->_p;
+               cnt = ++((struct __FILE_public *)iob)->_r;
 #else
-                       bp = (unsigned char *) --iob->_ptr;
-                       cnt = ++iob->_cnt;
+               bp = (unsigned char *) --iob->_ptr;
+               cnt = ++iob->_cnt;
 #endif
-                       c = (cnt < i ? cnt : i);
-                       if (msg_style != MS_DEFAULT && c > 1) {
+               c = (cnt < i ? cnt : i);
+               if (msg_style != MS_DEFAULT && c > 1) {
+                       /*
+                       ** packed maildrop - only take up to the (possible)
+                       ** start of the next message.  This "matchc" should
+                       ** probably be a Boyer-Moore matcher for non-vaxen,
+                       ** particularly since we have the alignment table
+                       ** all built for the end-of-buffer test (next).
+                       ** But our vax timings indicate that the "matchc"
+                       ** instruction is 50% faster than a carefully coded
+                       ** B.M. matcher for most strings.  (So much for
+                       ** elegant algorithms vs. brute force.)  Since I
+                       ** (currently) run MH on a vax, we use the matchc
+                       ** instruction. --vj
+                       */
+                       if ((ep = matchc( fdelimlen, fdelim, c, bp )))
+                               c = ep - bp + 1;
+                       else {
                                /*
-                               ** packed maildrop - only take up to the
-                               ** (possible) start of the next message.
-                               ** This "matchc" should probably be a
-                               ** Boyer-Moore matcher for non-vaxen,
-                               ** particularly since we have the alignment
-                               ** table all built for the end-of-buffer
-                               ** test (next).  But our vax timings
-                               ** indicate that the "matchc" instruction
-                               ** is 50% faster than a carefully coded
-                               ** B.M. matcher for most strings.  (So much
-                               ** for elegant algorithms vs. brute force.)
-                               ** Since I (currently) run MH on a vax,
-                               ** we use the matchc instruction. --vj
+                               ** There's no delim in the buffer but
+                               ** there may be a partial one at the end.
+                               ** If so, we want to leave it so the "eom"
+                               ** check on the next call picks it up.  Use a
+                               ** modified Boyer-Moore matcher to make this
+                               ** check relatively cheap.  The first "if"
+                               ** figures out what position in the pattern
+                               ** matches the last character in the buffer.
+                               ** The inner "while" matches the pattern
+                               ** against the buffer, backwards starting
+                               ** at that position.  Note that unless the
+                               ** buffer ends with one of the characters
+                               ** in the pattern (excluding the first
+                               ** and last), we do only one test.
                                */
-                               if ((ep = matchc( fdelimlen, fdelim, c, bp )))
-                                       c = ep - bp + 1;
-                               else {
-                                       /*
-                                       ** There's no delim in the buffer
-                                       ** but there may be a partial one
-                                       ** at the end.  If so, we want
-                                       ** to leave it so the "eom" check
-                                       ** on the next call picks it up.
-                                       ** Use a modified Boyer-Moore
-                                       ** matcher to make this check
-                                       ** relatively cheap.  The first
-                                       ** "if" figures out what position
-                                       ** in the pattern matches the
-                                       ** last character in the buffer.
-                                       ** The inner "while" matches the
-                                       ** pattern against the buffer,
-                                       ** backwards starting at that
-                                       ** position.  Note that unless
-                                       ** the buffer ends with one of
-                                       ** the characters in the pattern
-                                       ** (excluding the first and last),
-                                       ** we do only one test.
-                                       */
-                                       ep = bp + c - 1;
-                                       if ((sp = pat_map[*ep])) {
-                                               do {
+                               ep = bp + c - 1;
+                               if ((sp = pat_map[*ep])) {
+                                       do {
+                                               /*
+                                               ** This if() is true unless
+                                               ** (a) the buffer is too
+                                               ** small to contain this
+                                               ** delimiter prefix,
+                                               ** or (b) it contains
+                                               ** exactly enough chars for
+                                               ** the delimiter prefix.
+                                               ** For case (a) obviously we
+                                               ** aren't going to match.
+                                               ** For case (b), if the
+                                               ** buffer really contained
+                                               ** exactly a delim prefix,
+                                               ** then the m_eom call
+                                               ** at entry should have
+                                               ** found it.  Thus it's
+                                               ** not a delim and we know
+                                               ** we won't get a match.
+                                               */
+                                               if (((sp - fdelim) + 2) <= c) {
+                                                       cp = sp;
                                                        /*
-                                                       ** This if() is
-                                                       ** true unless (a)
-                                                       ** the buffer is too
-                                                       ** small to contain
-                                                       ** this delimiter
-                                                       ** prefix, or (b)
-                                                       ** it contains
-                                                       ** exactly enough
-                                                       ** chars for the
-                                                       ** delimiter prefix.
-                                                       ** For case (a)
-                                                       ** obviously we
-                                                       ** aren't going
-                                                       ** to match.
-                                                       ** For case (b),
-                                                       ** if the buffer
-                                                       ** really contained
-                                                       ** exactly a delim
-                                                       ** prefix, then
-                                                       ** the m_eom call
-                                                       ** at entry should
-                                                       ** have found it.
-                                                       ** Thus it's not
-                                                       ** a delim and we
-                                                       ** know we won't
-                                                       ** get a match.
+                                                       ** Unfortunately although fdelim has a preceding NUL
+                                                       ** we can't use this as a sentinel in case the buffer
+                                                       ** contains a NUL in exactly the wrong place (this
+                                                       ** would cause us to run off the front of fdelim).
                                                        */
-                                                       if (((sp - fdelim) + 2) <= c) {
-                                                               cp = sp;
-                                                               /*
-                                                               ** Unfortunately although fdelim has a preceding NUL
-                                                               ** we can't use this as a sentinel in case the buffer
-                                                               ** contains a NUL in exactly the wrong place (this
-                                                               ** would cause us to run off the front of fdelim).
-                                                               */
-                                                               while (*--ep == *--cp)
-                                                                       if (cp < fdelim)
-                                                                               break;
-                                                               if (cp < fdelim) {
-                                                                       /* we matched the entire delim prefix,
-                                                                       ** so only take the buffer up to there.
-                                                                       ** we know ep >= bp -- check above prevents underrun
-                                                                       */
-                                                                       c = (ep - bp) + 2;
+                                                       while (*--ep == *--cp)
+                                                               if (cp < fdelim)
                                                                        break;
-                                                               }
+                                                       if (cp < fdelim) {
+                                                               /* we matched the entire delim prefix,
+                                                               ** so only take the buffer up to there.
+                                                               ** we know ep >= bp -- check above prevents underrun
+                                                               */
+                                                               c = (ep - bp) + 2;
+                                                               break;
                                                        }
-                                                       /* try matching one less char of delim string */
-                                                       ep = bp + c - 1;
-                                               } while (--sp > fdelim);
-                                       }
+                                               }
+                                               /* try matching one less char of delim string */
+                                               ep = bp + c - 1;
+                                       } while (--sp > fdelim);
                                }
                        }
-                       memcpy( buf, bp, c );
+               }
+               memcpy( buf, bp, c );
 #ifdef LINUX_STDIO
-                       iob->_IO_read_ptr += c;
+               iob->_IO_read_ptr += c;
 #elif defined(__DragonFly__)
-                       ((struct __FILE_public *)iob)->_r -= c;
-                       ((struct __FILE_public *)iob)->_p += c;
+               ((struct __FILE_public *)iob)->_r -= c;
+               ((struct __FILE_public *)iob)->_p += c;
 #else
-                       iob->_cnt -= c;
-                       iob->_ptr += c;
+               iob->_cnt -= c;
+               iob->_ptr += c;
 #endif
-                       if (bufsz < 0) {
-                               msg_count = c;
-                               return (state);
-                       }
-                       cp = buf + c;
-                       break;
+               if (bufsz < 0) {
+                       msg_count = c;
+                       return (state);
+               }
+               cp = buf + c;
+               break;
 
-               default:
-                       adios(NULL, "m_getfld() called with bogus state of %d", state);
+       default:
+               adios(NULL, "m_getfld() called with bogus state of %d", state);
        }
 finish:
        *cp = 0;
index d93ad26..45bbecd 100644 (file)
--- a/sbr/mf.c
+++ b/sbr/mf.c
@@ -206,39 +206,39 @@ getadrx(char *addrs)
        }
 
        switch (parse_address()) {
-               case DONE:
-                       free(dp);
-                       dp = cp = NULL;
-                       return NULL;
-
-               case OK:
-                       switch (last_lex) {
-                               case LX_COMA:
-                               case LX_END:
-                                       break;
+       case DONE:
+               free(dp);
+               dp = cp = NULL;
+               return NULL;
 
-                               default:  /* catch trailing comments */
-                                       bp = cp;
-                                       my_lex(adr);
-                                       cp = bp;
-                                       break;
-                       }
+       case OK:
+               switch (last_lex) {
+               case LX_COMA:
+               case LX_END:
                        break;
 
-               default:
+               default:  /* catch trailing comments */
+                       bp = cp;
+                       my_lex(adr);
+                       cp = bp;
                        break;
                }
+               break;
+
+       default:
+               break;
+       }
 
        if (err[0])
                for (;;) {
                        switch (last_lex) {
-                               case LX_COMA:
-                               case LX_END:
-                                       break;
+                       case LX_COMA:
+                       case LX_END:
+                               break;
 
-                               default:
-                                       my_lex(adr);
-                                       continue;
+                       default:
+                               my_lex(adr);
+                               continue;
                        }
                        break;
                }
@@ -274,144 +274,144 @@ parse_address(void)
 again: ;
        ap = cp;
        switch (my_lex(buffer)) {
-               case LX_ATOM:
-               case LX_QSTR:
-                       pers = getcpy(buffer);
-                       break;
+       case LX_ATOM:
+       case LX_QSTR:
+               pers = getcpy(buffer);
+               break;
+
+       case LX_SEMI:
+               if (glevel-- <= 0) {
+                       strcpy(err, "extraneous semi-colon");
+                       return NOTOK;
+               }
+       case LX_COMA:
+               if (note) {
+                       free(note);
+                       note = NULL;
+               }
+               goto again;
 
-               case LX_SEMI:
-                       if (glevel-- <= 0) {
-                               strcpy(err, "extraneous semi-colon");
-                               return NOTOK;
-                       }
-               case LX_COMA:
-                       if (note) {
-                               free(note);
-                               note = NULL;
-                       }
-                       goto again;
+       case LX_END:
+               return DONE;
 
-               case LX_END:
-                       return DONE;
+       case LX_LBRK:  /* sigh (2) */
+               goto get_addr;
 
-               case LX_LBRK:  /* sigh (2) */
-                       goto get_addr;
+       case LX_AT:  /* sigh (3) */
+               cp = ap;
+               if (route_addr(buffer) == NOTOK)
+                       return NOTOK;
+               return OK;  /* why be choosy? */
 
-               case LX_AT:  /* sigh (3) */
-                       cp = ap;
+       default:
+               sprintf(err, "illegal address construct (%s)", buffer);
+               return NOTOK;
+       }
+
+       switch (my_lex(buffer)) {
+       case LX_ATOM:
+       case LX_QSTR:
+               pers = add(buffer, add(" ", pers));
+more_phrase: ;  /* sigh (1) */
+               if (phrase(buffer) == NOTOK)
+                       return NOTOK;
+
+               switch (last_lex) {
+               case LX_LBRK:
+get_addr: ;
                        if (route_addr(buffer) == NOTOK)
                                return NOTOK;
-                       return OK;  /* why be choosy? */
-
-               default:
-                       sprintf(err, "illegal address construct (%s)", buffer);
+                       if (last_lex == LX_RBRK)
+                               return OK;
+                       sprintf(err, "missing right-bracket (%s)", buffer);
                        return NOTOK;
-       }
 
-       switch (my_lex(buffer)) {
-               case LX_ATOM:
-               case LX_QSTR:
-                       pers = add(buffer, add(" ", pers));
-       more_phrase: ;  /* sigh (1) */
-                       if (phrase(buffer) == NOTOK)
+               case LX_COLN:
+get_group: ;
+                       if (glevel++ > 0) {
+                               sprintf(err, "nested groups not allowed (%s)", pers);
                                return NOTOK;
+                       }
+                       grp = add(": ", pers);
+                       pers = NULL;
+                       {
+                               char   *pp = cp;
 
-                       switch (last_lex) {
-                               case LX_LBRK:
-                       get_addr: ;
-                                       if (route_addr(buffer) == NOTOK)
-                                               return NOTOK;
-                                       if (last_lex == LX_RBRK)
+                               for (;;)
+                                       switch (my_lex(buffer)) {
+                                       case LX_SEMI:
+                                       case LX_END: /* tsk, tsk */
+                                               glevel--;
                                                return OK;
-                                       sprintf(err, "missing right-bracket (%s)", buffer);
-                                       return NOTOK;
-
-                               case LX_COLN:
-                       get_group: ;
-                                       if (glevel++ > 0) {
-                                               sprintf(err, "nested groups not allowed (%s)", pers);
-                                               return NOTOK;
-                                       }
-                                       grp = add(": ", pers);
-                                       pers = NULL;
-                                       {
-                                               char   *pp = cp;
-
-                                               for (;;)
-                                                       switch (my_lex(buffer)) {
-                                                               case LX_SEMI:
-                                                               case LX_END: /* tsk, tsk */
-                                                                       glevel--;
-                                                                       return OK;
-
-                                                               case LX_COMA:
-                                                                       continue;
-
-                                                               default:
-                                                                       cp = pp;
-                                                                       return parse_address();
-                                                       }
-                                       }
 
-                               case LX_DOT:  /* sigh (1) */
-                                       pers = add(".", pers);
-                                       goto more_phrase;
+                                       case LX_COMA:
+                                               continue;
 
-                               default:
-                                       sprintf(err, "no mailbox in address, only a phrase (%s%s)", pers, buffer);
-                                       return NOTOK;
+                                       default:
+                                               cp = pp;
+                                               return parse_address();
+                                       }
                        }
 
-               case LX_LBRK:
-                       goto get_addr;
+               case LX_DOT:  /* sigh (1) */
+                       pers = add(".", pers);
+                       goto more_phrase;
 
-               case LX_COLN:
-                       goto get_group;
+               default:
+                       sprintf(err, "no mailbox in address, only a phrase (%s%s)", pers, buffer);
+                       return NOTOK;
+               }
 
-               case LX_DOT:
-                       mbox = add(buffer, pers);
-                       pers = NULL;
-                       if (route_addr(buffer) == NOTOK)
-                               return NOTOK;
-                       goto check_end;
+       case LX_LBRK:
+               goto get_addr;
 
-               case LX_AT:
-                       ingrp = glevel;
-                       mbox = pers;
-                       pers = NULL;
-                       if (domain(buffer) == NOTOK)
-                               return NOTOK;
-       check_end: ;
-                       switch (last_lex) {
-                               case LX_SEMI:
-                                       if (glevel-- <= 0) {
-                                               strcpy(err, "extraneous semi-colon");
-                                               return NOTOK;
-                                       }
-                               case LX_COMA:
-                               case LX_END:
-                                       return OK;
+       case LX_COLN:
+               goto get_group;
 
-                               default:
-                                       sprintf(err, "junk after local@domain (%s)", buffer);
-                                       return NOTOK;
-                       }
+       case LX_DOT:
+               mbox = add(buffer, pers);
+               pers = NULL;
+               if (route_addr(buffer) == NOTOK)
+                       return NOTOK;
+               goto check_end;
 
-               case LX_SEMI:  /* no host */
-               case LX_COMA:
-               case LX_END:
-                       ingrp = glevel;
-                       if (last_lex == LX_SEMI && glevel-- <= 0) {
+       case LX_AT:
+               ingrp = glevel;
+               mbox = pers;
+               pers = NULL;
+               if (domain(buffer) == NOTOK)
+                       return NOTOK;
+check_end: ;
+               switch (last_lex) {
+               case LX_SEMI:
+                       if (glevel-- <= 0) {
                                strcpy(err, "extraneous semi-colon");
                                return NOTOK;
                        }
-                       mbox = pers;
-                       pers = NULL;
+               case LX_COMA:
+               case LX_END:
                        return OK;
 
                default:
-                       sprintf(err, "missing mailbox (%s)", buffer);
+                       sprintf(err, "junk after local@domain (%s)", buffer);
+                       return NOTOK;
+               }
+
+       case LX_SEMI:  /* no host */
+       case LX_COMA:
+       case LX_END:
+               ingrp = glevel;
+               if (last_lex == LX_SEMI && glevel-- <= 0) {
+                       strcpy(err, "extraneous semi-colon");
                        return NOTOK;
+               }
+               mbox = pers;
+               pers = NULL;
+               return OK;
+
+       default:
+               sprintf(err, "missing mailbox (%s)", buffer);
+               return NOTOK;
        }
 }
 
@@ -421,13 +421,13 @@ phrase(char *buffer)
 {
        for (;;)
                switch (my_lex(buffer)) {
-                       case LX_ATOM:
-                       case LX_QSTR:
-                               pers = add(buffer, add(" ", pers));
-                               continue;
+               case LX_ATOM:
+               case LX_QSTR:
+                       pers = add(buffer, add(" ", pers));
+                       continue;
 
-                       default:
-                               return OK;
+               default:
+                       return OK;
                }
 }
 
@@ -448,18 +448,18 @@ route_addr(char *buffer)
                return NOTOK;
 
        switch (last_lex) {
-               case LX_AT:
-                       return domain(buffer);
+       case LX_AT:
+               return domain(buffer);
 
-               case LX_SEMI:  /* if in group */
-               case LX_RBRK:  /* no host */
-               case LX_COMA:
-               case LX_END:
-                       return OK;
+       case LX_SEMI:  /* if in group */
+       case LX_RBRK:  /* no host */
+       case LX_COMA:
+       case LX_END:
+               return OK;
 
-               default:
-                       sprintf(err, "no at-sign after local-part (%s)", buffer);
-                       return NOTOK;
+       default:
+               sprintf(err, "no at-sign after local-part (%s)", buffer);
+               return NOTOK;
        }
 }
 
@@ -471,24 +471,23 @@ local_part(char *buffer)
 
        for (;;) {
                switch (my_lex(buffer)) {
-                       case LX_ATOM:
-                       case LX_QSTR:
-                               mbox = add(buffer, mbox);
-                               break;
+               case LX_ATOM:
+               case LX_QSTR:
+                       mbox = add(buffer, mbox);
+                       break;
 
-                       default:
-                               sprintf(err, "no mailbox in local-part (%s)",
-                                               buffer);
-                               return NOTOK;
+               default:
+                       sprintf(err, "no mailbox in local-part (%s)", buffer);
+                       return NOTOK;
                }
 
                switch (my_lex(buffer)) {
-                       case LX_DOT:
-                               mbox = add(buffer, mbox);
-                               continue;
+               case LX_DOT:
+                       mbox = add(buffer, mbox);
+                       continue;
 
-                       default:
-                               return OK;
+               default:
+                       return OK;
                }
        }
 }
@@ -499,29 +498,29 @@ domain(char *buffer)
 {
        for (;;) {
                switch (my_lex(buffer)) {
-                       case LX_ATOM:
-                       case LX_DLIT:
-                               host = add(buffer, host);
-                               break;
+               case LX_ATOM:
+               case LX_DLIT:
+                       host = add(buffer, host);
+                       break;
 
-                       default:
-                               sprintf(err, "no sub-domain in domain-part of address (%s)", buffer);
-                               return NOTOK;
+               default:
+                       sprintf(err, "no sub-domain in domain-part of address (%s)", buffer);
+                       return NOTOK;
                }
 
                switch (my_lex(buffer)) {
-                       case LX_DOT:
-                               host = add(buffer, host);
-                               continue;
+               case LX_DOT:
+                       host = add(buffer, host);
+                       continue;
 
-                       case LX_AT:  /* sigh (0) */
-                               mbox = add(host, add("%", mbox));
-                               free(host);
-                               host = NULL;
-                               continue;
+               case LX_AT:  /* sigh (0) */
+                       mbox = add(host, add("%", mbox));
+                       free(host);
+                       host = NULL;
+                       continue;
 
-                       default:
-                               return OK;
+               default:
+                       return OK;
                }
        }
 }
@@ -534,47 +533,47 @@ route(char *buffer)
 
        for (;;) {
                switch (my_lex(buffer)) {
-                       case LX_ATOM:
-                       case LX_DLIT:
-                               path = add(buffer, path);
-                               break;
+               case LX_ATOM:
+               case LX_DLIT:
+                       path = add(buffer, path);
+                       break;
 
-                       default:
-                               sprintf(err, "no sub-domain in domain-part of address (%s)", buffer);
-                               return NOTOK;
+               default:
+                       sprintf(err, "no sub-domain in domain-part of address (%s)", buffer);
+                       return NOTOK;
                }
                switch (my_lex(buffer)) {
-                       case LX_COMA:
-                               path = add(buffer, path);
-                               for (;;) {
-                                       switch (my_lex(buffer)) {
-                                               case LX_COMA:
-                                                       continue;
-
-                                               case LX_AT:
-                                                       path = add(buffer, path);
-                                                       break;
+               case LX_COMA:
+                       path = add(buffer, path);
+                       for (;;) {
+                               switch (my_lex(buffer)) {
+                               case LX_COMA:
+                                       continue;
 
-                                               default:
-                                                       sprintf(err, "no at-sign found for next domain in route (%s)",
-                                                                        buffer);
-                                       }
+                               case LX_AT:
+                                       path = add(buffer, path);
                                        break;
+
+                               default:
+                                       sprintf(err, "no at-sign found for next domain in route (%s)",
+                                                        buffer);
                                }
-                               continue;
+                               break;
+                       }
+                       continue;
 
-                       case LX_AT:  /* XXX */
-                       case LX_DOT:
-                               path = add(buffer, path);
-                               continue;
+               case LX_AT:  /* XXX */
+               case LX_DOT:
+                       path = add(buffer, path);
+                       continue;
 
-                       case LX_COLN:
-                               path = add(buffer, path);
-                               return OK;
+               case LX_COLN:
+                       path = add(buffer, path);
+                       return OK;
 
-                       default:
-                               sprintf(err, "no colon found to terminate route (%s)", buffer);
-                               return NOTOK;
+               default:
+                       sprintf(err, "no colon found to terminate route (%s)", buffer);
+                       return NOTOK;
                }
        }
 }
@@ -617,29 +616,29 @@ my_lex(char *buffer)
                ADDCHR(c);
                for (i = 0;;)
                        switch (c = *cp++) {
-                               case 0:
+                       case 0:
+                               cp = NULL;
+                               return (last_lex = LX_ERR);
+                       case QUOTE:
+                               ADDCHR(c);
+                               if ((c = *cp++) == 0) {
                                        cp = NULL;
                                        return (last_lex = LX_ERR);
-                               case QUOTE:
-                                       ADDCHR(c);
-                                       if ((c = *cp++) == 0) {
-                                               cp = NULL;
-                                               return (last_lex = LX_ERR);
-                                       }
-                                       ADDCHR(c);
-                                       continue;
-                               case '(':
-                                       i++;
-                               default:
-                                       ADDCHR(c);
-                                       continue;
-                               case ')':
-                                       ADDCHR(c);
-                                       if (--i < 0) {
-                                               *bp = 0;
-                                               note = note ? add(buffer, add(" ", note)) : getcpy(buffer);
-                                               return my_lex(buffer);
-                                       }
+                               }
+                               ADDCHR(c);
+                               continue;
+                       case '(':
+                               i++;
+                       default:
+                               ADDCHR(c);
+                               continue;
+                       case ')':
+                               ADDCHR(c);
+                               if (--i < 0) {
+                                       *bp = 0;
+                                       note = note ? add(buffer, add(" ", note)) : getcpy(buffer);
+                                       return my_lex(buffer);
+                               }
                        }
        }
 
@@ -647,22 +646,22 @@ my_lex(char *buffer)
                ADDCHR(c);
                for (;;)
                        switch (c = *cp++) {
-                               case 0:
+                       case 0:
+                               cp = NULL;
+                               return (last_lex = LX_ERR);
+                       case QUOTE:
+                               ADDCHR(c);
+                               if ((c = *cp++) == 0) {
                                        cp = NULL;
                                        return (last_lex = LX_ERR);
-                               case QUOTE:
-                                       ADDCHR(c);
-                                       if ((c = *cp++) == 0) {
-                                               cp = NULL;
-                                               return (last_lex = LX_ERR);
-                                       }
-                               default:
-                                       ADDCHR(c);
-                                       continue;
-                               case '"':
-                                       ADDCHR(c);
-                                       *bp = 0;
-                                       return (last_lex = LX_QSTR);
+                               }
+                       default:
+                               ADDCHR(c);
+                               continue;
+                       case '"':
+                               ADDCHR(c);
+                               *bp = 0;
+                               return (last_lex = LX_QSTR);
                        }
        }
 
@@ -670,22 +669,22 @@ my_lex(char *buffer)
                ADDCHR(c);
                for (;;)
                        switch (c = *cp++) {
-                               case 0:
+                       case 0:
+                               cp = NULL;
+                               return (last_lex = LX_ERR);
+                       case QUOTE:
+                               ADDCHR(c);
+                               if ((c = *cp++) == 0) {
                                        cp = NULL;
                                        return (last_lex = LX_ERR);
-                               case QUOTE:
-                                       ADDCHR(c);
-                                       if ((c = *cp++) == 0) {
-                                               cp = NULL;
-                                               return (last_lex = LX_ERR);
-                                       }
-                               default:
-                                       ADDCHR(c);
-                                       continue;
-                               case ']':
-                                       ADDCHR(c);
-                                       *bp = 0;
-                                       return (last_lex = LX_DLIT);
+                               }
+                       default:
+                               ADDCHR(c);
+                               continue;
+                       case ']':
+                               ADDCHR(c);
+                               *bp = 0;
+                               return (last_lex = LX_DLIT);
                        }
        }
 
index 2f5132f..9638f56 100644 (file)
--- a/sbr/mts.c
+++ b/sbr/mts.c
@@ -157,27 +157,27 @@ tailor_value(unsigned char *s)
                        *bp = *s;
                } else {
                        switch (*++s) {
-                               case 'b': *bp = '\b'; break;
-                               case 'f': *bp = '\f'; break;
-                               case 'n': *bp = '\n'; break;
-                               case 't': *bp = '\t'; break;
-
-                               case 0: s--;
-                               case QUOTE:
-                                       *bp = QUOTE;
-                                       break;
-
-                               default:
-                                       if (!isdigit(*s)) {
-                                               *bp++ = QUOTE;
-                                               *bp = *s;
-                                       }
-                                       r = *s != '0' ? 10 : 8;
-                                       for (i = 0; isdigit(*s); s++)
-                                               i = i * r + *s - '0';
-                                       s--;
-                                       *bp = toascii(i);
-                                       break;
+                       case 'b': *bp = '\b'; break;
+                       case 'f': *bp = '\f'; break;
+                       case 'n': *bp = '\n'; break;
+                       case 't': *bp = '\t'; break;
+
+                       case 0: s--;
+                       case QUOTE:
+                               *bp = QUOTE;
+                               break;
+
+                       default:
+                               if (!isdigit(*s)) {
+                                       *bp++ = QUOTE;
+                                       *bp = *s;
+                               }
+                               r = *s != '0' ? 10 : 8;
+                               for (i = 0; isdigit(*s); s++)
+                                       i = i * r + *s - '0';
+                               s--;
+                               *bp = toascii(i);
+                               break;
                        }
                }
        }
index d664927..17c62ee 100644 (file)
@@ -21,28 +21,28 @@ push(void)
                sleep(5);
 
        switch (pid) {
-               case -1:
-                       /* fork error */
-                       advise(NULL, "unable to fork, so can't push...");
-                       break;
+       case -1:
+               /* fork error */
+               advise(NULL, "unable to fork, so can't push...");
+               break;
 
-               case 0:
-                       /* child, block a few signals and continue */
-                       SIGNAL(SIGHUP, SIG_IGN);
-                       SIGNAL(SIGINT, SIG_IGN);
-                       SIGNAL(SIGQUIT, SIG_IGN);
-                       SIGNAL(SIGTERM, SIG_IGN);
+       case 0:
+               /* child, block a few signals and continue */
+               SIGNAL(SIGHUP, SIG_IGN);
+               SIGNAL(SIGINT, SIG_IGN);
+               SIGNAL(SIGQUIT, SIG_IGN);
+               SIGNAL(SIGTERM, SIG_IGN);
 #ifdef SIGTSTP
-                       SIGNAL(SIGTSTP, SIG_IGN);
-                       SIGNAL(SIGTTIN, SIG_IGN);
-                       SIGNAL(SIGTTOU, SIG_IGN);
+               SIGNAL(SIGTSTP, SIG_IGN);
+               SIGNAL(SIGTTIN, SIG_IGN);
+               SIGNAL(SIGTTOU, SIG_IGN);
 #endif
-                       freopen("/dev/null", "r", stdin);
-                       freopen("/dev/null", "w", stdout);
-                       break;
+               freopen("/dev/null", "r", stdin);
+               freopen("/dev/null", "w", stdout);
+               break;
 
-               default:
-                       /* parent, just exit */
-                       done(0);
+       default:
+               /* parent, just exit */
+               done(0);
        }
 }
index 7212303..fff8a84 100644 (file)
@@ -56,50 +56,53 @@ readconfig(struct node **npp, FILE *ib, char *file, int ctx)
        }
 
        for (state = FLD;;) {
-               switch (state = m_getfld(state, name, field, sizeof(field), ib)) {
-                       case FLD:
-                       case FLDPLUS:
-                       case FLDEOF:
-                               np = (struct node *) mh_xmalloc(sizeof(*np));
-                               *npp = np;
-                               *(npp = &np->n_next) = NULL;
-                               np->n_name = getcpy(name);
-                               if (state == FLDPLUS) {
-                                       cp = getcpy(field);
-                                       while (state == FLDPLUS) {
-                                               state = m_getfld(state, name, field, sizeof(field), ib);
-                                               cp = add(field, cp);
-                                       }
-                                       np->n_field = trimcpy(cp);
-                                       free(cp);
-                               } else {
-                                       np->n_field = trimcpy(field);
+               switch (state = m_getfld(state, name, field, sizeof(field),
+                               ib)) {
+               case FLD:
+               case FLDPLUS:
+               case FLDEOF:
+                       np = (struct node *) mh_xmalloc(sizeof(*np));
+                       *npp = np;
+                       *(npp = &np->n_next) = NULL;
+                       np->n_name = getcpy(name);
+                       if (state == FLDPLUS) {
+                               cp = getcpy(field);
+                               while (state == FLDPLUS) {
+                                       state = m_getfld(state, name, field,
+                                                       sizeof(field), ib);
+                                       cp = add(field, cp);
                                }
-                               np->n_context = ctx;
+                               np->n_field = trimcpy(cp);
+                               free(cp);
+                       } else {
+                               np->n_field = trimcpy(field);
+                       }
+                       np->n_context = ctx;
 
-                               /*
-                               ** Now scan the list of `procs' and link in
-                               ** the field value to the global variable.
-                               */
-                               for (ps = procs; ps->procname; ps++)
-                                       if (mh_strcasecmp(np->n_name,
-                                                       ps->procname) == 0) {
-                                               *ps->procnaddr = np->n_field;
-                                               break;
-                                       }
-                               if (state == FLDEOF)
+                       /*
+                       ** Now scan the list of `procs' and link in
+                       ** the field value to the global variable.
+                       */
+                       for (ps = procs; ps->procname; ps++)
+                               if (mh_strcasecmp(np->n_name,
+                                               ps->procname) == 0) {
+                                       *ps->procnaddr = np->n_field;
                                        break;
-                               continue;
+                               }
+                       if (state == FLDEOF)
+                               break;
+                       continue;
 
-                       case BODY:
-                       case BODYEOF:
-                               adios(NULL, "no blank lines are permitted in %s", file);
+               case BODY:
+               case BODYEOF:
+                       adios(NULL, "no blank lines are permitted in %s",
+                                       file);
 
-                       case FILEEOF:
-                               break;
+               case FILEEOF:
+                       break;
 
-                       default:
-                               adios(NULL, "%s is poorly formatted", file);
+               default:
+                       adios(NULL, "%s is poorly formatted", file);
                }
                break;
        }
index 00647dd..48f0b44 100644 (file)
@@ -34,17 +34,17 @@ refile(char **arg, char *file)
        fflush(stdout);
 
        switch (pid = vfork()) {
-               case -1:
-                       advise("fork", "unable to");
-                       return -1;
-
-               case 0:
-                       execvp(fileproc, vec);
-                       fprintf(stderr, "unable to exec ");
-                       perror(fileproc);
-                       _exit(-1);
-
-               default:
-                       return (pidwait(pid, -1));
+       case -1:
+               advise("fork", "unable to");
+               return -1;
+
+       case 0:
+               execvp(fileproc, vec);
+               fprintf(stderr, "unable to exec ");
+               perror(fileproc);
+               _exit(-1);
+
+       default:
+               return (pidwait(pid, -1));
        }
 }
index 3b7b50f..26337c0 100644 (file)
@@ -74,35 +74,38 @@ seq_public(struct msgs *mp)
 
        /* Use m_getfld to scan sequence file */
        for (state = FLD;;) {
-               switch (state = m_getfld(state, name, field, sizeof(field), fp)) {
-                       case FLD:
-                       case FLDPLUS:
-                       case FLDEOF:
-                               if (state == FLDPLUS) {
-                                       cp = getcpy(field);
-                                       while (state == FLDPLUS) {
-                                               state = m_getfld(state, name, field, sizeof(field), fp);
-                                               cp = add(field, cp);
-                                       }
-                                       seq_init(mp, getcpy(name), trimcpy(cp));
-                                       free(cp);
-                               } else {
-                                       seq_init(mp, getcpy(name), trimcpy(field));
+               switch (state = m_getfld(state, name, field, sizeof(field),
+                               fp)) {
+               case FLD:
+               case FLDPLUS:
+               case FLDEOF:
+                       if (state == FLDPLUS) {
+                               cp = getcpy(field);
+                               while (state == FLDPLUS) {
+                                       state = m_getfld(state, name, field,
+                                                       sizeof(field), fp);
+                                       cp = add(field, cp);
                                }
-                               if (state == FLDEOF)
-                                       break;
-                               continue;
+                               seq_init(mp, getcpy(name), trimcpy(cp));
+                               free(cp);
+                       } else {
+                               seq_init(mp, getcpy(name), trimcpy(field));
+                       }
+                       if (state == FLDEOF)
+                               break;
+                       continue;
 
-                       case BODY:
-                       case BODYEOF:
-                               adios(NULL, "no blank lines are permitted in %s", seqfile);
-                               /* fall */
+               case BODY:
+               case BODYEOF:
+                       adios(NULL, "no blank lines are permitted in %s",
+                                       seqfile);
+                       /* fall */
 
-                       case FILEEOF:
-                               break;
+               case FILEEOF:
+                       break;
 
-                       default:
-                               adios(NULL, "%s is poorly formatted", seqfile);
+               default:
+                       adios(NULL, "%s is poorly formatted", seqfile);
                }
                break;  /* break from for loop */
        }
index 289fa5d..e07c847 100644 (file)
--- a/uip/ali.c
+++ b/uip/ali.c
@@ -76,51 +76,51 @@ main(int argc, char **argv)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, switches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, switches);
-                                       done(1);
-                               case UNKWNSW:
-                                       adios(NULL, "-%s unknown", cp);
-
-                               case HELPSW:
-                                       snprintf(buf, sizeof(buf), "%s [switches] aliases ...",
-                                               invo_name);
-                                       print_help(buf, switches, 1);
-                                       done(1);
-                               case VERSIONSW:
-                                       print_version(invo_name);
-                                       done(1);
-
-                               case ALIASW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       if ((i = alias(cp)) != AK_OK)
-                                               adios(NULL, "aliasing error in %s - %s", cp, akerror(i));
-                                       continue;
-                               case NALIASW:
-                                       noalias++;
-                                       continue;
+                       case AMBIGSW:
+                               ambigsw(cp, switches);
+                               done(1);
+                       case UNKWNSW:
+                               adios(NULL, "-%s unknown", cp);
+
+                       case HELPSW:
+                               snprintf(buf, sizeof(buf), "%s [switches] aliases ...",
+                                       invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
+
+                       case ALIASW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s", argp[-2]);
+                               if ((i = alias(cp)) != AK_OK)
+                                       adios(NULL, "aliasing error in %s - %s", cp, akerror(i));
+                               continue;
+                       case NALIASW:
+                               noalias++;
+                               continue;
 
-                               case LISTSW:
-                                       list++;
-                                       continue;
-                               case NLISTSW:
-                                       list = 0;
-                                       continue;
+                       case LISTSW:
+                               list++;
+                               continue;
+                       case NLISTSW:
+                               list = 0;
+                               continue;
 
-                               case NORMSW:
-                                       normalize = AD_HOST;
-                                       continue;
-                               case NNORMSW:
-                                       normalize = AD_NHST;
-                                       continue;
+                       case NORMSW:
+                               normalize = AD_HOST;
+                               continue;
+                       case NNORMSW:
+                               normalize = AD_NHST;
+                               continue;
 
-                               case USERSW:
-                                       inverted++;
-                                       continue;
-                               case NUSERSW:
-                                       inverted = 0;
-                                       continue;
+                       case USERSW:
+                               inverted++;
+                               continue;
+                       case NUSERSW:
+                               inverted = 0;
+                               continue;
                        }
                }
                vec[vecp++] = cp;
@@ -182,27 +182,27 @@ print_aka(char *p, int list, int margin)
 
        while ((c = *p++)) {
                switch (c) {
-                       case ',':
-                               if (*p) {
-                                       if (list)
-                                               printf("\n%*s", margin, "");
-                                       else {
-                                               if (pos >= 68) {
-                                                       printf(",\n ");
-                                                       pos = 2;
-                                               } else {
-                                                       printf(", ");
-                                                       pos += 2;
-                                               }
+               case ',':
+                       if (*p) {
+                               if (list)
+                                       printf("\n%*s", margin, "");
+                               else {
+                                       if (pos >= 68) {
+                                               printf(",\n ");
+                                               pos = 2;
+                                       } else {
+                                               printf(", ");
+                                               pos += 2;
                                        }
                                }
+                       }
 
-                       case 0:
-                               break;
+               case 0:
+                       break;
 
-                       default:
-                               pos++;
-                               putchar(c);
+               default:
+                       pos++;
+                       putchar(c);
                }
        }
 
index 1923867..07c5e03 100644 (file)
@@ -144,22 +144,22 @@ alias(char *file)
        while (vfgets(fp, &ap) == OK) {
                bp = ap;
                switch (*(pp = scanp(bp))) {
-                       case '<':  /* recurse a level */
-                               if (!*(cp = getp(pp + 1))) {
-                                       akerrst = "'<' without alias-file";
-                                       fclose(fp);
-                                       return AK_ERROR;
-                               }
-                               if ((i = alias(cp)) != AK_OK) {
-                                       fclose(fp);
-                                       return i;
-                               }
-
-                       case ':':  /* comment */
-                       case ';':
-                       case '#':
-                       case 0:
-                               continue;
+               case '<':  /* recurse a level */
+                       if (!*(cp = getp(pp + 1))) {
+                               akerrst = "'<' without alias-file";
+                               fclose(fp);
+                               return AK_ERROR;
+                       }
+                       if ((i = alias(cp)) != AK_OK) {
+                               fclose(fp);
+                               return i;
+                       }
+
+               case ':':  /* comment */
+               case ';':
+               case '#':
+               case 0:
+                       continue;
                }
 
                akerrst = bp;
@@ -172,65 +172,65 @@ alias(char *file)
                        return AK_LIMIT;
                }
                switch (lc) {
-                       case ':':
-                               ak->ak_visible = 0;
-                               break;
+               case ':':
+                       ak->ak_visible = 0;
+                       break;
 
-                       case ';':
-                               ak->ak_visible = 1;
-                               break;
+               case ';':
+                       ak->ak_visible = 1;
+                       break;
 
-                       default:
-                               fclose(fp);
-                               return AK_ERROR;
+               default:
+                       fclose(fp);
+                       return AK_ERROR;
                }
 
                switch (*(pp = scanp(ap))) {
-                       case 0:  /* EOL */
+               case 0:  /* EOL */
+                       fclose(fp);
+                       return AK_ERROR;
+
+               case '<':  /* read values from file */
+                       if (!*(cp = getp(pp + 1))) {
                                fclose(fp);
                                return AK_ERROR;
+                       }
+                       if (!addfile(ak, cp)) {
+                               fclose(fp);
+                               return AK_NOFILE;
+                       }
+                       break;
 
-                       case '<':  /* read values from file */
-                               if (!*(cp = getp(pp + 1))) {
-                                       fclose(fp);
-                                       return AK_ERROR;
-                               }
-                               if (!addfile(ak, cp)) {
-                                       fclose(fp);
-                                       return AK_NOFILE;
-                               }
-                               break;
-
-                       case '=':  /* UNIX group */
-                               if (!*(cp = getp(pp + 1))) {
-                                       fclose(fp);
-                                       return AK_ERROR;
-                               }
-                               if (!addgroup(ak, cp)) {
-                                       fclose(fp);
-                                       return AK_NOGROUP;
-                               }
-                               break;
+               case '=':  /* UNIX group */
+                       if (!*(cp = getp(pp + 1))) {
+                               fclose(fp);
+                               return AK_ERROR;
+                       }
+                       if (!addgroup(ak, cp)) {
+                               fclose(fp);
+                               return AK_NOGROUP;
+                       }
+                       break;
 
-                       case '+':  /* UNIX group members */
-                               if (!*(cp = getp(pp + 1))) {
-                                       fclose(fp);
-                                       return AK_ERROR;
-                               }
-                               if (!addmember(ak, cp)) {
-                                       fclose(fp);
-                                       return AK_NOGROUP;
-                               }
-                               break;
+               case '+':  /* UNIX group members */
+                       if (!*(cp = getp(pp + 1))) {
+                               fclose(fp);
+                               return AK_ERROR;
+                       }
+                       if (!addmember(ak, cp)) {
+                               fclose(fp);
+                               return AK_NOGROUP;
+                       }
+                       break;
 
-                       case '*':  /* Everyone */
-                               addall(ak);
-                               break;
+               case '*':  /* Everyone */
+                       addall(ak);
+                       break;
 
-                       default:  /* list */
-                               while ((cp = getalias(pp)))
-                                       add_aka(ak, cp);
-                               break;
+               default:  /* list */
+                       while ((cp = getalias(pp)))
+                               add_aka(ak, cp);
+                       break;
                }
        }
 
@@ -245,25 +245,29 @@ akerror(int i)
        static char buffer[BUFSIZ];
 
        switch (i) {
-               case AK_NOFILE:
-                       snprintf(buffer, sizeof(buffer), "unable to read '%s'", akerrst);
-                       break;
-
-               case AK_ERROR:
-                       snprintf(buffer, sizeof(buffer), "error in line '%s'", akerrst);
-                       break;
-
-               case AK_LIMIT:
-                       snprintf(buffer, sizeof(buffer), "out of memory while on '%s'", akerrst);
-                       break;
-
-               case AK_NOGROUP:
-                       snprintf(buffer, sizeof(buffer), "no such group as '%s'", akerrst);
-                       break;
-
-               default:
-                       snprintf(buffer, sizeof(buffer), "unknown error (%d)", i);
-                       break;
+       case AK_NOFILE:
+               snprintf(buffer, sizeof(buffer), "unable to read '%s'",
+                               akerrst);
+               break;
+
+       case AK_ERROR:
+               snprintf(buffer, sizeof(buffer), "error in line '%s'",
+                               akerrst);
+               break;
+
+       case AK_LIMIT:
+               snprintf(buffer, sizeof(buffer), "out of memory while on '%s'",
+                               akerrst);
+               break;
+
+       case AK_NOGROUP:
+               snprintf(buffer, sizeof(buffer), "no such group as '%s'",
+                               akerrst);
+               break;
+
+       default:
+               snprintf(buffer, sizeof(buffer), "unknown error (%d)", i);
+               break;
        }
 
        return buffer;
index 1d27a9e..5de385f 100644 (file)
@@ -110,88 +110,91 @@ main(int argc, char **argv)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, switches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, switches);
-                                       done(1);
-                               case UNKWNSW:
-                                       adios(NULL, "-%s unknown", cp);
-
-                               case HELPSW:
-                                       snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]",
-                                               invo_name);
-                                       print_help(buf, switches, 1);
-                                       done(1);
-                               case VERSIONSW:
-                                       print_version(invo_name);
-                                       done(1);
-
-                               case COMPSW:
-                                       if (comp)
-                                               adios(NULL, "only one component at a time!");
-                                       if (!(comp = *argp++) || *comp == '-')
+                       case AMBIGSW:
+                               ambigsw(cp, switches);
+                               done(1);
+                       case UNKWNSW:
+                               adios(NULL, "-%s unknown", cp);
+
+                       case HELPSW:
+                               snprintf(buf, sizeof(buf),
+                                       "%s [+folder] [msgs] [switches]",
+                                       invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
+
+                       case COMPSW:
+                               if (comp)
+                                       adios(NULL, "only one component at a time!");
+                               if (!(comp = *argp++) || *comp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
+
+                       case DATESW:
+                               datesw++;
+                               continue;
+                       case NDATESW:
+                               datesw = 0;
+                               continue;
+
+                       case INPLSW:
+                               inplace++;
+                               continue;
+                       case NINPLSW:
+                               inplace = 0;
+                               continue;
+
+                       case TEXTSW:
+                               if (text)
+                                       adios(NULL, "only one body at a time!");
+                               if (!(text = *argp++) || *text == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
+
+                       case DELETESW:  /* delete annotations */
+                               delete = 0;
+                               continue;
+
+                       case LISTSW:  /* produce a listing */
+                               list = 1;
+                               continue;
+
+                       case NUMBERSW: /* number listing or delete by number */
+                               if (number != 0)
+                                       adios(NULL, "only one number at a time!");
+
+                               if (argp-arguments == argc-1 || **argp == '-')
+                                       number = 1;
+
+                               else {
+                                               if (strcmp(*argp, "all") == 0)
+                                                       number = -1;
+
+                                               else if (!(number = atoi(*argp)))
                                                adios(NULL, "missing argument to %s", argp[-2]);
-                                       continue;
-
-                               case DATESW:
-                                       datesw++;
-                                       continue;
-                               case NDATESW:
-                                       datesw = 0;
-                                       continue;
-
-                               case INPLSW:
-                                       inplace++;
-                                       continue;
-                               case NINPLSW:
-                                       inplace = 0;
-                                       continue;
-
-                               case TEXTSW:
-                                       if (text)
-                                               adios(NULL, "only one body at a time!");
-                                       if (!(text = *argp++) || *text == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       continue;
-
-                               case DELETESW:  /* delete annotations */
-                                       delete = 0;
-                                       continue;
-
-                               case LISTSW:  /* produce a listing */
-                                       list = 1;
-                                       continue;
-
-                               case NUMBERSW:  /* number listing or delete by number */
-                                       if (number != 0)
-                                               adios(NULL, "only one number at a time!");
-
-                                       if (argp - arguments == argc - 1 || **argp == '-')
-                                               number = 1;
-
-                                       else {
-                                                       if (strcmp(*argp, "all") == 0)
-                                                               number = -1;
-
-                                                       else if (!(number = atoi(*argp)))
-                                                       adios(NULL, "missing argument to %s", argp[-2]);
 
-                                               argp++;
-                                       }
+                                       argp++;
+                               }
 
-                                       delete = number;
-                                       continue;
+                               delete = number;
+                               continue;
 
-                               case APPENDSW:  /* append annotations instead of default prepend */
-                                       append = 1;
-                                       continue;
+                       case APPENDSW:  /* append annotations instead of default prepend */
+                               append = 1;
+                               continue;
 
-                               case PRESERVESW:  /* preserve access and modification times on annotated message */
-                                       annopreserve(1);
-                                       continue;
+                       case PRESERVESW:  /* preserve access and modification times on annotated message */
+                               annopreserve(1);
+                               continue;
 
-                               case NOPRESERVESW:  /* don't preserve access and modification times on annotated message (default) */
-                                       annopreserve(0);
-                                       continue;
+                       case NOPRESERVESW:  /* don't preserve access and modification times on annotated message (default) */
+                               annopreserve(0);
+                               continue;
                        }
                }
                if (*cp == '+' || *cp == '@') {
index 212d35c..e8c03e1 100644 (file)
@@ -39,12 +39,12 @@ annotate(char *file, char *comp, char *text, int inplace, int datesw,
        /* open and lock the file to be annotated */
        if ((fd = lkopen(file, O_RDWR, 0)) == NOTOK) {
                switch (errno) {
-                       case ENOENT:
-                               break;
+               case ENOENT:
+                       break;
 
-                       default:
-                               admonish(file, "unable to lock and open");
-                               break;
+               default:
+                       admonish(file, "unable to lock and open");
+                       break;
                }
                return 1;
        }
@@ -428,13 +428,14 @@ annosbr(int fd, char *file, char *comp, char *text, int inplace,
                strncpy(buffer, m_backup(file), sizeof(buffer));
                if (rename(file, buffer) == NOTOK) {
                        switch (errno) {
-                               case ENOENT:  /* unlinked early - no annotations */
-                                       unlink(tmpfil);
-                                       break;
+                       case ENOENT:  /* unlinked early - no annotations */
+                               unlink(tmpfil);
+                               break;
 
-                               default:
-                                       admonish(buffer, "unable to rename %s to", file);
-                                       break;
+                       default:
+                               admonish(buffer, "unable to rename %s to",
+                                               file);
+                               break;
                        }
                        return 1;
                }
index b835acb..ad3c998 100644 (file)
--- a/uip/ap.c
+++ b/uip/ap.c
@@ -75,44 +75,44 @@ main(int argc, char **argv)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, switches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, switches);
-                                       done(1);
-
-                               case UNKWNSW:
-                                       adios(NULL, "-%s unknown", cp);
-
-                               case HELPSW:
-                                       snprintf(buf, sizeof(buf), "%s [switches] addrs ...", invo_name);
-                                       print_help(buf, switches, 1);
-                                       done(1);
-                               case VERSIONSW:
-                                       print_version(invo_name);
-                                       done(1);
-
-                               case FORMSW:
-                                       if (!(form = *argp++) || *form == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       format = NULL;
-                                       continue;
-                               case FMTSW:
-                                       if (!(format = *argp++) || *format == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       form = NULL;
-                                       continue;
-
-                               case WIDTHSW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       width = atoi(cp);
-                                       continue;
-
-                               case NORMSW:
-                                       normalize = AD_HOST;
-                                       continue;
-                               case NNORMSW:
-                                       normalize = AD_NHST;
-                                       continue;
+                       case AMBIGSW:
+                               ambigsw(cp, switches);
+                               done(1);
+
+                       case UNKWNSW:
+                               adios(NULL, "-%s unknown", cp);
+
+                       case HELPSW:
+                               snprintf(buf, sizeof(buf), "%s [switches] addrs ...", invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
+
+                       case FORMSW:
+                               if (!(form = *argp++) || *form == '-')
+                                       adios(NULL, "missing argument to %s", argp[-2]);
+                               format = NULL;
+                               continue;
+                       case FMTSW:
+                               if (!(format = *argp++) || *format == '-')
+                                       adios(NULL, "missing argument to %s", argp[-2]);
+                               form = NULL;
+                               continue;
+
+                       case WIDTHSW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s", argp[-2]);
+                               width = atoi(cp);
+                               continue;
+
+                       case NORMSW:
+                               normalize = AD_HOST;
+                               continue;
+                       case NNORMSW:
+                               normalize = AD_NHST;
+                               continue;
                        }
                }
                if (addrp > NADDRS)
index 0e7c53a..66831c1 100644 (file)
@@ -398,43 +398,43 @@ cpybrst(FILE *in, FILE *out, char *ifile, char *ofile, int len)
                if (c == 0)
                        continue;
                switch (state) {
-                       case S1:
-                               switch (c) {
-                                       case '-':
-                                               state = S3;
-                                               break;
-
-                                       default:
-                                               state = S2;
-                                       case '\n':
-                                               fputc(c, out);
-                                               break;
-                               }
+               case S1:
+                       switch (c) {
+                       case '-':
+                               state = S3;
                                break;
 
-                       case S2:
-                               switch (c) {
-                                       case '\n':
-                                               state = S1;
-                                       default:
-                                               fputc(c, out);
-                                               break;
-                               }
+                       default:
+                               state = S2;
+                       case '\n':
+                               fputc(c, out);
+                               break;
+                       }
+                       break;
+
+               case S2:
+                       switch (c) {
+                       case '\n':
+                               state = S1;
+                       default:
+                               fputc(c, out);
+                               break;
+                       }
+                       break;
+
+               case S3:
+                       switch (c) {
+                       case ' ':
+                               state = S2;
                                break;
 
-                       case S3:
-                               switch (c) {
-                                       case ' ':
-                                               state = S2;
-                                               break;
-
-                                       default:
-                                               state = (c == '\n') ? S1 : S2;
-                                               fputc('-', out);
-                                               fputc(c, out);
-                                               break;
-                               }
+                       default:
+                               state = (c == '\n') ? S1 : S2;
+                               fputc('-', out);
+                               fputc(c, out);
                                break;
+                       }
+                       break;
                }
        }
 
index a256f71..5b9a9f1 100644 (file)
@@ -199,26 +199,26 @@ try_it_again:
                        if (!(argp = getans("\nDisposition? ", aqrunl)))
                                done(1);
                        switch (i = smatch(*argp, aqrunl)) {
-                               case NOSW:
-                                       done(0);
-                               case NEWSW:
-                                       use = NOUSE;
-                                       goto try_it_again;
-                               case YESW:
-                                       break;
-                               case USELSW:
-                                       use++;
-                                       goto edit_it;
-                               case LISTDSW:
-                                       showfile(++argp, drft);
-                                       break;
-                               case REFILSW:
-                                       if (refile(++argp, drft) == 0)
-                                               i = YESW;
-                                       break;
-                               default:
-                                       advise(NULL, "say what?");
-                                       break;
+                       case NOSW:
+                               done(0);
+                       case NEWSW:
+                               use = NOUSE;
+                               goto try_it_again;
+                       case YESW:
+                               break;
+                       case USELSW:
+                               use++;
+                               goto edit_it;
+                       case LISTDSW:
+                               showfile(++argp, drft);
+                               break;
+                       case REFILSW:
+                               if (refile(++argp, drft) == 0)
+                                       i = YESW;
+                               break;
+                       default:
+                               advise(NULL, "say what?");
+                               break;
                        }
                }
        } else if (use) {
index 30ff189..82dfdcc 100644 (file)
@@ -81,36 +81,39 @@ main(int argc, char **argv)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, switches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, switches);
-                                       done(1);
-                               case UNKWNSW:
-                                       adios(NULL, "-%s unknown", cp);
-
-                               case HELPSW:
-                                       snprintf(buf, sizeof(buf), "%s [switches] [aliasfiles ...]", invo_name);
-                                       print_help(buf, switches, 0);
-                                       done(1);
-                               case VERSIONSW:
-                                       print_version(invo_name);
-                                       done(1);
-
-                               case MAILSW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       if (mail)
-                                               adios(NULL, "mail to one address only");
-                                       else
-                                               mail = cp;
-                                       continue;
-
-                               case SERCHSW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       if (dp >= NDIRS)
-                                               adios(NULL, "more than %d directories", NDIRS);
-                                       dirs[dp++] = cp;
-                                       continue;
+                       case AMBIGSW:
+                               ambigsw(cp, switches);
+                               done(1);
+                       case UNKWNSW:
+                               adios(NULL, "-%s unknown", cp);
+
+                       case HELPSW:
+                               snprintf(buf, sizeof(buf), "%s [switches] [aliasfiles ...]", invo_name);
+                               print_help(buf, switches, 0);
+                               done(1);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
+
+                       case MAILSW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               if (mail)
+                                       adios(NULL, "mail to one address only");
+                               else
+                                       mail = cp;
+                               continue;
+
+                       case SERCHSW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               if (dp >= NDIRS)
+                                       adios(NULL, "more than %d directories",
+                                                       NDIRS);
+                               dirs[dp++] = cp;
+                               continue;
                        }
                }
                akv[akp++] = cp;
@@ -343,30 +346,30 @@ setup(void)
                        adios("pipe", "unable to");
 
                switch (fork()) {
-                       case NOTOK:
-                               adios("fork", "unable to");
-
-                       case OK:
-                               close(pd[1]);
-                               if (pd[0] != 0) {
-                                       dup2(pd[0], 0);
-                                       close(pd[0]);
-                               }
-                               if ((fd = open("/dev/null", O_WRONLY))
-                                               != NOTOK)
-                                       if (fd != 1) {
-                                               dup2(fd, 1);
-                                               close(fd);
-                                       }
-                               execlp(mailproc, mhbasename(mailproc),
-                                               mail, "-subject", invo_name,
-                                               NULL);
-                               adios(mailproc, "unable to exec ");
-
-                       default:
+               case NOTOK:
+                       adios("fork", "unable to");
+
+               case OK:
+                       close(pd[1]);
+                       if (pd[0] != 0) {
+                               dup2(pd[0], 0);
                                close(pd[0]);
-                               out = fdopen(pd[1], "w");
-                               fprintf(out, "%s: the following is suspicious\n\n", invo_name);
+                       }
+                       if ((fd = open("/dev/null", O_WRONLY))
+                                       != NOTOK)
+                               if (fd != 1) {
+                                       dup2(fd, 1);
+                                       close(fd);
+                               }
+                       execlp(mailproc, mhbasename(mailproc),
+                                       mail, "-subject", invo_name,
+                                       NULL);
+                       adios(mailproc, "unable to exec ");
+
+               default:
+                       close(pd[0]);
+                       out = fdopen(pd[1], "w");
+                       fprintf(out, "%s: the following is suspicious\n\n", invo_name);
                }
        }
 }
index 27be4a5..9ecfea1 100644 (file)
@@ -64,63 +64,67 @@ main(int argc, char **argv)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, switches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, switches);
-                                       done(1);
-                               case UNKWNSW:
-                                       adios(NULL, "-%s unknown", cp);
-
-                               case HELPSW:
-                                       snprintf(buf, sizeof(buf), "%s [+folder] [msg] [switches]", invo_name);
-                                       print_help(buf, switches, 1);
-                                       done(1);
-                               case VERSIONSW:
-                                       print_version(invo_name);
-                                       done(1);
-
-                               case ANNOSW:
-                                       anot++;
-                                       continue;
-                               case NANNOSW:
-                                       anot = 0;
-                                       continue;
-
-                               case EDITRSW:
-                                       if (!(ed = *argp++) || *ed == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       nedit = 0;
-                                       continue;
-                               case NEDITSW:
-                                       nedit++;
-                                       continue;
-
-                               case WHATSW:
-                                       if (!(whatnowproc = *argp++) || *whatnowproc == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       nwhat = 0;
-                                       continue;
-                               case NWHATSW:
-                                       nwhat++;
-                                       continue;
-
-                               case FILESW:
-                                       if (file)
-                                               adios(NULL, "only one file at a time!");
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       file = getcpy(expanddir(cp));
-                                       continue;
-                               case FORMSW:
-                                       if (!(form = *argp++) || *form == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       continue;
-
-                               case INPLSW:
-                                       inplace++;
-                                       continue;
-                               case NINPLSW:
-                                       inplace = 0;
-                                       continue;
+                       case AMBIGSW:
+                               ambigsw(cp, switches);
+                               done(1);
+                       case UNKWNSW:
+                               adios(NULL, "-%s unknown", cp);
+
+                       case HELPSW:
+                               snprintf(buf, sizeof(buf), "%s [+folder] [msg] [switches]", invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
+
+                       case ANNOSW:
+                               anot++;
+                               continue;
+                       case NANNOSW:
+                               anot = 0;
+                               continue;
+
+                       case EDITRSW:
+                               if (!(ed = *argp++) || *ed == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               nedit = 0;
+                               continue;
+                       case NEDITSW:
+                               nedit++;
+                               continue;
+
+                       case WHATSW:
+                               if (!(whatnowproc = *argp++) || *whatnowproc == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               nwhat = 0;
+                               continue;
+                       case NWHATSW:
+                               nwhat++;
+                               continue;
+
+                       case FILESW:
+                               if (file)
+                                       adios(NULL, "only one file at a time!");
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               file = getcpy(expanddir(cp));
+                               continue;
+                       case FORMSW:
+                               if (!(form = *argp++) || *form == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
+
+                       case INPLSW:
+                               inplace++;
+                               continue;
+                       case NINPLSW:
+                               inplace = 0;
+                               continue;
                        }
                }
                if (*cp == '+' || *cp == '@') {
index 319e496..396aca8 100644 (file)
@@ -48,58 +48,57 @@ distout(char *drft, char *msgnam, char *backup)
        for (state = FLD, resent = NULL;;)
                switch (state = m_getfld (state, name, buffer,
                                sizeof buffer, ifp)) {
-                       case FLD:
-                       case FLDPLUS:
-                       case FLDEOF:
-                               if (uprf(name, "distribute-"))
-                                       snprintf(name, sizeof(name), "%s%s",
-                                                       "Resent", &name[10]);
-                               if (uprf(name, "distribution-"))
-                                       snprintf(name, sizeof(name), "%s%s",
-                                                       "Resent", &name[12]);
-                               if (!uprf(name, "resent")) {
-                                       advise(NULL, BADHDR, "draft", name);
-                                       goto leave_bad;
-                               }
-                               if (state == FLD)
-                                       resent = add(":", add(name, resent));
+               case FLD:
+               case FLDPLUS:
+               case FLDEOF:
+                       if (uprf(name, "distribute-"))
+                               snprintf(name, sizeof(name), "%s%s",
+                                               "Resent", &name[10]);
+                       if (uprf(name, "distribution-"))
+                               snprintf(name, sizeof(name), "%s%s",
+                                               "Resent", &name[12]);
+                       if (!uprf(name, "resent")) {
+                               advise(NULL, BADHDR, "draft", name);
+                               goto leave_bad;
+                       }
+                       if (state == FLD)
+                               resent = add(":", add(name, resent));
+                       resent = add(buffer, resent);
+                       fprintf(ofp, "%s: %s", name, buffer);
+                       while (state == FLDPLUS) {
+                               state = m_getfld(state, name, buffer,
+                                               sizeof buffer, ifp);
                                resent = add(buffer, resent);
-                               fprintf(ofp, "%s: %s", name, buffer);
-                               while (state == FLDPLUS) {
-                                       state = m_getfld(state, name, buffer,
-                                                       sizeof buffer, ifp);
-                                       resent = add(buffer, resent);
-                                       fputs(buffer, ofp);
-                               }
-                               if (state == FLDEOF)
-                                       goto process;
-                               break;
-
-                       case BODY:
-                       case BODYEOF:
-                               for (dp = buffer; *dp; dp++)
-                                       if (!isspace(*dp)) {
-                                               advise(NULL, BADTXT, "draft");
-                                               goto leave_bad;
-                                       }
-
-                       case FILEEOF:
+                               fputs(buffer, ofp);
+                       }
+                       if (state == FLDEOF)
                                goto process;
+                       break;
 
-                       case LENERR:
-                       case FMTERR:
-                               advise(NULL, BADRFT, "draft");
-               leave_bad: ;
-                               fclose(ifp);
-                               fclose(ofp);
-                               unlink(drft);
-                               if (rename(backup, drft) == NOTOK)
-                                       adios(drft, "unable to rename %s to",
-                                                       backup);
-                               return NOTOK;
-
-                       default:
-                               adios(NULL, "getfld() returned %d", state);
+               case BODY:
+               case BODYEOF:
+                       for (dp = buffer; *dp; dp++)
+                               if (!isspace(*dp)) {
+                                       advise(NULL, BADTXT, "draft");
+                                       goto leave_bad;
+                               }
+
+               case FILEEOF:
+                       goto process;
+
+               case LENERR:
+               case FMTERR:
+                       advise(NULL, BADRFT, "draft");
+leave_bad: ;
+                       fclose(ifp);
+                       fclose(ofp);
+                       unlink(drft);
+                       if (rename(backup, drft) == NOTOK)
+                               adios(drft, "unable to rename %s to", backup);
+                       return NOTOK;
+
+               default:
+                       adios(NULL, "getfld() returned %d", state);
                }
 process: ;
        fclose(ifp);
@@ -153,56 +152,55 @@ ready_msg(char *msgnam)
                adios(NULL, "no file descriptors -- you lose big");
        unlink(tmpfil);
 
-       for (state = FLD;;)
-               switch (state = m_getfld (state, name, buffer, sizeof buffer,
-                               ifp)) {
-                       case FLD:
-                       case FLDPLUS:
-                       case FLDEOF:
-                               if (uprf(name, "resent"))
-                                       fprintf(ofp, "Prev-");
-                               fprintf(ofp, "%s: %s", name, buffer);
-                               while (state == FLDPLUS) {
-                                       state = m_getfld(state, name, buffer,
-                                                       sizeof buffer, ifp);
-                                       fputs(buffer, ofp);
-                               }
-                               if (state == FLDEOF)
-                                       goto process;
-                               break;
-
-                       case BODY:
-                       case BODYEOF:
-                               fclose(ofp);
-
-                               cp = m_mktemp2(NULL, "dist", &txtfd, NULL);
-                               if (cp == NULL) {
-                                       adios("distsbr", "unable to create temporary file");
-                               }
-                               fchmod(txtfd, 0600);
-                               strncpy(tmpfil, cp, sizeof(tmpfil));
-                               if ((out = dup(txtfd)) == NOTOK
-                                               || (ofp = fdopen(out, "w"))
-                                               == NULL)
-                                       adios(NULL, "no file descriptors -- you lose big");
-                               unlink(tmpfil);
-                               fprintf(ofp, "\n%s", buffer);
-                               while (state == BODY) {
-                                       state = m_getfld(state, name, buffer,
-                                                       sizeof buffer, ifp);
-                                       fputs(buffer, ofp);
-                               }
-                       case FILEEOF:
+       for (state = FLD;;) {
+               state = m_getfld(state, name, buffer, sizeof buffer, ifp);
+               switch (state) {
+               case FLD:
+               case FLDPLUS:
+               case FLDEOF:
+                       if (uprf(name, "resent"))
+                               fprintf(ofp, "Prev-");
+                       fprintf(ofp, "%s: %s", name, buffer);
+                       while (state == FLDPLUS) {
+                               state = m_getfld(state, name, buffer,
+                                               sizeof buffer, ifp);
+                               fputs(buffer, ofp);
+                       }
+                       if (state == FLDEOF)
                                goto process;
-
-                       case LENERR:
-                       case FMTERR:
-                               adios(NULL, "format error in message %s",
-                                               msgnam);
-
-                       default:
-                               adios(NULL, "getfld() returned %d", state);
+                       break;
+
+               case BODY:
+               case BODYEOF:
+                       fclose(ofp);
+
+                       cp = m_mktemp2(NULL, "dist", &txtfd, NULL);
+                       if (cp == NULL) {
+                               adios("distsbr", "unable to create temporary file");
+                       }
+                       fchmod(txtfd, 0600);
+                       strncpy(tmpfil, cp, sizeof(tmpfil));
+                       if ((out = dup(txtfd)) == NOTOK
+                                       || (ofp = fdopen(out, "w")) == NULL)
+                               adios(NULL, "no file descriptors -- you lose big");
+                       unlink(tmpfil);
+                       fprintf(ofp, "\n%s", buffer);
+                       while (state == BODY) {
+                               state = m_getfld(state, name, buffer,
+                                               sizeof buffer, ifp);
+                               fputs(buffer, ofp);
+                       }
+               case FILEEOF:
+                       goto process;
+
+               case LENERR:
+               case FMTERR:
+                       adios(NULL, "format error in message %s", msgnam);
+
+               default:
+                       adios(NULL, "getfld() returned %d", state);
                }
+       }
 process: ;
        fclose(ifp);
        fclose(ofp);
index a5accf5..d5f0c59 100644 (file)
--- a/uip/dp.c
+++ b/uip/dp.c
@@ -68,36 +68,39 @@ main(int argc, char **argv)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, switches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, switches);
-                                       done(1);
-                               case UNKWNSW:
-                                       adios(NULL, "-%s unknown", cp);
-
-                               case HELPSW:
-                                       snprintf(buf, sizeof(buf), "%s [switches] dates ...", invo_name);
-                                       print_help(buf, switches, 1);
-                                       done(1);
-                               case VERSIONSW:
-                                       print_version(invo_name);
-                                       done(1);
-
-                               case FORMSW:
-                                       if (!(form = *argp++) || *form == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       format = NULL;
-                                       continue;
-                               case FMTSW:
-                                       if (!(format = *argp++) || *format == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       form = NULL;
-                                       continue;
-
-                               case WIDTHSW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       width = atoi(cp);
-                                       continue;
+                       case AMBIGSW:
+                               ambigsw(cp, switches);
+                               done(1);
+                       case UNKWNSW:
+                               adios(NULL, "-%s unknown", cp);
+
+                       case HELPSW:
+                               snprintf(buf, sizeof(buf), "%s [switches] dates ...", invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
+
+                       case FORMSW:
+                               if (!(form = *argp++) || *form == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               format = NULL;
+                               continue;
+                       case FMTSW:
+                               if (!(format = *argp++) || *format == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               form = NULL;
+                               continue;
+
+                       case WIDTHSW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               width = atoi(cp);
+                               continue;
                        }
                }
                if (datep > NDATES)
index 15cee8f..cc668cd 100644 (file)
@@ -54,21 +54,21 @@ mbx_open(char *file, int mbx_style, uid_t uid, gid_t gid, mode_t mode)
                                == NOTOK) {
                        switch (errno) {
 #if defined(FCNTL_LOCKING) || defined(LOCKF_LOCKING)
-                               case EACCES:
-                               case EAGAIN:
+                       case EACCES:
+                       case EAGAIN:
 #endif
 
 #ifdef FLOCK_LOCKING
-                               case EWOULDBLOCK:
+                       case EWOULDBLOCK:
 #endif
-                               case ETXTBSY:
-                                       j = errno;
-                                       sleep(5);
-                                       break;
+                       case ETXTBSY:
+                               j = errno;
+                               sleep(5);
+                               break;
 
-                               default:
-                                       /* just return error */
-                                       return NOTOK;
+                       default:
+                               /* just return error */
+                               return NOTOK;
                        }
                }
 
@@ -100,14 +100,14 @@ mbx_open(char *file, int mbx_style, uid_t uid, gid_t gid, mode_t mode)
 
                /* check the maildrop */
                switch (mbx_style) {
-                       case MMDF_FORMAT:
-                       default:
-                               status = mbx_chk_mmdf(fd);
-                               break;
+               case MMDF_FORMAT:
+               default:
+                       status = mbx_chk_mmdf(fd);
+                       break;
 
-                       case MBOX_FORMAT:
-                               status = mbx_chk_mbox(fd);
-                               break;
+               case MBOX_FORMAT:
+                       status = mbx_chk_mbox(fd);
+                       break;
                }
 
                /* if error, attempt to close it */
@@ -294,147 +294,151 @@ mbx_copy(char *mailbox, int mbx_style, int md, int fd, int mapping,
        size = 0;
 
        switch (mbx_style) {
-               case MMDF_FORMAT:
-               default:
-                       j = strlen(mmdlm1);
-                       if (write(md, mmdlm1, j) != j)
-                               return NOTOK;
-                       start = lseek(md, (off_t) 0, SEEK_CUR);
-
-                       if (text) {
-                               i = strlen(text);
-                               if (write(md, text, i) != i)
-                                       return NOTOK;
-                               for (cp = text; *cp++; size++)
-                                       if (*cp == '\n')
-                                               size++;
-                       }
+       case MMDF_FORMAT:
+       default:
+               j = strlen(mmdlm1);
+               if (write(md, mmdlm1, j) != j)
+                       return NOTOK;
+               start = lseek(md, (off_t) 0, SEEK_CUR);
 
-                       while ((i = read(fd, buffer, sizeof(buffer))) > 0) {
-                               for (j = 0; (j = stringdex(mmdlm1, buffer)) >= 0; buffer[j]++)
-                                       continue;
-                               for (j = 0; (j = stringdex(mmdlm2, buffer)) >= 0; buffer[j]++)
-                                       continue;
-                               if (write(md, buffer, i) != i)
-                                       return NOTOK;
-                               if (mapping)
-                                       for (cp = buffer; i-- > 0; size++)
-                                               if (*cp++ == '\n')
-                                                       size++;
-                       }
+               if (text) {
+                       i = strlen(text);
+                       if (write(md, text, i) != i)
+                               return NOTOK;
+                       for (cp = text; *cp++; size++)
+                               if (*cp == '\n')
+                                       size++;
+               }
 
-                       stop = lseek(md, (off_t) 0, SEEK_CUR);
-                       j = strlen(mmdlm2);
-                       if (write(md, mmdlm2, j) != j)
+               while ((i = read(fd, buffer, sizeof(buffer))) > 0) {
+                       for (j = 0; (j = stringdex(mmdlm1, buffer)) >= 0; buffer[j]++)
+                               continue;
+                       for (j = 0; (j = stringdex(mmdlm2, buffer)) >= 0; buffer[j]++)
+                               continue;
+                       if (write(md, buffer, i) != i)
                                return NOTOK;
                        if (mapping)
-                               map_write(mailbox, md, 0, (long) 0, start,
-                                               stop, pos, size, noisy);
+                               for (cp = buffer; i-- > 0; size++)
+                                       if (*cp++ == '\n')
+                                               size++;
+               }
 
-                       return (i != NOTOK ? OK : NOTOK);
+               stop = lseek(md, (off_t) 0, SEEK_CUR);
+               j = strlen(mmdlm2);
+               if (write(md, mmdlm2, j) != j)
+                       return NOTOK;
+               if (mapping)
+                       map_write(mailbox, md, 0, (long) 0, start, stop, pos,
+                                       size, noisy);
 
-               case MBOX_FORMAT:
-                       if ((j = dup(fd)) == NOTOK)
-                               return NOTOK;
-                       if ((fp = fdopen(j, "r")) == NULL) {
-                               close(j);
-                               return NOTOK;
-                       }
-                       start = lseek(md, (off_t) 0, SEEK_CUR);
+               return (i != NOTOK ? OK : NOTOK);
 
-                       /* If text is given, we add it to top of message */
-                       if (text) {
-                               i = strlen(text);
-                               if (write(md, text, i) != i)
-                                       return NOTOK;
-                               for (cp = text; *cp++; size++)
-                                       if (*cp == '\n')
-                                               size++;
-                       }
+       case MBOX_FORMAT:
+               if ((j = dup(fd)) == NOTOK)
+                       return NOTOK;
+               if ((fp = fdopen(j, "r")) == NULL) {
+                       close(j);
+                       return NOTOK;
+               }
+               start = lseek(md, (off_t) 0, SEEK_CUR);
 
-                       for (j = 0; fgets(buffer, sizeof(buffer), fp) != NULL;
-                                       j++) {
+               /* If text is given, we add it to top of message */
+               if (text) {
+                       i = strlen(text);
+                       if (write(md, text, i) != i)
+                               return NOTOK;
+                       for (cp = text; *cp++; size++)
+                               if (*cp == '\n')
+                                       size++;
+               }
 
+               for (j = 0; fgets(buffer, sizeof(buffer), fp) != NULL; j++) {
+                       /*
+                       ** Check the first line, and make some changes.
+                       */
+                       if (j == 0 && !text) {
                                /*
-                               ** Check the first line, and make some changes.
+                               ** Change the "Return-Path:" field
+                               ** (if in first line) back to "From ".
                                */
-                               if (j == 0 && !text) {
+                               if (!strncmp(buffer, "Return-Path:", 12)) {
+                                       char tmpbuffer[BUFSIZ];
+                                       char *tp, *ep, *fp;
+
+                                       strncpy(tmpbuffer, buffer,
+                                                       sizeof(tmpbuffer));
+                                       ep = tmpbuffer + 13;
+                                       if (!(fp = strchr(ep + 1, ' ')))
+                                               fp = strchr(ep + 1, '\n');
+                                       tp = dctime(dlocaltimenow());
+                                               snprintf(buffer, sizeof(buffer), "From %.*s  %s", (int)(fp - ep), ep, tp);
+                               } else if (!strncmp(buffer, "X-Envelope-From:",
+                                               16)) {
                                        /*
-                                       ** Change the "Return-Path:" field
-                                       ** (if in first line) back to "From ".
+                                       ** Change the "X-Envelope-From:"
+                                       ** field (if first line) back
+                                       ** to "From ".
                                        */
-                                       if (!strncmp(buffer, "Return-Path:",
-                                                       12)) {
-                                               char tmpbuffer[BUFSIZ];
-                                               char *tp, *ep, *fp;
-
-                                               strncpy(tmpbuffer, buffer, sizeof(tmpbuffer));
-                                               ep = tmpbuffer + 13;
-                                               if (!(fp = strchr(ep + 1, ' ')))
-                                                       fp = strchr(ep + 1, '\n');
-                                               tp = dctime(dlocaltimenow());
-                                               snprintf(buffer, sizeof(buffer), "From %.*s  %s", (int)(fp - ep), ep, tp);
-                                       } else if (!strncmp(buffer, "X-Envelope-From:", 16)) {
-                                               /*
-                                               ** Change the "X-Envelope-From:"
-                                               ** field (if first line) back
-                                               ** to "From ".
-                                               */
-                                               char tmpbuffer[BUFSIZ];
-                                               char *ep;
-
-                                               strncpy(tmpbuffer, buffer, sizeof(tmpbuffer));
-                                               ep = tmpbuffer + 17;
-                                               snprintf(buffer, sizeof(buffer), "From %s", ep);
-                                       } else if (strncmp(buffer, "From ", 5)) {
-                                               /*
-                                               ** If there is already a "From "
-                                               ** line, then leave it alone.
-                                               ** Else we add one.
-                                               */
-                                               char tmpbuffer[BUFSIZ];
-                                               char *tp, *ep;
-
-                                               strncpy(tmpbuffer, buffer, sizeof(tmpbuffer));
-                                               ep = "nobody@nowhere";
-                                               tp = dctime(dlocaltimenow());
-                                               snprintf(buffer, sizeof(buffer), "From %s  %s%s", ep, tp, tmpbuffer);
-                                       }
+                                       char tmpbuffer[BUFSIZ];
+                                       char *ep;
+
+                                       strncpy(tmpbuffer, buffer,
+                                                       sizeof(tmpbuffer));
+                                       ep = tmpbuffer + 17;
+                                       snprintf(buffer, sizeof(buffer),
+                                                       "From %s", ep);
+                               } else if (strncmp(buffer, "From ", 5)) {
+                                       /*
+                                       ** If there is already a "From "
+                                       ** line, then leave it alone.
+                                       ** Else we add one.
+                                       */
+                                       char tmpbuffer[BUFSIZ];
+                                       char *tp, *ep;
+
+                                       strncpy(tmpbuffer, buffer,      
+                                                       sizeof(tmpbuffer));
+                                       ep = "nobody@nowhere";
+                                       tp = dctime(dlocaltimenow());
+                                       snprintf(buffer, sizeof(buffer),
+                                                       "From %s  %s%s",
+                                                       ep, tp, tmpbuffer);
                                }
+                       }
 
-                               /*
-                               ** If this is not first line, and begins with
-                               ** "From ", then prepend line with ">".
-                               */
-                               if (j != 0 && strncmp(buffer, "From ", 5) == 0) {
-                                       write(md, ">", 1);
-                                       size++;
-                               }
-                               i = strlen(buffer);
-                               if (write(md, buffer, i) != i) {
-                                       fclose(fp);
-                                       return NOTOK;
-                               }
-                               if (mapping)
-                                       for (cp = buffer; i-- > 0; size++)
-                                               if (*cp++ == '\n')
-                                                       size++;
+                       /*
+                       ** If this is not first line, and begins with
+                       ** "From ", then prepend line with ">".
+                       */
+                       if (j != 0 && strncmp(buffer, "From ", 5) == 0) {
+                               write(md, ">", 1);
+                               size++;
                        }
-                       if (write(md, "\n", 1) != 1) {
+                       i = strlen(buffer);
+                       if (write(md, buffer, i) != i) {
                                fclose(fp);
                                return NOTOK;
                        }
                        if (mapping)
-                               size += 2;
-
+                               for (cp = buffer; i-- > 0; size++)
+                                       if (*cp++ == '\n')
+                                               size++;
+               }
+               if (write(md, "\n", 1) != 1) {
                        fclose(fp);
-                       lseek(fd, (off_t) 0, SEEK_END);
-                       stop = lseek(md, (off_t) 0, SEEK_CUR);
-                       if (mapping)
-                               map_write(mailbox, md, 0, (long) 0, start,
-                                               stop, pos, size, noisy);
+                       return NOTOK;
+               }
+               if (mapping)
+                       size += 2;
+
+               fclose(fp);
+               lseek(fd, (off_t) 0, SEEK_END);
+               stop = lseek(md, (off_t) 0, SEEK_CUR);
+               if (mapping)
+                       map_write(mailbox, md, 0, (long) 0, start, stop, pos,
+                                       size, noisy);
 
-                       return OK;
+               return OK;
        }
 }
 
@@ -591,35 +595,35 @@ map_write(char *mailbox, int md, int id, long last, off_t start,
                }
 
                switch (i = mbx_read(fp, 0, &rp, noisy)) {
-                       case NOTOK:
-                               fclose(fp);
-                               mbx_close(file, fd);
-                               return NOTOK;
+               case NOTOK:
+                       fclose(fp);
+                       mbx_close(file, fd);
+                       return NOTOK;
 
-                       case OK:
-                               fclose(fp);
-                               break;
+               case OK:
+                       fclose(fp);
+                       break;
 
-                       default:
-                               d1.d_id = 0;
-                               for (dp = rp; i-- >0; dp++) {
-                                       if (dp->d_start == start)
-                                               dp->d_id = id;
-                                       lseek(fd, (off_t) (++d1.d_id * sizeof(*dp)), SEEK_SET);
-                                       if (write(fd, (char *) dp, sizeof(*dp)) != sizeof(*dp)) {
-                                               if (noisy)
-                                                       admonish(file, "write error");
-                                               mbx_close(file, fd);
-                                               fclose(fp);
-                                               return NOTOK;
-                                       }
+               default:
+                       d1.d_id = 0;
+                       for (dp = rp; i-- >0; dp++) {
+                               if (dp->d_start == start)
+                                       dp->d_id = id;
+                               lseek(fd, (off_t) (++d1.d_id * sizeof(*dp)),
+                                               SEEK_SET);
+                               if (write(fd, (char *)dp, sizeof(*dp)) != sizeof(*dp)) {
+                                       if (noisy)
+                                               admonish(file, "write error");
+                                       mbx_close(file, fd);
+                                       fclose(fp);
+                                       return NOTOK;
                                }
-                               free((char *) rp);
-                               fclose(fp);
-                               break;
+                       }
+                       free((char *) rp);
+                       fclose(fp);
+                       break;
                }
-       }
-       else {
+       } else {
                if (last == 0)
                        last = d1.d_start;
                dp = &d2;
index adda294..160daaf 100644 (file)
@@ -63,30 +63,33 @@ main(int argc, char **argv)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, switches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, switches);
-                                       done(1);
-                               case UNKWNSW:
-                                       adios(NULL, "-%s unknown", cp);
-
-                               case HELPSW:
-                                       snprintf(buf, sizeof(buf), "%s [switches]", invo_name);
-                                       print_help(buf, switches, 1);
-                                       done(1);
-                               case VERSIONSW:
-                                       print_version(invo_name);
-                                       done(1);
-
-                               case FORMSW:
-                                       if (!(form = *argp++) || *form == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       format = NULL;
-                                       continue;
-                               case FMTSW:
-                                       if (!(format = *argp++) || *format == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       form = NULL;
-                                       continue;
+                       case AMBIGSW:
+                               ambigsw(cp, switches);
+                               done(1);
+                       case UNKWNSW:
+                               adios(NULL, "-%s unknown", cp);
+
+                       case HELPSW:
+                               snprintf(buf, sizeof(buf), "%s [switches]",
+                                               invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
+
+                       case FORMSW:
+                               if (!(form = *argp++) || *form == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               format = NULL;
+                               continue;
+                       case FMTSW:
+                               if (!(format = *argp++) || *format == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               form = NULL;
+                               continue;
 
                        }
                }
index e219109..7f829f0 100644 (file)
@@ -140,101 +140,101 @@ main(int argc, char **argv)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, switches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, switches);
-                                       done(1);
-                               case UNKWNSW:
-                                       adios(NULL, "-%s unknown", cp);
-
-                               case HELPSW:
-                                       snprintf(buf, sizeof(buf), "%s [+folder] [msg] [switches]", invo_name);
-                                       print_help(buf, switches, 1);
-                                       done(1);
-                               case VERSIONSW:
-                                       print_version(invo_name);
-                                       done(1);
-
-                               case ALLSW:
-                                       all = 1;
-                                       continue;
-
-                               case NALLSW:
-                                       all = 0;
-                                       continue;
-
-                               case CREATSW:
-                                       fcreat = 1;
-                                       continue;
-                               case NCREATSW:
-                                       fcreat = -1;
-                                       continue;
-
-                               case FASTSW:
-                                       fshort++;
-                                       continue;
-                               case NFASTSW:
-                                       fshort = 0;
-                                       continue;
-
-                               case HDRSW:
-                                       fheader = 1;
-                                       continue;
-                               case NHDRSW:
-                                       fheader = -1;
-                                       continue;
-
-                               case PACKSW:
-                                       fpack++;
-                                       continue;
-                               case NPACKSW:
-                                       fpack = 0;
-                                       continue;
-
-                               case VERBSW:
-                                       fverb++;
-                                       continue;
-                               case NVERBSW:
-                                       fverb = 0;
-                                       continue;
-
-                               case RECURSW:
-                                       frecurse++;
-                                       continue;
-                               case NRECRSW:
-                                       frecurse = 0;
-                                       continue;
-
-                               case TOTALSW:
-                                       ftotal = 1;
-                                       continue;
-                               case NTOTLSW:
-                                       ftotal = -1;
-                                       continue;
-
-                               case PRNTSW:
-                                       printsw = 1;
-                                       continue;
-                               case NPRNTSW:
-                                       printsw = 0;
-                                       continue;
-
-                               case LISTSW:
-                                       listsw = 1;
-                                       continue;
-                               case NLISTSW:
-                                       listsw = 0;
-                                       continue;
-
-                               case PUSHSW:
-                                       pushsw = 1;
-                                       listsw = 1;
-                                       popsw  = 0;
-                                       continue;
-                               case POPSW:
-                                       popsw  = 1;
-                                       listsw = 1;
-                                       pushsw = 0;
-                                       continue;
+                       case AMBIGSW:
+                               ambigsw(cp, switches);
+                               done(1);
+                       case UNKWNSW:
+                               adios(NULL, "-%s unknown", cp);
+
+                       case HELPSW:
+                               snprintf(buf, sizeof(buf), "%s [+folder] [msg] [switches]", invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
+
+                       case ALLSW:
+                               all = 1;
+                               continue;
+
+                       case NALLSW:
+                               all = 0;
+                               continue;
+
+                       case CREATSW:
+                               fcreat = 1;
+                               continue;
+                       case NCREATSW:
+                               fcreat = -1;
+                               continue;
+
+                       case FASTSW:
+                               fshort++;
+                               continue;
+                       case NFASTSW:
+                               fshort = 0;
+                               continue;
+
+                       case HDRSW:
+                               fheader = 1;
+                               continue;
+                       case NHDRSW:
+                               fheader = -1;
+                               continue;
+
+                       case PACKSW:
+                               fpack++;
+                               continue;
+                       case NPACKSW:
+                               fpack = 0;
+                               continue;
+
+                       case VERBSW:
+                               fverb++;
+                               continue;
+                       case NVERBSW:
+                               fverb = 0;
+                               continue;
+
+                       case RECURSW:
+                               frecurse++;
+                               continue;
+                       case NRECRSW:
+                               frecurse = 0;
+                               continue;
+
+                       case TOTALSW:
+                               ftotal = 1;
+                               continue;
+                       case NTOTLSW:
+                               ftotal = -1;
+                               continue;
+
+                       case PRNTSW:
+                               printsw = 1;
+                               continue;
+                       case NPRNTSW:
+                               printsw = 0;
+                               continue;
+
+                       case LISTSW:
+                               listsw = 1;
+                               continue;
+                       case NLISTSW:
+                               listsw = 0;
+                               continue;
+
+                       case PUSHSW:
+                               pushsw = 1;
+                               listsw = 1;
+                               popsw  = 0;
+                               continue;
+                       case POPSW:
+                               popsw  = 1;
+                               listsw = 1;
+                               pushsw = 0;
+                               continue;
                        }
                }
                if (*cp == '+' || *cp == '@') {
index 3ce0b21..d51c57c 100644 (file)
@@ -120,113 +120,124 @@ main(int argc, char **argv)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, switches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, switches);
-                                       done(1);
-                               case UNKWNSW:
-                                       adios(NULL, "-%s unknown", cp);
-
-                               case HELPSW:
-                                       snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
-                                       print_help(buf, switches, 1);
-                                       done(1);
-                               case VERSIONSW:
-                                       print_version(invo_name);
-                                       done(1);
-
-                               case ANNOSW:
-                                       anot++;
-                                       continue;
-                               case NANNOSW:
-                                       anot = 0;
-                                       continue;
-
-                               case EDITRSW:
-                                       if (!(ed = *argp++) || *ed == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       nedit = 0;
-                                       continue;
-                               case NEDITSW:
-                                       nedit++;
-                                       continue;
-
-                               case WHATSW:
-                                       if (!(whatnowproc = *argp++) || *whatnowproc == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       nwhat = 0;
-                                       continue;
+                       case AMBIGSW:
+                               ambigsw(cp, switches);
+                               done(1);
+                       case UNKWNSW:
+                               adios(NULL, "-%s unknown", cp);
+
+                       case HELPSW:
+                               snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
+
+                       case ANNOSW:
+                               anot++;
+                               continue;
+                       case NANNOSW:
+                               anot = 0;
+                               continue;
+
+                       case EDITRSW:
+                               if (!(ed = *argp++) || *ed == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               nedit = 0;
+                               continue;
+                       case NEDITSW:
+                               nedit++;
+                               continue;
+
+                       case WHATSW:
+                               if (!(whatnowproc = *argp++) ||
+                                               *whatnowproc == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               nwhat = 0;
+                               continue;
 #ifdef MHE
-                               case BILDSW:
-                                       buildsw++;  /* fall... */
+                       case BILDSW:
+                               buildsw++;  /* fall... */
 #endif /* MHE */
-                               case NWHATSW:
-                                       nwhat++;
-                                       continue;
-
-                               case FILESW:
-                                       if (file)
-                                               adios(NULL, "only one file at a time!");
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       file = getcpy(expanddir(cp));
-                                       continue;
-                               case FILTSW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       filter = getcpy(etcpath(cp));
-                                       mime = 0;
-                                       continue;
-                               case FORMSW:
-                                       if (!(form = *argp++) || *form == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       continue;
-
-                               case FRMTSW:
-                                       filter = getcpy(etcpath(mhlforward));
-                                       continue;
-                               case NFRMTSW:
-                                       filter = NULL;
-                                       continue;
-
-                               case INPLSW:
-                                       inplace++;
-                                       continue;
-                               case NINPLSW:
-                                       inplace = 0;
-                                       continue;
-
-                               case MIMESW:
-                                       mime++;
-                                       filter = NULL;
-                                       continue;
-                               case NMIMESW:
-                                       mime = 0;
-                                       continue;
-
-                               case DGSTSW:
-                                       if (!(digest = *argp++) || *digest == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       mime = 0;
-                                       continue;
-                               case ISSUESW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       if ((issue = atoi(cp)) < 1)
-                                               adios(NULL, "bad argument %s %s", argp[-2], cp);
-                                       continue;
-                               case VOLUMSW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       if ((volume = atoi(cp)) < 1)
-                                               adios(NULL, "bad argument %s %s", argp[-2], cp);
-                                       continue;
-
-                               case BITSTUFFSW:
-                                       dashstuff = 1;  /* trinary logic */
-                                       continue;
-                               case NBITSTUFFSW:
-                                       dashstuff = -1;  /* trinary logic */
-                                       continue;
+                       case NWHATSW:
+                               nwhat++;
+                               continue;
+
+                       case FILESW:
+                               if (file)
+                                       adios(NULL, "only one file at a time!");
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               file = getcpy(expanddir(cp));
+                               continue;
+                       case FILTSW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               filter = getcpy(etcpath(cp));
+                               mime = 0;
+                               continue;
+                       case FORMSW:
+                               if (!(form = *argp++) || *form == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
+
+                       case FRMTSW:
+                               filter = getcpy(etcpath(mhlforward));
+                               continue;
+                       case NFRMTSW:
+                               filter = NULL;
+                               continue;
+
+                       case INPLSW:
+                               inplace++;
+                               continue;
+                       case NINPLSW:
+                               inplace = 0;
+                               continue;
+
+                       case MIMESW:
+                               mime++;
+                               filter = NULL;
+                               continue;
+                       case NMIMESW:
+                               mime = 0;
+                               continue;
+
+                       case DGSTSW:
+                               if (!(digest = *argp++) || *digest == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               mime = 0;
+                               continue;
+                       case ISSUESW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               if ((issue = atoi(cp)) < 1)
+                                       adios(NULL, "bad argument %s %s",
+                                                       argp[-2], cp);
+                               continue;
+                       case VOLUMSW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               if ((volume = atoi(cp)) < 1)
+                                       adios(NULL, "bad argument %s %s",
+                                                       argp[-2], cp);
+                               continue;
+
+                       case BITSTUFFSW:
+                               dashstuff = 1;  /* trinary logic */
+                               continue;
+                       case NBITSTUFFSW:
+                               dashstuff = -1;  /* trinary logic */
+                               continue;
                        }
                }
                if (*cp == '+' || *cp == '@') {
@@ -388,66 +399,67 @@ mhl_draft(int out, char *digest, int volume, int issue,
        for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++)
                sleep(5);
        switch (child_id) {
-               case NOTOK:
-                       adios("fork", "unable to");
+       case NOTOK:
+               adios("fork", "unable to");
 
-               case OK:
-                       close(pd[0]);
-                       dup2(pd[1], 1);
-                       close(pd[1]);
+       case OK:
+               close(pd[0]);
+               dup2(pd[1], 1);
+               close(pd[1]);
 
-                       i = 1;
-                       vec[i++] = "-forwall";
-                       vec[i++] = "-form";
-                       vec[i++] = filter;
+               i = 1;
+               vec[i++] = "-forwall";
+               vec[i++] = "-form";
+               vec[i++] = filter;
 
-                       if (digest) {
-                               vec[i++] = "-digest";
-                               vec[i++] = digest;
-                               vec[i++] = "-issue";
-                               snprintf(buf1, sizeof(buf1), "%d", issue);
-                               vec[i++] = buf1;
-                               vec[i++] = "-volume";
-                               snprintf(buf2, sizeof(buf2), "%d", volume);
-                               vec[i++] = buf2;
-                       }
+               if (digest) {
+                       vec[i++] = "-digest";
+                       vec[i++] = digest;
+                       vec[i++] = "-issue";
+                       snprintf(buf1, sizeof(buf1), "%d", issue);
+                       vec[i++] = buf1;
+                       vec[i++] = "-volume";
+                       snprintf(buf2, sizeof(buf2), "%d", volume);
+                       vec[i++] = buf2;
+               }
 
-                       /*
-                       ** Are we dashstuffing (quoting) the lines that begin
-                       ** with `-'.  We use the mhl default (don't add any
-                       ** flag) unless the user has specified a specific flag.
-                       */
-                       if (dashstuff > 0)
-                               vec[i++] = "-dashstuffing";
-                       else if (dashstuff < 0)
-                               vec[i++] = "-nodashstuffing";
+               /*
+               ** Are we dashstuffing (quoting) the lines that begin
+               ** with `-'.  We use the mhl default (don't add any
+               ** flag) unless the user has specified a specific flag.
+               */
+               if (dashstuff > 0)
+                       vec[i++] = "-dashstuffing";
+               else if (dashstuff < 0)
+                       vec[i++] = "-nodashstuffing";
 
-                       if (mp->numsel >= MAXARGS - i)
-                               adios(NULL, "more than %d messages for %s exec", MAXARGS - i, vec[0]);
+               if (mp->numsel >= MAXARGS - i)
+                       adios(NULL, "more than %d messages for %s exec",
+                                       MAXARGS - i, vec[0]);
 
-                       /*
-                       ** Now add the message names to filter.  We can only
-                       ** handle about 995 messages (because vec is fixed
-                       ** size), but that should be plenty.
-                       */
-                       for (msgnum = mp->lowsel;
-                                       msgnum <= mp->hghsel && i < sizeof(vec) - 1;
-                                       msgnum++)
-                               if (is_selected(mp, msgnum))
-                                       vec[i++] = getcpy(m_name(msgnum));
-                       vec[i] = NULL;
-
-                       execvp(mhlproc, vec);
-                       fprintf(stderr, "unable to exec ");
-                       perror(mhlproc);
-                       _exit(-1);
-
-               default:
-                       close(pd[1]);
-                       cpydata(pd[0], out, vec[0], file);
-                       close(pd[0]);
-                       pidXwait(child_id, mhlproc);
-                       break;
+               /*
+               ** Now add the message names to filter.  We can only
+               ** handle about 995 messages (because vec is fixed
+               ** size), but that should be plenty.
+               */
+               for (msgnum = mp->lowsel;
+                               msgnum <= mp->hghsel && i < sizeof(vec) - 1;
+                               msgnum++)
+                       if (is_selected(mp, msgnum))
+                               vec[i++] = getcpy(m_name(msgnum));
+               vec[i] = NULL;
+
+               execvp(mhlproc, vec);
+               fprintf(stderr, "unable to exec ");
+               perror(mhlproc);
+               _exit(-1);
+
+       default:
+               close(pd[1]);
+               cpydata(pd[0], out, vec[0], file);
+               close(pd[0]);
+               pidXwait(child_id, mhlproc);
+               break;
        }
 }
 
index 7d6d72b..f82f51b 100644 (file)
@@ -305,57 +305,54 @@ bad: ;
 
                        close_tcp_socket(data_fd), data_fd = NOTOK;
                }
-       } else {
-               if (ascii) {
-                       int c;
-                       FILE *in;
-
-                       if (!(in = fdopen(data_fd, "r"))) {
-                               perror("fdopen");
-                               goto bad;
-                       }
+       } else if (ascii) {
+               int c;
+               FILE *in;
 
-                       while ((c = getc(in)) != EOF) {
-                               if (c == '\r')
-                                       switch (c = getc(in)) {
-                                               case EOF:
-                                               case '\0':
-                                                       c = '\r';
-                                                       break;
+               if (!(in = fdopen(data_fd, "r"))) {
+                       perror("fdopen");
+                       goto bad;
+               }
 
-                                               case '\n':
-                                                       break;
+               while ((c = getc(in)) != EOF) {
+                       if (c == '\r')
+                               switch (c = getc(in)) {
+                               case EOF:
+                               case '\0':
+                                       c = '\r';
+                                       break;
 
-                                               default:
-                                                       putc('\r', fp);
-                                                       break;
-                                               }
+                               case '\n':
+                                       break;
 
-                               if (putc(c, fp) == EOF) {
-                                       perror("putc");
-                                       fclose(in);
-                                       data_fd = NOTOK;
-                                       goto bad;
+                               default:
+                                       putc('\r', fp);
+                                       break;
                                }
-                       }
 
-                       fclose(in);
-                       data_fd = NOTOK;
-               } else {
-                       while ((cc = read_tcp_socket(data_fd, buffer,
-                                       sizeof buffer)) > 0)
-                               if (fwrite(buffer, sizeof *buffer, cc, fp)
-                                               == 0) {
-                                       perror("fwrite");
-                                       goto bad;
-                               }
-                       if (cc < 0) {
-                               perror("read_tcp_socket");
+                       if (putc(c, fp) == EOF) {
+                               perror("putc");
+                               fclose(in);
+                               data_fd = NOTOK;
                                goto bad;
                        }
+               }
 
-                       close_tcp_socket(data_fd), data_fd = NOTOK;
+               fclose(in);
+               data_fd = NOTOK;
+       } else {
+               while ((cc = read_tcp_socket(data_fd, buffer,
+                               sizeof buffer)) > 0)
+                       if (fwrite(buffer, sizeof *buffer, cc, fp) == 0) {
+                               perror("fwrite");
+                               goto bad;
+                       }
+               if (cc < 0) {
+                       perror("read_tcp_socket");
+                       goto bad;
                }
+
+               close_tcp_socket(data_fd), data_fd = NOTOK;
        }
 
        if (!istdio)
index c365470..13ab153 100644 (file)
@@ -207,44 +207,41 @@ find_cache(CT ct, int policy, int *writing, char *id, char *buffer, int buflen)
                                writing ? "writing" : "reading", id);
 
        switch (policy) {
-               case CACHE_NEVER:
-               default:
-                       break;
+       case CACHE_NEVER:
+       default:
+               break;
 
-               case CACHE_ASK:
-               case CACHE_PUBLIC:
-                       if (cache_private && !writing &&
-                                       find_cache_aux(writing ? 2 : 0,
-                                       cache_private, id, buffer, buflen)
-                                       == OK) {
-                               if (access(buffer, R_OK) != NOTOK) {
+       case CACHE_ASK:
+       case CACHE_PUBLIC:
+               if (cache_private && !writing &&
+                               find_cache_aux(writing ? 2 : 0,
+                               cache_private, id, buffer, buflen) == OK) {
+                       if (access(buffer, R_OK) != NOTOK) {
 got_private:
-                                       if (writing)
-                                               *writing = 1;
+                               if (writing)
+                                       *writing = 1;
 got_it:
-                                       status = OK;
-                                       break;
-                               }
+                               status = OK;
+                               break;
                        }
-                       if (cache_public && find_cache_aux(writing ? 1 : 0,
-                                       cache_public, id, buffer, buflen)
-                                       == OK) {
-                               if (writing || access(buffer, R_OK) != NOTOK) {
-                                       if (writing)
-                                               *writing = 0;
-                                       goto got_it;
-                               }
+               }
+               if (cache_public && find_cache_aux(writing ? 1 : 0,
+                               cache_public, id, buffer, buflen) == OK) {
+                       if (writing || access(buffer, R_OK) != NOTOK) {
+                               if (writing)
+                                       *writing = 0;
+                               goto got_it;
                        }
-                       break;
+               }
+               break;
 
-               case CACHE_PRIVATE:
-                       if (cache_private && find_cache_aux(writing ? 2 : 0,
-                                       cache_private, id, buffer, buflen)
-                                       == OK) {
-                               if (writing || access(buffer, R_OK) != NOTOK)
-                                       goto got_private;
-                       }
-                       break;
+       case CACHE_PRIVATE:
+               if (cache_private && find_cache_aux(writing ? 2 : 0,
+                               cache_private, id, buffer, buflen) == OK) {
+                       if (writing || access(buffer, R_OK) != NOTOK)
+                               goto got_private;
+               }
+               break;
 
        }
 
@@ -415,39 +412,41 @@ find_cache_aux2(char *mapfile, char *id, char *mapname, int namelen)
                char *cp, *dp;
 
                switch (state = m_getfld(state, name, buf, sizeof(buf), fp)) {
-                       case FLD:
-                       case FLDPLUS:
-                       case FLDEOF:
-                               strncpy(mapname, name, namelen);
-                               if (state != FLDPLUS)
-                                       cp = buf;
-                               else {
-                                       cp = getcpy(buf);
-                                       while (state == FLDPLUS) {
-                                               state = m_getfld(state, name, buf, sizeof(buf), fp);
-                                               cp = add(buf, cp);
-                                       }
+               case FLD:
+               case FLDPLUS:
+               case FLDEOF:
+                       strncpy(mapname, name, namelen);
+                       if (state != FLDPLUS)
+                               cp = buf;
+                       else {
+                               cp = getcpy(buf);
+                               while (state == FLDPLUS) {
+                                       state = m_getfld(state, name, buf,
+                                                       sizeof(buf), fp);
+                                       cp = add(buf, cp);
                                }
-                               dp = trimcpy(cp);
-                               if (cp != buf)
-                                       free(cp);
-                               if (debugsw)
-                                       fprintf(stderr, "compare %s to %s <- %s\n", id, dp, mapname);
-                               result = strcmp(id, dp);
-                               free(dp);
-                               if (result == 0) {
-                                       lkfclose(fp, mapfile);
-                                       return OK;
-                               }
-                               if (state != FLDEOF)
-                                       continue;
-                               /* else fall... */
-
-                       case BODY:
-                       case BODYEOF:
-                       case FILEEOF:
-                       default:
-                               break;
+                       }
+                       dp = trimcpy(cp);
+                       if (cp != buf)
+                               free(cp);
+                       if (debugsw)
+                               fprintf(stderr, "compare %s to %s <- %s\n",
+                                               id, dp, mapname);
+                       result = strcmp(id, dp);
+                       free(dp);
+                       if (result == 0) {
+                               lkfclose(fp, mapfile);
+                               return OK;
+                       }
+                       if (state != FLDEOF)
+                               continue;
+                       /* else fall... */
+
+               case BODY:
+               case BODYEOF:
+               case FILEEOF:
+               default:
+                       break;
                }
                break;
        }
index 6918e0e..dd1277c 100644 (file)
@@ -64,25 +64,25 @@ free_content(CT ct)
        ** parts which need to be freed.
        */
        switch (ct->c_type) {
-               case CT_MULTIPART:
-                       free_multi(ct);
+       case CT_MULTIPART:
+               free_multi(ct);
+               break;
+
+       case CT_MESSAGE:
+               switch (ct->c_subtype) {
+               case MESSAGE_PARTIAL:
+                       free_partial(ct);
                        break;
 
-               case CT_MESSAGE:
-                       switch (ct->c_subtype) {
-                               case MESSAGE_PARTIAL:
-                                       free_partial(ct);
-                                       break;
-
-                               case MESSAGE_EXTERNAL:
-                                       free_external(ct);
-                                       break;
-                       }
+               case MESSAGE_EXTERNAL:
+                       free_external(ct);
                        break;
+               }
+               break;
 
-               case CT_TEXT:
-                       free_text(ct);
-                       break;
+       case CT_TEXT:
+               free_text(ct);
+               break;
        }
 
        if (ct->c_showproc)
index ecd6bac..e11cf5d 100644 (file)
@@ -106,51 +106,46 @@ int
 list_switch(CT ct, int toplevel, int realsize, int verbose, int debug)
 {
        switch (ct->c_type) {
-               case CT_MULTIPART:
-                       return list_multi(ct, toplevel, realsize, verbose,
-                                       debug);
+       case CT_MULTIPART:
+               return list_multi(ct, toplevel, realsize, verbose, debug);
+               break;
+
+       case CT_MESSAGE:
+               switch (ct->c_subtype) {
+               case MESSAGE_PARTIAL:
+                       return list_partial(ct, toplevel, realsize, verbose,
+                                               debug);
                        break;
 
-               case CT_MESSAGE:
-                       switch (ct->c_subtype) {
-                               case MESSAGE_PARTIAL:
-                                       return list_partial(ct, toplevel,
-                                                       realsize, verbose,
-                                                       debug);
-                                       break;
-
-                               case MESSAGE_EXTERNAL:
-                                       return list_external(ct, toplevel,
-                                                       realsize, verbose,
-                                                       debug);
-                                       break;
-
-                               case MESSAGE_RFC822:
-                               default:
-                                       return list_content(ct, toplevel,
-                                                       realsize, verbose,
-                                                       debug);
-                                       break;
-                       }
-                       break;
-
-               case CT_TEXT:
-               case CT_AUDIO:
-               case CT_IMAGE:
-               case CT_VIDEO:
-                       return list_content(ct, toplevel, realsize, verbose,
-                                       debug);
-                       break;
-
-               case CT_APPLICATION:
-                       return list_application(ct, toplevel, realsize,
-                                       verbose, debug);
+               case MESSAGE_EXTERNAL:
+                       return list_external(ct, toplevel, realsize, verbose,
+                                               debug);
                        break;
 
+               case MESSAGE_RFC822:
                default:
-                       /* list_debug (ct); */
-                       adios(NULL, "unknown content type %d", ct->c_type);
+                       return list_content(ct, toplevel, realsize, verbose,
+                                               debug);
                        break;
+               }
+               break;
+
+       case CT_TEXT:
+       case CT_AUDIO:
+       case CT_IMAGE:
+       case CT_VIDEO:
+               return list_content(ct, toplevel, realsize, verbose, debug);
+               break;
+
+       case CT_APPLICATION:
+               return list_application(ct, toplevel, realsize, verbose,
+                               debug);
+               break;
+
+       default:
+               /* list_debug (ct); */
+               adios(NULL, "unknown content type %d", ct->c_type);
+               break;
        }
 
        return 0;  /* NOT REACHED */
@@ -188,19 +183,19 @@ list_content(CT ct, int toplevel, int realsize, int verbose, int debug)
 
        /* print size of this body part */
        switch (*cp) {
-               case ' ':
-                       if (size > 0 || ct->c_encoding != CE_EXTERNAL)
-                               printf(LSTFMT2c1, size);
-                       else
-                               printf(LSTFMT2c4);
-                       break;
-
-               default:
-                       printf(LSTFMT2c2, size, *cp);
-                       break;
-
-               case '\0':
-                       printf(LSTFMT2c3);
+       case ' ':
+               if (size > 0 || ct->c_encoding != CE_EXTERNAL)
+                       printf(LSTFMT2c1, size);
+               else
+                       printf(LSTFMT2c4);
+               break;
+
+       default:
+               printf(LSTFMT2c2, size, *cp);
+               break;
+
+       case '\0':
+               printf(LSTFMT2c3);
        }
 
        /* print Content-Description */
index 7bce5da..927d845 100644 (file)
@@ -304,106 +304,118 @@ mhl(int argc, char **argv)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, mhlswitches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, mhlswitches);
-                                       done(1);
-                               case UNKWNSW:
-                                       adios(NULL, "-%s unknown\n", cp);
-
-                               case HELPSW:
-                                       snprintf(buf, sizeof(buf), "%s [switches] [files ...]", invo_name);
-                                       print_help(buf, mhlswitches, 1);
-                                       done(1);
-                               case VERSIONSW:
-                                       print_version(invo_name);
-                                       done(1);
-
-                               case BELLSW:
-                                       bellflg = 1;
-                                       continue;
-                               case NBELLSW:
-                                       bellflg = -1;
-                                       continue;
+                       case AMBIGSW:
+                               ambigsw(cp, mhlswitches);
+                               done(1);
+                       case UNKWNSW:
+                               adios(NULL, "-%s unknown\n", cp);
+
+                       case HELPSW:
+                               snprintf(buf, sizeof(buf), "%s [switches] [files ...]", invo_name);
+                               print_help(buf, mhlswitches, 1);
+                               done(1);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
+
+                       case BELLSW:
+                               bellflg = 1;
+                               continue;
+                       case NBELLSW:
+                               bellflg = -1;
+                               continue;
 
-                               case CLRSW:
-                                       clearflg = 1;
-                                       continue;
-                               case NCLRSW:
-                                       clearflg = -1;
-                                       continue;
+                       case CLRSW:
+                               clearflg = 1;
+                               continue;
+                       case NCLRSW:
+                               clearflg = -1;
+                               continue;
 
-                               case FOLDSW:
-                                       if (!(folder = *argp++) ||
-                                                       *folder == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       continue;
-                               case FORMSW:
-                                       if (!(form = *argp++) || *form == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       continue;
+                       case FOLDSW:
+                               if (!(folder = *argp++) || *folder == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
+                       case FORMSW:
+                               if (!(form = *argp++) || *form == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
 
-                               case SLEEPSW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       sleepsw = atoi(cp);  /* ZERO ok! */
-                                       continue;
+                       case SLEEPSW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               sleepsw = atoi(cp);  /* ZERO ok! */
+                               continue;
 
-                               case PROGSW:
-                                       if (!(moreproc = *argp++) || *moreproc == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       continue;
-                               case NPROGSW:
-                                       nomore++;
-                                       continue;
+                       case PROGSW:
+                               if (!(moreproc = *argp++) || *moreproc == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
+                       case NPROGSW:
+                               nomore++;
+                               continue;
 
-                               case LENSW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       if ((length = atoi(cp)) < 1)
-                                               adios(NULL, "bad argument %s %s", argp[-2], cp);
-                                       continue;
-                               case WIDTHSW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       if ((width = atoi(cp)) < 1)
-                                               adios(NULL, "bad argument %s %s", argp[-2], cp);
-                                       continue;
+                       case LENSW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               if ((length = atoi(cp)) < 1)
+                                       adios(NULL, "bad argument %s %s",
+                                                       argp[-2], cp);
+                               continue;
+                       case WIDTHSW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               if ((width = atoi(cp)) < 1)
+                                       adios(NULL, "bad argument %s %s",
+                                                       argp[-2], cp);
+                               continue;
 
-                               case DGSTSW:
-                                       if (!(digest = *argp++) ||
-                                                       *digest == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       continue;
-                               case ISSUESW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       if ((issue = atoi(cp)) < 1)
-                                               adios(NULL, "bad argument %s %s", argp[-2], cp);
-                                       continue;
-                               case VOLUMSW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       if ((volume = atoi(cp)) < 1)
-                                               adios(NULL, "bad argument %s %s", argp[-2], cp);
-                                       continue;
+                       case DGSTSW:
+                               if (!(digest = *argp++) ||
+                                               *digest == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
+                       case ISSUESW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               if ((issue = atoi(cp)) < 1)
+                                       adios(NULL, "bad argument %s %s",
+                                                       argp[-2], cp);
+                               continue;
+                       case VOLUMSW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               if ((volume = atoi(cp)) < 1)
+                                       adios(NULL, "bad argument %s %s",
+                                                       argp[-2], cp);
+                               continue;
 
-                               case FORW2SW:
-                                       forwall++;  /* fall */
-                               case FORW1SW:
-                                       forwflg++;
-                                       clearflg = -1;/* XXX */
-                                       continue;
+                       case FORW2SW:
+                               forwall++;  /* fall */
+                       case FORW1SW:
+                               forwflg++;
+                               clearflg = -1;/* XXX */
+                               continue;
 
-                               case BITSTUFFSW:
-                                       dashstuff = 1;  /* trinary logic */
-                                       continue;
-                               case NBITSTUFFSW:
-                                       dashstuff = -1;  /* trinary logic */
-                                       continue;
+                       case BITSTUFFSW:
+                               dashstuff = 1;  /* trinary logic */
+                               continue;
+                       case NBITSTUFFSW:
+                               dashstuff = -1;  /* trinary logic */
+                               continue;
 
-                               case NBODYSW:
-                                       dobody = 0;
-                                       continue;
+                       case NBODYSW:
+                               dobody = 0;
+                               continue;
                        }
                }
                files[vecp++] = cp;
@@ -535,69 +547,64 @@ mhl_format(char *file, int length, int width)
                parptr = bp;
                strncpy(name, parse(), sizeof(name));
                switch(*parptr) {
-                       case '\0':
-                       case ',':
-                       case '=':
+               case '\0':
+               case ',':
+               case '=':
+                       /*
+                       ** Split this list of fields to ignore, and copy
+                       ** it to the end of the current "ignores" list.
+                       */
+                       if (!mh_strcasecmp(name, "ignores")) {
+                               char **tmparray, **p;
+                               int n = 0;
+
+                               /* split the fields */
+                               tmparray = brkstring(getcpy(++parptr), ",",
+                                               NULL);
+
+                               /* count number of fields split */
+                               p = tmparray;
+                               while (*p++)
+                                       n++;
+
                                /*
-                               ** Split this list of fields to ignore,
-                               ** and copy it to the end of the current
-                               ** "ignores" list.
+                               ** copy pointers to split fields
+                               ** to ignores array
                                */
-                               if (!mh_strcasecmp(name, "ignores")) {
-                                       char **tmparray, **p;
-                                       int n = 0;
-
-                                       /* split the fields */
-                                       tmparray = brkstring(getcpy(++parptr),
-                                                       ",", NULL);
-
-                                       /* count number of fields split */
-                                       p = tmparray;
-                                       while (*p++)
-                                               n++;
-
-                                       /*
-                                       ** copy pointers to split fields
-                                       ** to ignores array
-                                       */
-                                       ip = copyip(tmparray, ip,
-                                                       MAXARGS - num_ignores);
-                                       num_ignores += n;
-                                       continue;
-                               }
-                               parptr = bp;
-                               while (*parptr) {
-                                       if (evalvar(&global))
-                                               adios(NULL, "format file syntax error: %s", bp);
-                                       if (*parptr)
-                                               parptr++;
-                               }
+                               ip = copyip(tmparray, ip,
+                                               MAXARGS - num_ignores);
+                               num_ignores += n;
                                continue;
-
-                       case ':':
-                               c1 = add_queue(&fmthd, &fmttl, name, NULL,
-                                               INIT);
-                               while (*parptr == ':' || *parptr == ',') {
+                       }
+                       parptr = bp;
+                       while (*parptr) {
+                               if (evalvar(&global))
+                                       adios(NULL, "format file syntax error: %s", bp);
+                               if (*parptr)
                                        parptr++;
-                                       if (evalvar(c1))
-                                               adios(NULL, "format file syntax error: %s", bp);
-                               }
-                               if (!c1->c_nfs && global.c_nfs) {
-                                       if (c1->c_flags & DATEFMT) {
-                                               if (global.c_flags & DATEFMT)
-                                                       c1->c_nfs = getcpy(global.c_nfs);
-                                       }
-                                       else
-                                               if (c1->c_flags & ADDRFMT) {
-                                                       if (global.c_flags & ADDRFMT)
-                                                               c1->c_nfs = getcpy(global.c_nfs);
-                                               }
+                       }
+                       continue;
+
+               case ':':
+                       c1 = add_queue(&fmthd, &fmttl, name, NULL, INIT);
+                       while (*parptr == ':' || *parptr == ',') {
+                               parptr++;
+                               if (evalvar(c1))
+                                       adios(NULL, "format file syntax error: %s", bp);
+                       }
+                       if (!c1->c_nfs && global.c_nfs) {
+                               if ((c1->c_flags & DATEFMT) &&
+                                               (global.c_flags & DATEFMT)) {
+                                       c1->c_nfs = getcpy(global.c_nfs);
+                               } else if ((c1->c_flags & ADDRFMT) &&
+                                               (global.c_flags & ADDRFMT)) {
+                                       c1->c_nfs = getcpy(global.c_nfs);
                                }
-                               continue;
+                       }
+                       continue;
 
-                       default:
-                               adios(NULL, "format file syntax error: %s",
-                                               bp);
+               default:
+                       adios(NULL, "format file syntax error: %s", bp);
                }
        }
        fclose(fp);
@@ -620,12 +627,12 @@ out:
        }
 
        switch (bellflg) {  /* command line may override format file */
-               case 1:
-                       global.c_flags |= BELL;
-                       break;
-               case -1:
-                       global.c_flags &= ~BELL;
-                       break;
+       case 1:
+               global.c_flags |= BELL;
+               break;
+       case -1:
+               global.c_flags &= ~BELL;
+               break;
        }
 
        if (length)
@@ -780,39 +787,38 @@ process(char *folder, char *fname, int ofilen, int ofilec)
        struct mcomp *c1;
 
        switch (setjmp(env)) {
-               case OK:
-                       if (fname) {
-                               fp = mhl_action ? (*mhl_action) (fname) :
-                                               fopen(fname, "r");
-                               if (fp == NULL) {
-                                       advise(fname, "unable to open");
-                                       exitstat++;
-                                       return;
-                               }
-                       } else {
-                               fname = "(stdin)";
-                               fp = stdin;
+       case OK:
+               if (fname) {
+                       fp = mhl_action ? (*mhl_action) (fname) :
+                                       fopen(fname, "r");
+                       if (fp == NULL) {
+                               advise(fname, "unable to open");
+                               exitstat++;
+                               return;
                        }
-                       cp = folder ? concat(folder, ":", fname, NULL) :
-                                       getcpy(fname);
-                       if (ontty != PITTY)
-                               SIGNAL(SIGINT, intrser);
-                       mhlfile(fp, cp, ofilen, ofilec);  /* FALL THROUGH! */
+               } else {
+                       fname = "(stdin)";
+                       fp = stdin;
+               }
+               cp = folder ? concat(folder, ":", fname, NULL) : getcpy(fname);
+               if (ontty != PITTY)
+                       SIGNAL(SIGINT, intrser);
+               mhlfile(fp, cp, ofilen, ofilec);  /* FALL THROUGH! */
 
-               default:
-                       if (ontty != PITTY)
-                               SIGNAL(SIGINT, SIG_IGN);
-                       if (mhl_action == NULL && fp != stdin)
-                               fclose(fp);
-                       free(cp);
-                       if (holder.c_text) {
-                               free(holder.c_text);
-                               holder.c_text = NULL;
-                       }
-                       free_queue(&msghd, &msgtl);
-                       for (c1 = fmthd; c1; c1 = c1->c_next)
-                               c1->c_flags &= ~HDROUTPUT;
-                       break;
+       default:
+               if (ontty != PITTY)
+                       SIGNAL(SIGINT, SIG_IGN);
+               if (mhl_action == NULL && fp != stdin)
+                       fclose(fp);
+               free(cp);
+               if (holder.c_text) {
+                       free(holder.c_text);
+                       holder.c_text = NULL;
+               }
+               free_queue(&msghd, &msgtl);
+               for (c1 = fmthd; c1; c1 = c1->c_next)
+                       c1->c_flags &= ~HDROUTPUT;
+               break;
        }
 }
 
@@ -838,135 +844,136 @@ mhlfile(FILE *fp, char *mname, int ofilen, int ofilec)
                }
        } else {
                switch (ontty) {
-                       case PITTY:
-                               if (ofilec > 1) {
-                                       if (ofilen > 1) {
-                                               if ((global.c_flags & CLEARSCR))
-                                                       clear_screen();
-                                               else
-                                                       printf("\n\n\n");
-                                       }
-                                       printf(">>> %s\n\n", mname);
-                               }
-                               break;
-
-                       case ISTTY:
-                               strncpy(buf, "\n", sizeof(buf));
-                               if (ofilec > 1) {
-                                       if (SOprintf("Press <return> to list \"%s\"...", mname)) {
-                                               if (ofilen > 1)
-                                                       printf("\n\n\n");
-                                               printf("Press <return> to list \"%s\"...", mname);
-                                       }
-                                       fflush(stdout);
-                                       buf[0] = 0;
-                                       read(fileno(stdout), buf, sizeof(buf));
-                               }
-                               if (strchr(buf, '\n')) {
+               case PITTY:
+                       if (ofilec > 1) {
+                               if (ofilen > 1) {
                                        if ((global.c_flags & CLEARSCR))
                                                clear_screen();
+                                       else
+                                               printf("\n\n\n");
                                }
-                               else
-                                       printf("\n");
-                               break;
+                               printf(">>> %s\n\n", mname);
+                       }
+                       break;
 
-                       default:
-                               if (ofilec > 1) {
-                                       if (ofilen > 1) {
+               case ISTTY:
+                       strncpy(buf, "\n", sizeof(buf));
+                       if (ofilec > 1) {
+                               if (SOprintf("Press <return> to list \"%s\"...", mname)) {
+                                       if (ofilen > 1)
                                                printf("\n\n\n");
-                                               if (clearflg > 0)
-                                                       clear_screen();
-                                       }
-                                       printf(">>> %s\n\n", mname);
+                                       printf("Press <return> to list \"%s\"...", mname);
                                }
-                               break;
+                               fflush(stdout);
+                               buf[0] = 0;
+                               read(fileno(stdout), buf, sizeof(buf));
+                       }
+                       if (strchr(buf, '\n')) {
+                               if ((global.c_flags & CLEARSCR))
+                                       clear_screen();
+                       } else
+                               printf("\n");
+                       break;
+
+               default:
+                       if (ofilec > 1) {
+                               if (ofilen > 1) {
+                                       printf("\n\n\n");
+                                       if (clearflg > 0)
+                                               clear_screen();
+                               }
+                               printf(">>> %s\n\n", mname);
+                       }
+                       break;
                }
        }
 
        for (state = FLD;;) {
                switch (state = m_getfld(state, name, buf, sizeof(buf), fp)) {
-                       case FLD:
-                       case FLDPLUS:
-                               for (ip = ignores; *ip; ip++)
-                                       if (!mh_strcasecmp(name, *ip)) {
-                                               while (state == FLDPLUS)
-                                                       state = m_getfld(state, name, buf, sizeof(buf), fp);
-                                               break;
-                                       }
-                               if (*ip)
-                                       continue;
-
-                               for (c2 = fmthd; c2; c2 = c2->c_next)
-                                       if (!mh_strcasecmp(c2->c_name, name))
-                                               break;
-                               c1 = NULL;
-                               if (!((c3 = c2 ? c2 : &global)->c_flags & SPLIT))
-                                       for (c1 = msghd; c1; c1 = c1->c_next)
-                                               if (!mh_strcasecmp(c1->c_name, c3->c_name)) {
-                                                       c1->c_text = mcomp_add (c1->c_flags, buf, c1->c_text);
-                                                       break;
-                                               }
-                               if (c1 == NULL)
-                                       c1 = add_queue(&msghd, &msgtl, name, buf, 0);
-                               while (state == FLDPLUS) {
-                                       state = m_getfld(state, name, buf, sizeof(buf), fp);
-                                       c1->c_text = add(buf, c1->c_text);
+               case FLD:
+               case FLDPLUS:
+                       for (ip = ignores; *ip; ip++)
+                               if (!mh_strcasecmp(name, *ip)) {
+                                       while (state == FLDPLUS)
+                                               state = m_getfld(state, name, buf, sizeof(buf), fp);
+                                       break;
                                }
-                               if (c2 == NULL)
-                                       c1->c_flags |= EXTRA;
+                       if (*ip)
                                continue;
 
-                       case BODY:
-                       case FILEEOF:
-                               row = column = 0;
-                               for (c1 = fmthd; c1; c1 = c1->c_next) {
-                                       if (c1->c_flags & CLEARTEXT) {
-                                               putcomp(c1, c1, ONECOMP);
-                                               continue;
-                                       }
-                                       if (!mh_strcasecmp(c1->c_name, "messagename")) {
-                                               holder.c_text = concat("(Message ", mname, ")\n",
-                                                                                       NULL);
-                                               putcomp(c1, &holder, ONECOMP);
-                                               free(holder.c_text);
-                                               holder.c_text = NULL;
-                                               continue;
-                                       }
-                                       if (!mh_strcasecmp(c1->c_name, "extras")) {
-                                               for (c2 = msghd; c2; c2 = c2->c_next)
-                                                       if (c2->c_flags & EXTRA)
-                                                               putcomp(c1, c2, TWOCOMP);
-                                               continue;
-                                       }
-                                       if (dobody && !mh_strcasecmp(c1->c_name, "body")) {
-                                               holder.c_text = mh_xmalloc(sizeof(buf));
-                                               strncpy(holder.c_text, buf, sizeof(buf));
-                                               while (state == BODY) {
-                                                       putcomp(c1, &holder, BODYCOMP);
-                                                       state = m_getfld(state, name, holder.c_text, sizeof(buf), fp);
-                                               }
-                                               free(holder.c_text);
-                                               holder.c_text = NULL;
-                                               continue;
+                       for (c2 = fmthd; c2; c2 = c2->c_next)
+                               if (!mh_strcasecmp(c2->c_name, name))
+                                       break;
+                       c1 = NULL;
+                       if (!((c3 = c2 ? c2 : &global)->c_flags & SPLIT))
+                               for (c1 = msghd; c1; c1 = c1->c_next)
+                                       if (!mh_strcasecmp(c1->c_name,
+                                                       c3->c_name)) {
+                                               c1->c_text = mcomp_add(c1->c_flags, buf, c1->c_text);
+                                               break;
                                        }
+                       if (c1 == NULL)
+                               c1 = add_queue(&msghd, &msgtl, name, buf, 0);
+                       while (state == FLDPLUS) {
+                               state = m_getfld(state, name, buf,
+                                               sizeof(buf), fp);
+                               c1->c_text = add(buf, c1->c_text);
+                       }
+                       if (c2 == NULL)
+                               c1->c_flags |= EXTRA;
+                       continue;
+
+               case BODY:
+               case FILEEOF:
+                       row = column = 0;
+                       for (c1 = fmthd; c1; c1 = c1->c_next) {
+                               if (c1->c_flags & CLEARTEXT) {
+                                       putcomp(c1, c1, ONECOMP);
+                                       continue;
+                               }
+                               if (!mh_strcasecmp(c1->c_name, "messagename")) {
+                                       holder.c_text = concat("(Message ",
+                                                       mname, ")\n", NULL);
+                                       putcomp(c1, &holder, ONECOMP);
+                                       free(holder.c_text);
+                                       holder.c_text = NULL;
+                                       continue;
+                               }
+                               if (!mh_strcasecmp(c1->c_name, "extras")) {
                                        for (c2 = msghd; c2; c2 = c2->c_next)
-                                               if (!mh_strcasecmp(c2->c_name, c1->c_name)) {
-                                                       putcomp(c1, c2, ONECOMP);
-                                                       if (!(c1->c_flags & SPLIT))
-                                                               break;
-                                               }
+                                               if (c2->c_flags & EXTRA)
+                                                       putcomp(c1, c2, TWOCOMP);
+                                       continue;
                                }
-                               return;
+                               if (dobody && !mh_strcasecmp(c1->c_name, "body")) {
+                                       holder.c_text = mh_xmalloc(sizeof(buf));
+                                       strncpy(holder.c_text, buf, sizeof(buf));
+                                       while (state == BODY) {
+                                               putcomp(c1, &holder, BODYCOMP);
+                                               state = m_getfld(state, name, holder.c_text, sizeof(buf), fp);
+                                       }
+                                       free(holder.c_text);
+                                       holder.c_text = NULL;
+                                       continue;
+                               }
+                               for (c2 = msghd; c2; c2 = c2->c_next)
+                                       if (!mh_strcasecmp(c2->c_name,
+                                                       c1->c_name)) {
+                                               putcomp(c1, c2, ONECOMP);
+                                               if (!(c1->c_flags & SPLIT))
+                                                       break;
+                                       }
+                       }
+                       return;
 
-                       case LENERR:
-                       case FMTERR:
-                               advise(NULL, "format error in message %s",
-                                               mname);
-                               exitstat++;
-                               return;
+               case LENERR:
+               case FMTERR:
+                       advise(NULL, "format error in message %s", mname);
+                       exitstat++;
+                       return;
 
-                       default:
-                               adios(NULL, "getfld() returned %d", state);
+               default:
+                       adios(NULL, "getfld() returned %d", state);
                }
        }
 }
@@ -1332,53 +1339,53 @@ putch(char ch)
                return;
 
        switch (ch) {
-               case '\n':
-                       if (llim > 0)
-                               llim--;
-                       column = 0;
-                       row++;
-                       if (ontty != ISTTY || row != global.c_length)
-                               break;
-                       if (global.c_flags & BELL)
-                               putchar('\007');
-                       fflush(stdout);
-                       buf[0] = 0;
-                       read(fileno(stdout), buf, sizeof(buf));
-                       if (strchr(buf, '\n')) {
-                               if (global.c_flags & CLEARSCR)
-                                       clear_screen();
-                               row = 0;
-                       } else {
-                               putchar('\n');
-                               row = global.c_length / 3;
-                       }
-                       return;
-
-               case '\t':
-                       column |= 07;
-                       column++;
-                       break;
-
-               case '\b':
-                       column--;
-                       break;
-
-               case '\r':
-                       column = 0;
+       case '\n':
+               if (llim > 0)
+                       llim--;
+               column = 0;
+               row++;
+               if (ontty != ISTTY || row != global.c_length)
                        break;
+               if (global.c_flags & BELL)
+                       putchar('\007');
+               fflush(stdout);
+               buf[0] = 0;
+               read(fileno(stdout), buf, sizeof(buf));
+               if (strchr(buf, '\n')) {
+                       if (global.c_flags & CLEARSCR)
+                               clear_screen();
+                       row = 0;
+               } else {
+                       putchar('\n');
+                       row = global.c_length / 3;
+               }
+               return;
 
-               default:
-                       /*
-                       ** If we are forwarding this message, and the first
-                       ** column contains a dash, then add a dash and a space.
-                       */
-                       if (column == 0 && forwflg && (dashstuff >= 0) && ch == '-') {
-                               putchar('-');
-                               putchar(' ');
-                       }
-                       if (ch >= ' ')
-                               column++;
-                       break;
+       case '\t':
+               column |= 07;
+               column++;
+               break;
+
+       case '\b':
+               column--;
+               break;
+
+       case '\r':
+               column = 0;
+               break;
+
+       default:
+               /*
+               ** If we are forwarding this message, and the first
+               ** column contains a dash, then add a dash and a space.
+               */
+               if (column == 0 && forwflg && (dashstuff >= 0) && ch == '-') {
+                       putchar('-');
+                       putchar(' ');
+               }
+               if (ch >= ' ')
+                       column++;
+               break;
        }
 
        if (column >= wid) {
@@ -1439,44 +1446,44 @@ mhlsbr(int argc, char **argv, FILE *(*action)())
        struct mcomp *c1;
 
        switch (setjmp(mhlenv)) {
-               case OK:
-                       cp = invo_name;
-                       sleepsw = 0;  /* XXX */
-                       bellflg = clearflg = forwflg = forwall = exitstat = 0;
-                       digest = NULL;
-                       ontty = NOTTY;
-                       mhl_action = action;
-
-                       /*
-                       ** If signal is at default action, then start ignoring
-                       ** it, else let it set to its current action.
-                       */
-                       if ((istat = SIGNAL(SIGINT, SIG_IGN)) != SIG_DFL)
-                               SIGNAL(SIGINT, istat);
-                       if ((qstat = SIGNAL(SIGQUIT, SIG_IGN)) != SIG_DFL)
-                               SIGNAL(SIGQUIT, qstat);
-                       pstat = SIGNAL(SIGPIPE, pipeser);
-                       mhl(argc, argv);  /* FALL THROUGH! */
+       case OK:
+               cp = invo_name;
+               sleepsw = 0;  /* XXX */
+               bellflg = clearflg = forwflg = forwall = exitstat = 0;
+               digest = NULL;
+               ontty = NOTTY;
+               mhl_action = action;
 
-               default:
+               /*
+               ** If signal is at default action, then start ignoring
+               ** it, else let it set to its current action.
+               */
+               if ((istat = SIGNAL(SIGINT, SIG_IGN)) != SIG_DFL)
                        SIGNAL(SIGINT, istat);
+               if ((qstat = SIGNAL(SIGQUIT, SIG_IGN)) != SIG_DFL)
                        SIGNAL(SIGQUIT, qstat);
-                       SIGNAL(SIGPIPE, SIG_IGN);  /*
-                                       ** should probably change to block
-                                       ** instead
-                                       */
-                       if (ontty == PITTY)
-                               m_pclose();
-                       SIGNAL(SIGPIPE, pstat);
-                       invo_name = cp;
-                       if (holder.c_text) {
-                               free(holder.c_text);
-                               holder.c_text = NULL;
-                       }
-                       free_queue(&msghd, &msgtl);
-                       for (c1 = fmthd; c1; c1 = c1->c_next)
-                               c1->c_flags &= ~HDROUTPUT;
-                       return exitstat;
+               pstat = SIGNAL(SIGPIPE, pipeser);
+               mhl(argc, argv);  /* FALL THROUGH! */
+
+       default:
+               SIGNAL(SIGINT, istat);
+               SIGNAL(SIGQUIT, qstat);
+               SIGNAL(SIGPIPE, SIG_IGN);  /*
+                               ** should probably change to block
+                               ** instead
+                               */
+               if (ontty == PITTY)
+                       m_pclose();
+               SIGNAL(SIGPIPE, pstat);
+               invo_name = cp;
+               if (holder.c_text) {
+                       free(holder.c_text);
+                       holder.c_text = NULL;
+               }
+               free_queue(&msghd, &msgtl);
+               for (c1 = fmthd; c1; c1 = c1->c_next)
+                       c1->c_flags &= ~HDROUTPUT;
+               return exitstat;
        }
 }
 
@@ -1521,29 +1528,29 @@ m_popen(char *name)
                adios("pipe", "unable to");
 
        switch (m_pid = vfork()) {
-               case NOTOK:
-                       adios("fork", "unable to");
-
-               case OK:
-                       SIGNAL(SIGINT, SIG_DFL);
-                       SIGNAL(SIGQUIT, SIG_DFL);
+       case NOTOK:
+               adios("fork", "unable to");
 
-                       close(pd[1]);
-                       if (pd[0] != fileno(stdin)) {
-                               dup2(pd[0], fileno(stdin));
-                               close(pd[0]);
-                       }
-                       execlp(name, mhbasename(name), NULL);
-                       fprintf(stderr, "unable to exec ");
-                       perror(name);
-                       _exit(-1);
+       case OK:
+               SIGNAL(SIGINT, SIG_DFL);
+               SIGNAL(SIGQUIT, SIG_DFL);
 
-               default:
+               close(pd[1]);
+               if (pd[0] != fileno(stdin)) {
+                       dup2(pd[0], fileno(stdin));
                        close(pd[0]);
-                       if (pd[1] != fileno(stdout)) {
-                               dup2(pd[1], fileno(stdout));
-                               close(pd[1]);
-                       }
+               }
+               execlp(name, mhbasename(name), NULL);
+               fprintf(stderr, "unable to exec ");
+               perror(name);
+               _exit(-1);
+
+       default:
+               close(pd[0]);
+               if (pd[1] != fileno(stdout)) {
+                       dup2(pd[1], fileno(stdout));
+                       close(pd[1]);
+               }
        }
 }
 
index ebe8b76..a013ecb 100644 (file)
@@ -72,46 +72,51 @@ main(int argc, char **argv)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, switches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, switches);
-                                       done(1);
-                               case UNKWNSW:
-                                       adios(NULL, "-%s unknown", cp);
-
-                               case HELPSW:
-                                       snprintf(buf, sizeof(buf), "%s [addrs ... [switches]]", invo_name);
-                                       print_help(buf, switches, 0);
-                                       done(1);
-                               case VERSIONSW:
-                                       print_version(invo_name);
-                                       done(1);
-
-                               case FROMSW:
-                                       if (!(from = *argp++) || *from == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       continue;
-
-                               case BODYSW:
-                                       if (!(body = *argp++) || *body == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       continue;
-
-                               case CCSW:
-                                       iscc++;
-                                       continue;
-
-                               case SUBJSW:
-                                       if (!(subject = *argp++) || *subject == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       continue;
-
-                               case RESNDSW:
-                                       resent++;
-                                       continue;
-
-                               case QUEUESW:
-                                       queued++;
-                                       continue;
+                       case AMBIGSW:
+                               ambigsw(cp, switches);
+                               done(1);
+                       case UNKWNSW:
+                               adios(NULL, "-%s unknown", cp);
+
+                       case HELPSW:
+                               snprintf(buf, sizeof(buf),
+                                               "%s [addrs ... [switches]]",
+                                               invo_name);
+                               print_help(buf, switches, 0);
+                               done(1);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
+
+                       case FROMSW:
+                               if (!(from = *argp++) || *from == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
+
+                       case BODYSW:
+                               if (!(body = *argp++) || *body == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
+
+                       case CCSW:
+                               iscc++;
+                               continue;
+
+                       case SUBJSW:
+                               if (!(subject = *argp++) || *subject == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
+
+                       case RESNDSW:
+                               resent++;
+                               continue;
+
+                       case QUEUESW:
+                               queued++;
+                               continue;
                        }
                }
                if (iscc)
index 8517781..939275f 100644 (file)
@@ -375,24 +375,24 @@ writeQuoted(CT ct, FILE *out)
                        }
 
                        switch (*cp) {
-                               case ' ':
-                               case '\t':
-                                       putc(*cp, out);
-                                       n++;
-                                       break;
-
-                               default:
-                                       if (*cp < '!' || *cp > '~' || (ebcdicsw && !ebcdicsafe[*cp & 0xff]))
-                                               goto three_print;
-                                       putc(*cp, out);
-                                       n++;
-                                       break;
-
-                               case '=':
+                       case ' ':
+                       case '\t':
+                               putc(*cp, out);
+                               n++;
+                               break;
+
+                       default:
+                               if (*cp < '!' || *cp > '~' || (ebcdicsw && !ebcdicsafe[*cp & 0xff]))
+                                       goto three_print;
+                               putc(*cp, out);
+                               n++;
+                               break;
+
+                       case '=':
 three_print:
-                                       fprintf(out, "=%02X", *cp & 0xff);
-                                       n += 3;
-                                       break;
+                               fprintf(out, "=%02X", *cp & 0xff);
+                               n += 3;
+                               break;
                        }
                }
 
index 6c28e19..5cf7881 100644 (file)
@@ -90,34 +90,34 @@ main(int argc, char **argv)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, switches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, switches);
-                                       done(1);
-                               case UNKWNSW:
-                                       adios(NULL, "-%s unknown", cp);
-
-                               case HELPSW:
-                                       snprintf(buf, sizeof(buf), "%s [profile-components] [switches]", invo_name);
-                                       print_help(buf, switches, 1);
-                                       done(1);
-                               case VERSIONSW:
-                                       print_version(invo_name);
-                                       done(1);
-
-                               case COMPSW:
-                                       components = 1;
-                                       break;
-                               case NCOMPSW:
-                                       components = 0;
-                                       break;
-
-                               case ALLSW:
-                                       all = 1;
-                                       break;
-
-                               case DEBUGSW:
-                                       debug = 1;
-                                       break;
+                       case AMBIGSW:
+                               ambigsw(cp, switches);
+                               done(1);
+                       case UNKWNSW:
+                               adios(NULL, "-%s unknown", cp);
+
+                       case HELPSW:
+                               snprintf(buf, sizeof(buf), "%s [profile-components] [switches]", invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
+
+                       case COMPSW:
+                               components = 1;
+                               break;
+                       case NCOMPSW:
+                               components = 0;
+                               break;
+
+                       case ALLSW:
+                               all = 1;
+                               break;
+
+                       case DEBUGSW:
+                               debug = 1;
+                               break;
                        }
                } else {
                        comps[compp++] = cp;
index 3aeb351..95f8912 100644 (file)
@@ -816,24 +816,24 @@ magic_skip:
                if (*dp == '"') {
                        for (cp = ++dp, dp = vp;;) {
                                switch (c = *cp++) {
-                                       case '\0':
+                               case '\0':
 bad_quote:
-                                               advise(NULL, "invalid quoted-string in message %s's %s: field\n%*.*s(parameter %s)", ct->c_file, TYPE_FIELD, i, i, "", *ap);
-                                               return NOTOK;
+                                       advise(NULL, "invalid quoted-string in message %s's %s: field\n%*.*s(parameter %s)", ct->c_file, TYPE_FIELD, i, i, "", *ap);
+                                       return NOTOK;
 
-                                       case '\\':
-                                               *dp++ = c;
-                                               if ((c = *cp++) == '\0')
-                                                       goto bad_quote;
-                                               /* else fall... */
+                               case '\\':
+                                       *dp++ = c;
+                                       if ((c = *cp++) == '\0')
+                                               goto bad_quote;
+                                       /* else fall... */
 
-                                       default:
-                                               *dp++ = c;
-                                               continue;
+                               default:
+                                       *dp++ = c;
+                                       continue;
 
-                                       case '"':
-                                               *dp = '\0';
-                                               break;
+                               case '"':
+                                       *dp = '\0';
+                                       break;
                                }
                                break;
                        }
@@ -1365,137 +1365,133 @@ InitMessage(CT ct)
        ct->c_subtype = kv->kv_value;
 
        switch (ct->c_subtype) {
-               case MESSAGE_RFC822:
-                       break;
+       case MESSAGE_RFC822:
+               break;
 
-               case MESSAGE_PARTIAL:
-                       {
-                               char **ap, **ep;
-                               struct partial *p;
+       case MESSAGE_PARTIAL:
+               {
+               char **ap, **ep;
+               struct partial *p;
 
-                               if ((p = (struct partial *)
-                                               calloc(1, sizeof(*p))) == NULL)
-                                       adios(NULL, "out of memory");
-                               ct->c_ctparams = (void *) p;
+               if ((p = (struct partial *) calloc(1, sizeof(*p))) == NULL)
+                       adios(NULL, "out of memory");
+               ct->c_ctparams = (void *) p;
 
-                               /*
-                               ** scan for parameters "id", "number",
-                               ** and "total"
-                               */
-                               for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++) {
-                                       if (!mh_strcasecmp(*ap, "id")) {
-                                               p->pm_partid = getcpy(*ep);
-                                               continue;
-                                       }
-                                       if (!mh_strcasecmp(*ap, "number")) {
-                                               if (sscanf(*ep, "%d", &p->pm_partno) != 1 || p->pm_partno < 1) {
+               /*
+               ** scan for parameters "id", "number",
+               ** and "total"
+               */
+               for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++) {
+                       if (!mh_strcasecmp(*ap, "id")) {
+                               p->pm_partid = getcpy(*ep);
+                               continue;
+                       }
+                       if (!mh_strcasecmp(*ap, "number")) {
+                               if (sscanf(*ep, "%d", &p->pm_partno) != 1 || p->pm_partno < 1) {
 invalid_param:
-                                                       advise(NULL, "invalid %s parameter for \"%s/%s\" type in message %s's %s field", *ap, ci->ci_type, ci->ci_subtype, ct->c_file, TYPE_FIELD);
-                                                       return NOTOK;
-                                               }
-                                               continue;
-                                       }
-                                       if (!mh_strcasecmp(*ap, "total")) {
-                                               if (sscanf(*ep, "%d", &p->pm_maxno) != 1 || p->pm_maxno < 1)
-                                                       goto invalid_param;
-                                               continue;
-                                       }
-                               }
-
-                               if (!p->pm_partid || !p->pm_partno
-                                       || (p->pm_maxno && p->pm_partno > p->pm_maxno)) {
-                                       advise(NULL, "invalid parameters for \"%s/%s\" type in message %s's %s field", ci->ci_type, ci->ci_subtype, ct->c_file, TYPE_FIELD);
+                                       advise(NULL, "invalid %s parameter for \"%s/%s\" type in message %s's %s field", *ap, ci->ci_type, ci->ci_subtype, ct->c_file, TYPE_FIELD);
                                        return NOTOK;
                                }
+                               continue;
                        }
-                       break;
-
-               case MESSAGE_EXTERNAL:
-                       {
-                               int exresult;
-                               struct exbody *e;
-                               CT p;
-                               FILE *fp;
+                       if (!mh_strcasecmp(*ap, "total")) {
+                               if (sscanf(*ep, "%d", &p->pm_maxno) != 1 ||
+                                               p->pm_maxno < 1)
+                                       goto invalid_param;
+                               continue;
+                       }
+               }
 
-                               if ((e = (struct exbody *)
-                                               calloc(1, sizeof(*e))) == NULL)
-                                       adios(NULL, "out of memory");
-                               ct->c_ctparams = (void *) e;
+               if (!p->pm_partid || !p->pm_partno
+                       || (p->pm_maxno && p->pm_partno > p->pm_maxno)) {
+                       advise(NULL, "invalid parameters for \"%s/%s\" type in message %s's %s field", ci->ci_type, ci->ci_subtype, ct->c_file, TYPE_FIELD);
+                       return NOTOK;
+               }
+               }
+               break;
 
-                               if (!ct->c_fp && (ct->c_fp = fopen(ct->c_file, "r")) == NULL) {
-                                       advise(ct->c_file, "unable to open for reading");
-                                       return NOTOK;
-                               }
+       case MESSAGE_EXTERNAL:
+               {
+               int exresult;
+               struct exbody *e;
+               CT p;
+               FILE *fp;
 
-                               fseek(fp = ct->c_fp, ct->c_begin, SEEK_SET);
+               if ((e = (struct exbody *) calloc(1, sizeof(*e))) == NULL)
+                       adios(NULL, "out of memory");
+               ct->c_ctparams = (void *) e;
 
-                               if (!(p = get_content(fp, ct->c_file, 0))) {
-                                       ct->c_fp = NULL;
-                                       return NOTOK;
-                               }
+               if (!ct->c_fp && (ct->c_fp = fopen(ct->c_file, "r")) == NULL) {
+                       advise(ct->c_file, "unable to open for reading");
+                       return NOTOK;
+               }
 
-                               e->eb_parent = ct;
-                               e->eb_content = p;
-                               p->c_ctexbody = e;
-                               if ((exresult = params_external(ct, 0))
-                                               != NOTOK &&
-                                               p->c_ceopenfnx == openMail) {
-                                       int cc, size;
-                                       char *bp;
-
-                                       if ((size = ct->c_end - p->c_begin) <= 0) {
-                                               if (!e->eb_subject)
-                                                       content_error(NULL, ct, "empty body for access-type=mail-server");
-                                               goto no_body;
-                                       }
+               fseek(fp = ct->c_fp, ct->c_begin, SEEK_SET);
 
-                                       e->eb_body = bp = mh_xmalloc((unsigned) size);
-                                       fseek(p->c_fp, p->c_begin, SEEK_SET);
-                                       while (size > 0)
-                                               switch (cc = fread(bp, sizeof(*bp), size, p->c_fp)) {
-                                                       case NOTOK:
-                                                               adios("failed", "fread");
+               if (!(p = get_content(fp, ct->c_file, 0))) {
+                       ct->c_fp = NULL;
+                       return NOTOK;
+               }
 
-                                                       case OK:
-                                                               adios(NULL, "unexpected EOF from fread");
+               e->eb_parent = ct;
+               e->eb_content = p;
+               p->c_ctexbody = e;
+               if ((exresult = params_external(ct, 0)) != NOTOK &&
+                               p->c_ceopenfnx == openMail) {
+                       int cc, size;
+                       char *bp;
+
+                       if ((size = ct->c_end - p->c_begin) <= 0) {
+                               if (!e->eb_subject)
+                                       content_error(NULL, ct, "empty body for access-type=mail-server");
+                               goto no_body;
+                       }
 
-                                                       default:
-                                                               bp += cc, size -= cc;
-                                                               break;
-                                               }
-                                       *bp = 0;
+                       e->eb_body = bp = mh_xmalloc((unsigned) size);
+                       fseek(p->c_fp, p->c_begin, SEEK_SET);
+                       while (size > 0)
+                               switch (cc = fread(bp, sizeof(*bp), size, p->c_fp)) {
+                               case NOTOK:
+                                       adios("failed", "fread");
+                               case OK:
+                                       adios(NULL, "unexpected EOF from fread");
+                               default:
+                                       bp += cc, size -= cc;
+                                       break;
                                }
+                       *bp = 0;
+               }
 no_body:
-                               p->c_fp = NULL;
-                               p->c_end = p->c_begin;
-
-                               fclose(ct->c_fp);
-                               ct->c_fp = NULL;
+               p->c_fp = NULL;
+               p->c_end = p->c_begin;
 
-                               if (exresult == NOTOK)
-                                       return NOTOK;
-                               if (e->eb_flags == NOTOK)
-                                       return OK;
+               fclose(ct->c_fp);
+               ct->c_fp = NULL;
 
-                               switch (p->c_type) {
-                                       case CT_MULTIPART:
-                                               break;
+               if (exresult == NOTOK)
+                       return NOTOK;
+               if (e->eb_flags == NOTOK)
+                       return OK;
 
-                                       case CT_MESSAGE:
-                                               if (p->c_subtype != MESSAGE_RFC822)
-                                                       break;
-                                               /* else fall... */
-                                       default:
-                                               e->eb_partno = ct->c_partno;
-                                               if (p->c_ctinitfnx)
-                                                       (*p->c_ctinitfnx) (p);
-                                               break;
-                               }
-                       }
+               switch (p->c_type) {
+               case CT_MULTIPART:
                        break;
 
+               case CT_MESSAGE:
+                       if (p->c_subtype != MESSAGE_RFC822)
+                               break;
+                               /* else fall... */
                default:
+                       e->eb_partno = ct->c_partno;
+                       if (p->c_ctinitfnx)
+                               (*p->c_ctinitfnx) (p);
                        break;
+               }
+               }
+               break;
+
+       default:
+               break;
        }
 
        return OK;
@@ -2399,14 +2395,12 @@ openFile(CT ct, char **file)
        CE ce = ct->c_cefile;
 
        switch (openExternal(e->eb_parent, e->eb_content, ce, file, &fd)) {
-               case NOTOK:
-                       return NOTOK;
-
-               case OK:
-                       break;
-
-               case DONE:
-                       return fd;
+       case NOTOK:
+               return NOTOK;
+       case OK:
+               break;
+       case DONE:
+               return fd;
        }
 
        if (!e->eb_name) {
@@ -2495,14 +2489,12 @@ openFTP(CT ct, char **file)
 #endif
 
        switch (openExternal(e->eb_parent, e->eb_content, ce, file, &fd)) {
-               case NOTOK:
-                       return NOTOK;
-
-               case OK:
-                       break;
-
-               case DONE:
-                       return fd;
+       case NOTOK:
+               return NOTOK;
+       case OK:
+               break;
+       case DONE:
+               return fd;
        }
 
        if (!e->eb_name || !e->eb_site) {
@@ -2620,28 +2612,28 @@ openFTP(CT ct, char **file)
                for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++)
                        sleep(5);
                switch (child_id) {
-                       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)) {
+               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)) {
 #ifdef BUILTIN_FTP
 losing_ftp:
 #endif
-                                       username = password = NULL;
-                                       ce->ce_unlink = 1;
-                                       return NOTOK;
-                               }
-                               break;
+                               username = password = NULL;
+                               ce->ce_unlink = 1;
+                               return NOTOK;
+                       }
+                       break;
                }
        }
 #ifdef BUILTIN_FTP
@@ -2710,14 +2702,12 @@ openMail(CT ct, char **file)
        CE ce = ct->c_cefile;
 
        switch (openExternal(e->eb_parent, e->eb_content, ce, file, &fd)) {
-               case NOTOK:
-                       return NOTOK;
-
-               case OK:
-                       break;
-
-               case DONE:
-                       return fd;
+       case NOTOK:
+               return NOTOK;
+       case OK:
+               break;
+       case DONE:
+               return fd;
        }
 
        if (!e->eb_server) {
@@ -2768,21 +2758,21 @@ openMail(CT ct, char **file)
        for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++)
                sleep(5);
        switch (child_id) {
-               case NOTOK:
-                       advise("fork", "unable to");
-                       return NOTOK;
+       case NOTOK:
+               advise("fork", "unable to");
+               return NOTOK;
 
-               case OK:
-                       execvp(mailproc, vec);
-                       fprintf(stderr, "unable to exec ");
-                       perror(mailproc);
-                       _exit(-1);
-                       /* NOTREACHED */
+       case OK:
+               execvp(mailproc, vec);
+               fprintf(stderr, "unable to exec ");
+               perror(mailproc);
+               _exit(-1);
+               /* NOTREACHED */
 
-               default:
-                       if (pidXwait(child_id, NULL) == OK)
-                               advise(NULL, "request sent");
-                       break;
+       default:
+               if (pidXwait(child_id, NULL) == OK)
+                       advise(NULL, "request sent");
+               break;
        }
 
        if (*file == NULL) {
@@ -2833,36 +2823,36 @@ readDigest(CT ct, char *cp)
        for (ep = (dp = ct->c_digest)
                + sizeof(ct->c_digest) / sizeof(ct->c_digest[0]); *cp; cp++)
                switch (*cp) {
-                       default:
-                               if (skip || (*cp & 0x80) ||
-                                               (value = b642nib[*cp & 0x7f])
-                                               > 0x3f) {
-                                       if (debugsw)
-                                               fprintf(stderr, "invalid BASE64 encoding\n");
-                                       return NOTOK;
-                               }
+               default:
+                       if (skip || (*cp & 0x80) ||
+                                       (value = b642nib[*cp & 0x7f])
+                                       > 0x3f) {
+                               if (debugsw)
+                                       fprintf(stderr, "invalid BASE64 encoding\n");
+                               return NOTOK;
+                       }
 
-                               bits |= value << bitno;
+                       bits |= value << bitno;
 test_end:
-                               if ((bitno -= 6) < 0) {
-                                       if (dp + (3 - skip) > ep)
-                                               goto invalid_digest;
-                                       *dp++ = *b1;
-                                       if (skip < 2) {
-                                               *dp++ = *b2;
-                                               if (skip < 1)
-                                                       *dp++ = *b3;
-                                       }
-                                       bitno = 18;
-                                       bits = 0L;
-                                       skip = 0;
+                       if ((bitno -= 6) < 0) {
+                               if (dp + (3 - skip) > ep)
+                                       goto invalid_digest;
+                               *dp++ = *b1;
+                               if (skip < 2) {
+                                       *dp++ = *b2;
+                                       if (skip < 1)
+                                               *dp++ = *b3;
                                }
-                               break;
+                               bitno = 18;
+                               bits = 0L;
+                               skip = 0;
+                       }
+                       break;
 
-                       case '=':
-                               if (++skip > 3)
-                                       goto self_delimiting;
-                               goto test_end;
+               case '=':
+                       if (++skip > 3)
+                               goto self_delimiting;
+                       goto test_end;
                }
        if (bitno != 18) {
                if (debugsw)
index 5009a2f..73d5e13 100644 (file)
@@ -44,19 +44,19 @@ main(int argc, char **argv)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, switches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, switches);
-                                       done(1);
-                               case UNKWNSW:
-                                       adios(NULL, "-%s unknown", cp);
-
-                               case HELPSW:
-                                       snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
-                                       print_help(buf, switches, 1);
-                                       done(1);
-                               case VERSIONSW:
-                                       print_version(invo_name);
-                                       done(1);
+                       case AMBIGSW:
+                               ambigsw(cp, switches);
+                               done(1);
+                       case UNKWNSW:
+                               adios(NULL, "-%s unknown", cp);
+
+                       case HELPSW:
+                               snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
                        }
                }
                if (*cp == '+' || *cp == '@') {
index 7f3ef70..0136ca3 100644 (file)
@@ -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);
        }
 }
 
@@ -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;
                }
@@ -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 */
index 14963b5..0afcc99 100644 (file)
@@ -138,40 +138,40 @@ static int
 store_switch(CT ct)
 {
        switch (ct->c_type) {
-               case CT_MULTIPART:
-                       return store_multi(ct);
+       case CT_MULTIPART:
+               return store_multi(ct);
+               break;
+
+       case CT_MESSAGE:
+               switch (ct->c_subtype) {
+               case MESSAGE_PARTIAL:
+                       return store_partial(ct);
                        break;
 
-               case CT_MESSAGE:
-                       switch (ct->c_subtype) {
-                               case MESSAGE_PARTIAL:
-                                       return store_partial(ct);
-                                       break;
-
-                               case MESSAGE_EXTERNAL:
-                                       return store_external(ct);
-
-                               case MESSAGE_RFC822:
-                               default:
-                                       return store_generic(ct);
-                                       break;
-                       }
-                       break;
-
-               case CT_APPLICATION:
-                       return store_application(ct);
-                       break;
-
-               case CT_TEXT:
-               case CT_AUDIO:
-               case CT_IMAGE:
-               case CT_VIDEO:
-                       return store_generic(ct);
-                       break;
+               case MESSAGE_EXTERNAL:
+                       return store_external(ct);
 
+               case MESSAGE_RFC822:
                default:
-                       adios(NULL, "unknown content type %d", ct->c_type);
+                       return store_generic(ct);
                        break;
+               }
+               break;
+
+       case CT_APPLICATION:
+               return store_application(ct);
+               break;
+
+       case CT_TEXT:
+       case CT_AUDIO:
+       case CT_IMAGE:
+       case CT_VIDEO:
+               return store_generic(ct);
+               break;
+
+       default:
+               adios(NULL, "unknown content type %d", ct->c_type);
+               break;
        }
 
        return OK;  /* NOT REACHED */
@@ -730,17 +730,16 @@ losing:
 
                for (;;) {
                        switch (cc = read(fd, buffer, sizeof(buffer))) {
-                               case NOTOK:
-                                       advise(file, "error reading content from");
-                                       break;
+                       case NOTOK:
+                               advise(file, "error reading content from");
+                               break;
 
-                               case OK:
-                                       break;
+                       case OK:
+                               break;
 
-                               default:
-                                       fwrite(buffer, sizeof(*buffer),
-                                                       cc, fp);
-                                       continue;
+                       default:
+                               fwrite(buffer, sizeof(*buffer), cc, fp);
+                               continue;
                        }
                        break;
                }
@@ -815,24 +814,24 @@ losing:
                */
                if (filterstate) {
                        switch (buffer[0]) {
-                               case ' ':
-                               case '\t':
-                                       if (filterstate < 0)
-                                               buffer[0] = 0;
-                                       break;
+                       case ' ':
+                       case '\t':
+                               if (filterstate < 0)
+                                       buffer[0] = 0;
+                               break;
 
-                               case '\n':
-                                       filterstate = 0;
-                                       break;
+                       case '\n':
+                               filterstate = 0;
+                               break;
 
-                               default:
-                                       if (!uprf(buffer, XXX_FIELD_PRF) && !uprf(buffer, VRSN_FIELD) && !uprf(buffer, "Subject:") && !uprf(buffer, "Encrypted:") && !uprf(buffer, "Message-ID:")) {
-                                               filterstate = -1;
-                                               buffer[0] = 0;
-                                               break;
-                                       }
-                                       filterstate = 1;
+                       default:
+                               if (!uprf(buffer, XXX_FIELD_PRF) && !uprf(buffer, VRSN_FIELD) && !uprf(buffer, "Subject:") && !uprf(buffer, "Encrypted:") && !uprf(buffer, "Message-ID:")) {
+                                       filterstate = -1;
+                                       buffer[0] = 0;
                                        break;
+                               }
+                               filterstate = 1;
+                               break;
                        }
                }
                fputs(buffer, fp);
@@ -925,67 +924,71 @@ parse_format_string(CT ct, char *cp, char *buffer, int buflen, char *dir)
                /* We are processing a storage escape */
                if (*cp == '%') {
                        switch (*++cp) {
-                               case 'a':
-                                       /*
-                                       ** Insert parameters from Content-Type.
-                                       ** This is only valid for '|' commands.
-                                       */
-                                       if (buffer[0] != '|' && buffer[0] != '!') {
-                                               *bp++ = *--cp;
-                                               *bp = '\0';
-                                               buflen--;
-                                               continue;
-                                       } else {
-                                               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);
-                                                       len = strlen(bp);
-                                                       bp += len;
-                                                       buflen -= len;
-                                                       s = " ";
-                                               }
+                       case 'a':
+                               /*
+                               ** Insert parameters from Content-Type.
+                               ** This is only valid for '|' commands.
+                               */
+                               if (buffer[0] != '|' && buffer[0] != '!') {
+                                       *bp++ = *--cp;
+                                       *bp = '\0';
+                                       buflen--;
+                                       continue;
+                               } else {
+                                       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);
+                                               len = strlen(bp);
+                                               bp += len;
+                                               buflen -= len;
+                                               s = " ";
                                        }
-                                       break;
+                               }
+                               break;
 
-                               case 'm':
-                                       /* insert message number */
-                                       snprintf(bp, buflen, "%s", mhbasename(ct->c_file));
-                                       break;
+                       case 'm':
+                               /* insert message number */
+                               snprintf(bp, buflen, "%s",
+                                               mhbasename(ct->c_file));
+                               break;
 
-                               case 'P':
-                                       /* insert part number with leading dot */
-                                       if (ct->c_partno)
-                                               snprintf(bp, buflen, ".%s", ct->c_partno);
-                                       break;
+                       case 'P':
+                               /* insert part number with leading dot */
+                               if (ct->c_partno)
+                                       snprintf(bp, buflen, ".%s",
+                                                       ct->c_partno);
+                               break;
 
-                               case 'p':
-                                       /* insert part number withouth leading dot */
-                                       if (ct->c_partno)
-                                               strncpy(bp, ct->c_partno, buflen);
-                                       break;
+                       case 'p':
+                               /* insert part number withouth leading dot */
+                               if (ct->c_partno)
+                                       strncpy(bp, ct->c_partno, buflen);
+                               break;
 
-                               case 't':
-                                       /* insert content type */
-                                       strncpy(bp, ci->ci_type, buflen);
-                                       break;
+                       case 't':
+                               /* insert content type */
+                               strncpy(bp, ci->ci_type, buflen);
+                               break;
 
-                               case 's':
-                                       /* insert content subtype */
-                                       strncpy(bp, ci->ci_subtype, buflen);
-                                       break;
+                       case 's':
+                               /* insert content subtype */
+                               strncpy(bp, ci->ci_subtype, buflen);
+                               break;
 
-                               case '%':
-                                       /* insert the character % */
-                                       goto raw;
+                       case '%':
+                               /* insert the character % */
+                               goto raw;
 
-                               default:
-                                       *bp++ = *--cp;
-                                       *bp = '\0';
-                                       buflen--;
-                                       continue;
+                       default:
+                               *bp++ = *--cp;
+                               *bp = '\0';
+                               buflen--;
+                               continue;
                        }
 
                        /* Advance bp and decrement buflen */
index 7b29b54..36edccb 100644 (file)
@@ -83,37 +83,39 @@ main(int argc, char **argv)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, switches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, switches);
-                                       done(1);
-                               case UNKWNSW:
-                                       adios(NULL, "-%s unknown", cp);
-
-                               case HELPSW:
-                                       snprintf(buf, sizeof(buf), "%s [switches] [users ...]", invo_name);
-                                       print_help(buf, switches, 1);
-                                       done(1);
-                               case VERSIONSW:
-                                       print_version(invo_name);
-                                       done(1);
-
-                               case DATESW:
-                                       datesw++;
-                                       continue;
-                               case NDATESW:
-                                       datesw = 0;
-                                       continue;
-
-                               case NOTESW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       notifysw |= donote(cp, 1);
-                                       continue;
-                               case NNOTESW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       notifysw &= ~donote(cp, 0);
-                                       continue;
+                       case AMBIGSW:
+                               ambigsw(cp, switches);
+                               done(1);
+                       case UNKWNSW:
+                               adios(NULL, "-%s unknown", cp);
+
+                       case HELPSW:
+                               snprintf(buf, sizeof(buf), "%s [switches] [users ...]", invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
+
+                       case DATESW:
+                               datesw++;
+                               continue;
+                       case NDATESW:
+                               datesw = 0;
+                               continue;
+
+                       case NOTESW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               notifysw |= donote(cp, 1);
+                               continue;
+                       case NNOTESW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               notifysw &= ~donote(cp, 0);
+                               continue;
                        }
                }
                if (vecp >= MAXVEC-1)
@@ -167,19 +169,18 @@ static int
 donote(char *cp, int ntflag)
 {
        switch (smatch(cp, ntswitches)) {
-               case AMBIGSW:
-                       ambigsw(cp, ntswitches);
-                       done(1);
-               case UNKWNSW:
-                       adios(NULL, "-%snotify %s unknown",
-                                       ntflag ? "" : "no", cp);
-
-               case NALLSW:
-                       return NT_ALL;
-               case NMAISW:
-                       return NT_MAIL;
-               case NNMAISW:
-                       return NT_NMAI;
+       case AMBIGSW:
+               ambigsw(cp, ntswitches);
+               done(1);
+       case UNKWNSW:
+               adios(NULL, "-%snotify %s unknown", ntflag ? "" : "no", cp);
+
+       case NALLSW:
+               return NT_ALL;
+       case NMAISW:
+               return NT_MAIL;
+       case NNMAISW:
+               return NT_NMAI;
        }
 
        /* Before 1999-07-15, garbage was returned if control got here. */
index c4026ba..7a5a06b 100644 (file)
--- a/uip/new.c
+++ b/uip/new.c
@@ -110,66 +110,65 @@ get_msgnums(char *folder, char *sequences[])
        for (state = FLD;;) {
                switch (state = m_getfld(state, name, field, sizeof(field),
                                fp)) {
-                       case FLD:
-                       case FLDPLUS:
-                       case FLDEOF:
-                               if (state == FLDPLUS) {
-                                       cp = getcpy(field);
-                                       while (state == FLDPLUS) {
-                                               state = m_getfld(state, name,
-                                                               field,
-                                                               sizeof(field),
-                                                               fp);
-                                               cp = add(field, cp);
-                                       }
+               case FLD:
+               case FLDPLUS:
+               case FLDEOF:
+                       if (state == FLDPLUS) {
+                               cp = getcpy(field);
+                               while (state == FLDPLUS) {
+                                       state = m_getfld(state, name, field,
+                                                       sizeof(field), fp);
+                                       cp = add(field, cp);
+                               }
 
-                                       /*
-                                       ** Here's where we differ from
-                                       ** seq_public: if it's in a
-                                       ** sequence we want, save the list
-                                       ** of messages.
-                                       */
-                                       if (seq_in_list(name, sequences)) {
-                                               this_msgnums = trimcpy(cp);
-                                               if (msgnums == NULL) {
-                                                       msgnums = this_msgnums;
-                                               } else {
-                                                       old_msgnums = msgnums;
-                                                       msgnums = concat(old_msgnums, " ", this_msgnums, (void *)NULL);
-                                                       free(old_msgnums);
-                                                       free(this_msgnums);
-                                               }
+                               /*
+                               ** Here's where we differ from
+                               ** seq_public: if it's in a
+                               ** sequence we want, save the list
+                               ** of messages.
+                               */
+                               if (seq_in_list(name, sequences)) {
+                                       this_msgnums = trimcpy(cp);
+                                       if (msgnums == NULL) {
+                                               msgnums = this_msgnums;
+                                       } else {
+                                               old_msgnums = msgnums;
+                                               msgnums = concat(old_msgnums, " ", this_msgnums, (void *)NULL);
+                                               free(old_msgnums);
+                                               free(this_msgnums);
                                        }
-                                       free(cp);
-                               } else {
-                                       /* and here */
-                                       if (seq_in_list(name, sequences)) {
-                                               this_msgnums = trimcpy(field);
-                                               if (msgnums == NULL) {
-                                                       msgnums = this_msgnums;
-                                               } else {
-                                                       old_msgnums = msgnums;
-                                                       msgnums = concat(old_msgnums, " ", this_msgnums, (void *)NULL);
-                                                       free(old_msgnums);
-                                                       free(this_msgnums);
-                                               }
+                               }
+                               free(cp);
+                       } else {
+                               /* and here */
+                               if (seq_in_list(name, sequences)) {
+                                       this_msgnums = trimcpy(field);
+                                       if (msgnums == NULL) {
+                                               msgnums = this_msgnums;
+                                       } else {
+                                               old_msgnums = msgnums;
+                                               msgnums = concat(old_msgnums, " ", this_msgnums, (void *)NULL);
+                                               free(old_msgnums);
+                                               free(this_msgnums);
                                        }
                                }
+                       }
 
-                               if (state == FLDEOF)
-                                       break;
-                               continue;
+                       if (state == FLDEOF)
+                               break;
+                       continue;
 
-                       case BODY:
-                       case BODYEOF:
-                               adios(NULL, "no blank lines are permitted in %s", seqfile);
-                               /* fall */
+               case BODY:
+               case BODYEOF:
+                       adios(NULL, "no blank lines are permitted in %s",
+                                       seqfile);
+                       /* fall */
 
-                       case FILEEOF:
-                               break;
+               case FILEEOF:
+                       break;
 
-                       default:
-                               adios(NULL, "%s is poorly formatted", seqfile);
+               default:
+                       adios(NULL, "%s is poorly formatted", seqfile);
                }
                break;  /* break from for loop */
        }
index 9bb61f5..a7b35ba 100644 (file)
@@ -64,35 +64,36 @@ main(int argc, char **argv)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, switches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, switches);
-                                       done(1);
-                               case UNKWNSW:
-                                       adios(NULL, "-%s unknown", cp);
-
-                               case HELPSW:
-                                       snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
-                                       print_help(buf, switches, 1);
-                                       done(1);
-                               case VERSIONSW:
-                                       print_version(invo_name);
-                                       done(1);
-
-                               case FILESW:
-                                       if (file)
-                                               adios(NULL, "only one file at a time!");
-                                       if (!(file = *argp++) || *file == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       continue;
-
-                               case MBOXSW:
-                                       mbx_style = MBOX_FORMAT;
-                                       mapping = 0;
-                                       continue;
-                               case MMDFSW:
-                                       mbx_style = MMDF_FORMAT;
-                                       mapping = 1;
-                                       continue;
+                       case AMBIGSW:
+                               ambigsw(cp, switches);
+                               done(1);
+                       case UNKWNSW:
+                               adios(NULL, "-%s unknown", cp);
+
+                       case HELPSW:
+                               snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
+
+                       case FILESW:
+                               if (file)
+                                       adios(NULL, "only one file at a time!");
+                               if (!(file = *argp++) || *file == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
+
+                       case MBOXSW:
+                               mbx_style = MBOX_FORMAT;
+                               mapping = 0;
+                               continue;
+                       case MMDFSW:
+                               mbx_style = MMDF_FORMAT;
+                               mapping = 1;
+                               continue;
                        }
                }
                if (*cp == '+' || *cp == '@') {
index ffacb5d..e021055 100644 (file)
@@ -247,27 +247,27 @@ parse(void)
        if (*++cp == '-')
                goto header;
        switch (smatch(cp, parswit)) {
-               case AMBIGSW:
-                       ambigsw(cp, parswit);
-                       talked++;
-                       return NULL;
-               case UNKWNSW:
-                       fprintf(stderr, "-%s unknown\n", cp);
-                       talked++;
-                       return NULL;
+       case AMBIGSW:
+               ambigsw(cp, parswit);
+               talked++;
+               return NULL;
+       case UNKWNSW:
+               fprintf(stderr, "-%s unknown\n", cp);
+               talked++;
+               return NULL;
 
-               case PROR:
-                       o = newnexus(ORaction);
-                       o->n_L_child = n;
-                       if ((o->n_R_child = parse()))
-                               return o;
-                       padvise(NULL, "missing disjunctive");
-                       return NULL;
+       case PROR:
+               o = newnexus(ORaction);
+               o->n_L_child = n;
+               if ((o->n_R_child = parse()))
+                       return o;
+               padvise(NULL, "missing disjunctive");
+               return NULL;
 
 header: ;
-               default:
-                       prvarg();
-                       return n;
+       default:
+               prvarg();
+               return n;
        }
 }
 
@@ -288,27 +288,27 @@ nexp1(void)
        if (*++cp == '-')
                goto header;
        switch (smatch(cp, parswit)) {
-               case AMBIGSW:
-                       ambigsw(cp, parswit);
-                       talked++;
-                       return NULL;
-               case UNKWNSW:
-                       fprintf(stderr, "-%s unknown\n", cp);
-                       talked++;
-                       return NULL;
+       case AMBIGSW:
+               ambigsw(cp, parswit);
+               talked++;
+               return NULL;
+       case UNKWNSW:
+               fprintf(stderr, "-%s unknown\n", cp);
+               talked++;
+               return NULL;
 
-               case PRAND:
-                       o = newnexus(ANDaction);
-                       o->n_L_child = n;
-                       if ((o->n_R_child = nexp1()))
-                               return o;
-                       padvise(NULL, "missing conjunctive");
-                       return NULL;
+       case PRAND:
+               o = newnexus(ANDaction);
+               o->n_L_child = n;
+               if ((o->n_R_child = nexp1()))
+                       return o;
+               padvise(NULL, "missing conjunctive");
+               return NULL;
 
 header: ;
-               default:
-                       prvarg();
-                       return n;
+       default:
+               prvarg();
+               return n;
        }
 }
 
@@ -330,26 +330,26 @@ nexp2(void)
        if (*++cp == '-')
                goto header;
        switch (smatch(cp, parswit)) {
-               case AMBIGSW:
-                       ambigsw(cp, parswit);
-                       talked++;
-                       return NULL;
-               case UNKWNSW:
-                       fprintf(stderr, "-%s unknown\n", cp);
-                       talked++;
-                       return NULL;
+       case AMBIGSW:
+               ambigsw(cp, parswit);
+               talked++;
+               return NULL;
+       case UNKWNSW:
+               fprintf(stderr, "-%s unknown\n", cp);
+               talked++;
+               return NULL;
 
-               case PRNOT:
-                       n = newnexus(NOTaction);
-                       if ((n->n_L_child = nexp3()))
-                               return n;
-                       padvise(NULL, "missing negation");
-                       return NULL;
+       case PRNOT:
+               n = newnexus(NOTaction);
+               if ((n->n_L_child = nexp3()))
+                       return n;
+               padvise(NULL, "missing negation");
+               return NULL;
 
 header: ;
-               default:
-                       prvarg();
-                       return nexp3();
+       default:
+               prvarg();
+               return nexp3();
        }
 }
 
@@ -374,100 +374,93 @@ nexp3(void)
                goto header;
        }
        switch (i = smatch(cp, parswit)) {
-               case AMBIGSW:
-                       ambigsw(cp, parswit);
-                       talked++;
-                       return NULL;
-               case UNKWNSW:
-                       fprintf(stderr, "-%s unknown\n", cp);
-                       talked++;
-                       return NULL;
+       case AMBIGSW:
+               ambigsw(cp, parswit);
+               talked++;
+               return NULL;
+       case UNKWNSW:
+               fprintf(stderr, "-%s unknown\n", cp);
+               talked++;
+               return NULL;
 
-               case PRLBR:
-                       if ((n = parse()) == NULL) {
-                               padvise(NULL, "missing group");
-                               return NULL;
-                       }
-                       if ((cp = nxtarg()) == NULL) {
-                               padvise(NULL, "missing -rbrace");
-                               return NULL;
-                       }
-                       if (*cp++ == '-' && smatch(cp, parswit) == PRRBR)
-                               return n;
-                       padvise(NULL, "%s unexpected", --cp);
+       case PRLBR:
+               if ((n = parse()) == NULL) {
+                       padvise(NULL, "missing group");
                        return NULL;
-
-               default:
-                       prvarg();
+               }
+               if ((cp = nxtarg()) == NULL) {
+                       padvise(NULL, "missing -rbrace");
                        return NULL;
+               }
+               if (*cp++ == '-' && smatch(cp, parswit) == PRRBR)
+                       return n;
+               padvise(NULL, "%s unexpected", --cp);
+               return NULL;
+
+       default:
+               prvarg();
+               return NULL;
 
-               case PRCC:
-               case PRDATE:
-               case PRFROM:
-               case PRTO:
-               case PRSUBJ:
-                       strncpy(temp, parswit[i].sw, sizeof(temp));
-                       temp[sizeof(temp) - 1] = '\0';
-                       dp = *brkstring(temp, " ", NULL);
+       case PRCC:
+       case PRDATE:
+       case PRFROM:
+       case PRTO:
+       case PRSUBJ:
+               strncpy(temp, parswit[i].sw, sizeof(temp));
+               temp[sizeof(temp) - 1] = '\0';
+               dp = *brkstring(temp, " ", NULL);
 header: ;
-                       if (!(cp = nxtarg())) {  /* allow -xyz arguments */
-                               padvise(NULL, "missing argument to %s",
-                                               argp[-2]);
-                               return NULL;
-                       }
-                       n = newnexus(GREPaction);
-                       n->n_header = 1;
-                       snprintf(buffer, sizeof(buffer), "^%s[ \t]*:.*%s",
-                                       dp, cp);
-                       dp = buffer;
-                       goto pattern;
-
-               case PRSRCH:
-                       n = newnexus(GREPaction);
-                       n->n_header = 0;
-                       if (!(cp = nxtarg())) {  /* allow -xyz arguments */
-                               padvise(NULL, "missing argument to %s",
-                                               argp[-2]);
-                               return NULL;
-                       }
-                       dp = cp;
+               if (!(cp = nxtarg())) {  /* allow -xyz arguments */
+                       padvise(NULL, "missing argument to %s", argp[-2]);
+                       return NULL;
+               }
+               n = newnexus(GREPaction);
+               n->n_header = 1;
+               snprintf(buffer, sizeof(buffer), "^%s[ \t]*:.*%s", dp, cp);
+               dp = buffer;
+               goto pattern;
+
+       case PRSRCH:
+               n = newnexus(GREPaction);
+               n->n_header = 0;
+               if (!(cp = nxtarg())) {  /* allow -xyz arguments */
+                       padvise(NULL, "missing argument to %s", argp[-2]);
+                       return NULL;
+               }
+               dp = cp;
 pattern: ;
-                       if (!gcompile(n, dp)) {
-                               padvise(NULL, "pattern error in %s %s",
-                                               argp[-2], cp);
-                               return NULL;
-                       }
-                       n->n_patbuf = getcpy(dp);
-                       return n;
+               if (!gcompile(n, dp)) {
+                       padvise(NULL, "pattern error in %s %s", argp[-2], cp);
+                       return NULL;
+               }
+               n->n_patbuf = getcpy(dp);
+               return n;
+
+       case PROTHR:
+               padvise(NULL, "internal error!");
+               return NULL;
 
-               case PROTHR:
-                       padvise(NULL, "internal error!");
+       case PRDATF:
+               if (!(datesw = nxtarg()) || *datesw == '-') {
+                       padvise(NULL, "missing argument to %s",
+                                       argp[-2]);
                        return NULL;
+               }
+               return nexp3();
 
-               case PRDATF:
-                       if (!(datesw = nxtarg()) || *datesw == '-') {
-                               padvise(NULL, "missing argument to %s",
-                                               argp[-2]);
-                               return NULL;
-                       }
-                       return nexp3();
-
-               case PRAFTR:
-               case PRBEFR:
-                       if (!(cp = nxtarg())) {  /* allow -xyz arguments */
-                               padvise(NULL, "missing argument to %s",
-                                               argp[-2]);
-                               return NULL;
-                       }
-                       n = newnexus(TWSaction);
-                       n->n_datef = datesw;
-                       if (!tcompile(cp, &n->n_tws, n->n_after =
-                                       i == PRAFTR)) {
-                               padvise(NULL, "unable to parse %s %s",
-                                               argp[-2], cp);
-                               return NULL;
-                       }
-                       return n;
+       case PRAFTR:
+       case PRBEFR:
+               if (!(cp = nxtarg())) {  /* allow -xyz arguments */
+                       padvise(NULL, "missing argument to %s", argp[-2]);
+                       return NULL;
+               }
+               n = newnexus(TWSaction);
+               n->n_datef = datesw;
+               if (!tcompile(cp, &n->n_tws, n->n_after = i == PRAFTR)) {
+                       padvise(NULL, "unable to parse %s %s", argp[-2], cp);
+                       return NULL;
+               }
+               return n;
        }
 }
 
@@ -597,66 +590,66 @@ gcompile(struct nexus *n, char *astr)
                if ((c = *sp++) != '*')
                        lastep = ep;
                switch (c) {
-                       case '\0':
-                               *ep++ = CEOF;
-                               return 1;
+               case '\0':
+                       *ep++ = CEOF;
+                       return 1;
 
-                       case '.':
-                               *ep++ = CDOT;
-                               continue;
+               case '.':
+                       *ep++ = CDOT;
+                       continue;
 
-                       case '*':
-                               if (lastep == 0)
-                                       goto defchar;
-                               *lastep |= STAR;
-                               continue;
+               case '*':
+                       if (lastep == 0)
+                               goto defchar;
+                       *lastep |= STAR;
+                       continue;
 
-                       case '$':
-                               if (*sp != '\0')
-                                       goto defchar;
-                               *ep++ = CDOL;
-                               continue;
+               case '$':
+                       if (*sp != '\0')
+                               goto defchar;
+                       *ep++ = CDOL;
+                       continue;
 
-                       case '[':
-                               *ep++ = CCL;
-                               *ep++ = 0;
-                               cclcnt = 0;
-                               if ((c = *sp++) == '^') {
-                                       c = *sp++;
-                                       ep[-2] = NCCL;
-                               }
-                               if (c == '-') {
-                                       *ep++ = c;
-                                       cclcnt++;
-                                       c = *sp++;
-                               }
-                               do {
-                                       if (c == '-' && *sp != '\0' && *sp != ']') {
-                                               for (c = ep[-1]+1; c < *sp; c++) {
-                                                               *ep++ = c;
-                                                               cclcnt++;
-                                                       if (c == '\0' || ep >= dp)
-                                                               goto cerror;
-                                               }
-                                       } else {
-                                               *ep++ = c;
-                                               cclcnt++;
+               case '[':
+                       *ep++ = CCL;
+                       *ep++ = 0;
+                       cclcnt = 0;
+                       if ((c = *sp++) == '^') {
+                               c = *sp++;
+                               ep[-2] = NCCL;
+                       }
+                       if (c == '-') {
+                               *ep++ = c;
+                               cclcnt++;
+                               c = *sp++;
+                       }
+                       do {
+                               if (c == '-' && *sp != '\0' && *sp != ']') {
+                                       for (c = ep[-1]+1; c < *sp; c++) {
+                                                       *ep++ = c;
+                                                       cclcnt++;
                                                if (c == '\0' || ep >= dp)
                                                        goto cerror;
                                        }
-                               } while ((c = *sp++) != ']');
-                               if (cclcnt > 255)
-                                       goto cerror;
-                               lastep[1] = cclcnt;
-                               continue;
+                               } else {
+                                       *ep++ = c;
+                                       cclcnt++;
+                                       if (c == '\0' || ep >= dp)
+                                               goto cerror;
+                               }
+                       } while ((c = *sp++) != ']');
+                       if (cclcnt > 255)
+                               goto cerror;
+                       lastep[1] = cclcnt;
+                       continue;
 
                        case '\\':
                                if ((c = *sp++) == '\0')
-                                       goto cerror;
-               defchar:
-                       default:
-                               *ep++ = CCHR;
-                               *ep++ = c;
+                               goto cerror;
+defchar:
+               default:
+                       *ep++ = CCHR;
+                       *ep++ = c;
                }
        }
 
@@ -758,70 +751,70 @@ advance(char *alp, char *aep)
        ep = (unsigned char *)aep;
        for (;;)
                switch (*ep++) {
-                       case CCHR:
-                               if (*ep++ == *lp++ || ep[-1] == cc[lp[-1]])
-                                       continue;
-                               return 0;
-
-                       case CDOT:
-                               if (*lp++)
-                                       continue;
-                               return 0;
-
-                       case CDOL:
-                               if (*lp == 0)
-                                       continue;
-                               return 0;
-
-                       case CEOF:
-                               return 1;
+               case CCHR:
+                       if (*ep++ == *lp++ || ep[-1] == cc[lp[-1]])
+                               continue;
+                       return 0;
 
-                       case CCL:
-                               if (cclass(ep, *lp++, 1)) {
-                                       ep += *ep + 1;
-                                       continue;
-                               }
-                               return 0;
+               case CDOT:
+                       if (*lp++)
+                               continue;
+                       return 0;
 
-                       case NCCL:
-                               if (cclass(ep, *lp++, 0)) {
-                                       ep += *ep + 1;
-                                       continue;
-                               }
-                               return 0;
-
-                       case CDOT | STAR:
-                               curlp = lp;
-                               while (*lp++)
-                                       continue;
-                               goto star;
-
-                       case CCHR | STAR:
-                               curlp = lp;
-                               while (*lp++ == *ep || cc[lp[-1]] == *ep)
-                                       continue;
-                               ep++;
-                               goto star;
-
-                       case CCL | STAR:
-                       case NCCL | STAR:
-                               curlp = lp;
-                               while (cclass(ep, *lp++, ep[-1] == (CCL | STAR)))
-                                       continue;
+               case CDOL:
+                       if (*lp == 0)
+                               continue;
+                       return 0;
+
+               case CEOF:
+                       return 1;
+
+               case CCL:
+                       if (cclass(ep, *lp++, 1)) {
+                               ep += *ep + 1;
+                               continue;
+                       }
+                       return 0;
+
+               case NCCL:
+                       if (cclass(ep, *lp++, 0)) {
                                ep += *ep + 1;
-                               goto star;
-
-               star:
-                               do {
-                                       lp--;
-                                       if (advance(lp, ep))
-                                               return (1);
-                               } while (lp > curlp);
-                               return 0;
-
-                       default:
-                               admonish(NULL, "advance() botch -- you lose big");
-                               return 0;
+                               continue;
+                       }
+                       return 0;
+
+               case CDOT | STAR:
+                       curlp = lp;
+                       while (*lp++)
+                               continue;
+                       goto star;
+
+               case CCHR | STAR:
+                       curlp = lp;
+                       while (*lp++ == *ep || cc[lp[-1]] == *ep)
+                               continue;
+                       ep++;
+                       goto star;
+
+               case CCL | STAR:
+               case NCCL | STAR:
+                       curlp = lp;
+                       while (cclass(ep, *lp++, ep[-1] == (CCL | STAR)))
+                               continue;
+                       ep += *ep + 1;
+                       goto star;
+
+star:
+                       do {
+                               lp--;
+                               if (advance(lp, ep))
+                                       return (1);
+                       } while (lp > curlp);
+                       return 0;
+
+               default:
+                       admonish(NULL, "advance() botch -- you lose big");
+                       return 0;
                }
 }
 
@@ -950,35 +943,35 @@ plist
        fseek(fp, start, SEEK_SET);
        for (state = FLD, bp = NULL;;) {
                switch (state = m_getfld(state, name, buf, sizeof buf, fp)) {
-                       case FLD:
-                       case FLDEOF:
-                       case FLDPLUS:
-                               if (bp != NULL)
-                                       free(bp), bp = NULL;
-                               bp = getcpy(buf);
-                               while (state == FLDPLUS) {
-                                       state = m_getfld(state, name, buf,
-                                                       sizeof buf, fp);
-                                       bp = add(buf, bp);
-                               }
-                               if (!mh_strcasecmp(name, n->n_datef))
-                                       break;
-                               if (state != FLDEOF)
-                                       continue;
-
-                       case BODY:
-                       case BODYEOF:
-                       case FILEEOF:
-                       case LENERR:
-                       case FMTERR:
-                               if (state == LENERR || state == FMTERR)
-                                       advise(NULL, "format error in message %d", msgnum);
-                               if (bp != NULL)
-                                       free(bp);
-                               return 0;
-
-                       default:
-                               adios(NULL, "internal error -- you lose");
+               case FLD:
+               case FLDEOF:
+               case FLDPLUS:
+                       if (bp != NULL)
+                               free(bp), bp = NULL;
+                       bp = getcpy(buf);
+                       while (state == FLDPLUS) {
+                               state = m_getfld(state, name, buf,
+                                               sizeof buf, fp);
+                               bp = add(buf, bp);
+                       }
+                       if (!mh_strcasecmp(name, n->n_datef))
+                               break;
+                       if (state != FLDEOF)
+                               continue;
+
+               case BODY:
+               case BODYEOF:
+               case FILEEOF:
+               case LENERR:
+               case FMTERR:
+                       if (state == LENERR || state == FMTERR)
+                               advise(NULL, "format error in message %d", msgnum);
+                       if (bp != NULL)
+                               free(bp);
+                       return 0;
+
+               default:
+                       adios(NULL, "internal error -- you lose");
                }
                break;
        }
index 5b2131c..db61fb3 100644 (file)
@@ -121,58 +121,60 @@ main(int argc, char **argv)
        while ((cp = *argp++))
                if (*cp == '-') {
                        switch (smatch(++cp, switches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, switches);
-                                       done(1);
-                               case UNKWNSW:
-                                       adios(NULL, "-%s unknown", cp);
-
-                               case HELPSW:
-                                       snprintf(buffer, sizeof(buffer),
-                                                       "%s [switches] file",
-                                                       invo_name);
-                                       print_help(buffer, switches, 1);
-                                       done(1);
-                               case VERSIONSW:
-                                       print_version(invo_name);
-                                       done(1);
+                       case AMBIGSW:
+                               ambigsw(cp, switches);
+                               done(1);
+                       case UNKWNSW:
+                               adios(NULL, "-%s unknown", cp);
+
+                       case HELPSW:
+                               snprintf(buffer, sizeof(buffer),
+                                               "%s [switches] file",
+                                               invo_name);
+                               print_help(buffer, switches, 1);
+                               done(1);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
+
+                       case ERASESW:
+                               if (!(erasep = *argp++) || *erasep == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
+                       case KILLSW:
+                               if (!(killp = *argp++) || *killp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
 
-                               case ERASESW:
-                                       if (!(erasep = *argp++) || *erasep == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       continue;
-                               case KILLSW:
-                                       if (!(killp = *argp++) || *killp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       continue;
-
-                               case PREPSW:
-                                       prepend++;
-                                       continue;
-                               case NPREPSW:
-                                       prepend = 0;
-                                       continue;
-
-                               case RAPDSW:
-                                       rapid++;
-                                       continue;
-                               case NRAPDSW:
-                                       rapid = 0;
-                                       continue;
-
-                               case BODYSW:
-                                       body++;
-                                       continue;
-                               case NBODYSW:
-                                       body = 0;
-                                       continue;
-
-                               case DOTSW:
-                                       doteof++;
-                                       continue;
-                               case NDOTSW:
-                                       doteof = 0;
-                                       continue;
+                       case PREPSW:
+                               prepend++;
+                               continue;
+                       case NPREPSW:
+                               prepend = 0;
+                               continue;
+
+                       case RAPDSW:
+                               rapid++;
+                               continue;
+                       case NRAPDSW:
+                               rapid = 0;
+                               continue;
+
+                       case BODYSW:
+                               body++;
+                               continue;
+                       case NBODYSW:
+                               body = 0;
+                               continue;
+
+                       case DOTSW:
+                               doteof++;
+                               continue;
+                       case NDOTSW:
+                               doteof = 0;
+                               continue;
                        }
                } else if (!drft) {
                        drft = cp;
@@ -255,115 +257,115 @@ main(int argc, char **argv)
        for (state = FLD;;) {
                switch (state = m_getfld(state, name, field, sizeof(field),
                                in)) {
-                       case FLD:
-                       case FLDEOF:
-                       case FLDPLUS:
-                               /*
-                               ** Check if the value of field contains
-                               ** anything other than space or tab.
-                               */
-                               for (cp = field; *cp; cp++)
-                                       if (*cp != ' ' && *cp != '\t')
-                                               break;
-
-                               /* If so, just add header line to draft */
-                               if (*cp++ != '\n' || *cp != 0) {
-                                       printf("%s:%s", name, field);
-                                       fprintf(out, "%s:%s", name, field);
-                                       while (state == FLDPLUS) {
-                                               state = m_getfld(state, name, field, sizeof(field), in);
-                                               printf("%s", field);
-                                               fprintf(out, "%s", field);
-                                       }
-                               } else {
-                                       /* Else, get value of header field */
-                                       printf("%s: ", name);
-                                       fflush(stdout);
-                                       i = getln(field, sizeof(field));
-                                       if (i == -1) {
+               case FLD:
+               case FLDEOF:
+               case FLDPLUS:
+                       /*
+                       ** Check if the value of field contains
+                       ** anything other than space or tab.
+                       */
+                       for (cp = field; *cp; cp++)
+                               if (*cp != ' ' && *cp != '\t')
+                                       break;
+
+                       /* If so, just add header line to draft */
+                       if (*cp++ != '\n' || *cp != 0) {
+                               printf("%s:%s", name, field);
+                               fprintf(out, "%s:%s", name, field);
+                               while (state == FLDPLUS) {
+                                       state = m_getfld(state, name, field,
+                                                       sizeof(field), in);
+                                       printf("%s", field);
+                                       fprintf(out, "%s", field);
+                               }
+                       } else {
+                               /* Else, get value of header field */
+                               printf("%s: ", name);
+                               fflush(stdout);
+                               i = getln(field, sizeof(field));
+                               if (i == -1) {
 abort:
-                                               if (killp || erasep) {
+                                       if (killp || erasep) {
 #ifdef HAVE_TERMIOS_H
-                                                       tcsetattr(0, TCSADRAIN, &tio);
+                                               tcsetattr(0, TCSADRAIN, &tio);
 #else
 # ifdef HAVE_TERMIO
-                                                       ioctl(0, TCSETA, &tio);
+                                               ioctl(0, TCSETA, &tio);
 # else
-                                                       ioctl(0, TIOCSETN, (char *) &tio);
+                                               ioctl(0, TIOCSETN, (char *) &tio);
 # endif
 #endif
-                                               }
-                                               unlink(tmpfil);
-                                               done(1);
-                                       }
-                                       if (i != 0 || (field[0] != '\n' && field[0] != 0)) {
-                                               fprintf(out, "%s:", name);
-                                               do {
-                                                       if (field[0] != ' ' && field[0] != '\t')
-                                                               putc(' ', out);
-                                                       fprintf(out, "%s", field);
-                                               } while (i == 1 && (i = getln(field, sizeof(field))) >= 0);
-                                               if (i == -1)
-                                                       goto abort;
                                        }
+                                       unlink(tmpfil);
+                                       done(1);
                                }
-
-                               if (state == FLDEOF) {  /* moby hack */
-                                       fprintf(out, "--------\n");
-                                       printf("--------\n");
-                                       if (!body)
-                                               break;
-                                       goto no_body;
+                               if (i != 0 || (field[0] != '\n' && field[0] != 0)) {
+                                       fprintf(out, "%s:", name);
+                                       do {
+                                               if (field[0] != ' ' && field[0] != '\t')
+                                                       putc(' ', out);
+                                               fprintf(out, "%s", field);
+                                       } while (i == 1 && (i = getln(field, sizeof(field))) >= 0);
+                                       if (i == -1)
+                                               goto abort;
                                }
-                               continue;
+                       }
 
-                       case BODY:
-                       case BODYEOF:
-                       case FILEEOF:
+                       if (state == FLDEOF) {  /* moby hack */
+                               fprintf(out, "--------\n");
+                               printf("--------\n");
                                if (!body)
                                        break;
-                               fprintf(out, "--------\n");
-                               if (field[0] == 0 || !prepend)
-                                       printf("--------\n");
-                               if (field[0]) {
-                                       if (prepend && body) {
-                                               printf("\n--------Enter initial text\n\n");
-                                               fflush(stdout);
-                                               for (;;) {
-                                                       getln(buffer, sizeof(buffer));
-                                                       if (doteof && buffer[0] == '.' && buffer[1] == '\n')
-                                                               break;
-                                                       if (buffer[0] == 0)
-                                                               break;
-                                                       fprintf(out, "%s", buffer);
-                                               }
-                                       }
+                               goto no_body;
+                       }
+                       continue;
 
-                                       do {
-                                               fprintf(out, "%s", field);
-                                               if (!rapid && !sigint)
-                                                       printf("%s", field);
-                                       } while (state == BODY &&
-                                                       (state = m_getfld(state, name, field, sizeof(field), in)));
-                                       if (prepend || !body)
-                                               break;
-                                       else
-                                               printf ("\n--------Enter additional text\n\n");
+               case BODY:
+               case BODYEOF:
+               case FILEEOF:
+                       if (!body)
+                               break;
+                       fprintf(out, "--------\n");
+                       if (field[0] == 0 || !prepend)
+                               printf("--------\n");
+                       if (field[0]) {
+                               if (prepend && body) {
+                                       printf("\n--------Enter initial text\n\n");
+                                       fflush(stdout);
+                                       for (;;) {
+                                               getln(buffer, sizeof(buffer));
+                                               if (doteof && buffer[0] == '.' && buffer[1] == '\n')
+                                                       break;
+                                               if (buffer[0] == 0)
+                                                       break;
+                                               fprintf(out, "%s", buffer);
+                                       }
                                }
+
+                               do {
+                                       fprintf(out, "%s", field);
+                                       if (!rapid && !sigint)
+                                               printf("%s", field);
+                               } while (state == BODY && (state = m_getfld(state, name, field, sizeof(field), in)));
+                               if (prepend || !body)
+                                       break;
+                               else
+                                       printf ("\n--------Enter additional text\n\n");
+                       }
 no_body:
-                               fflush(stdout);
-                               for (;;) {
-                                       getln(field, sizeof(field));
-                                       if (doteof && field[0] == '.' && field[1] == '\n')
-                                               break;
-                                       if (field[0] == 0)
-                                               break;
-                                        fprintf(out, "%s", field);
-                               }
-                               break;
+                       fflush(stdout);
+                       for (;;) {
+                               getln(field, sizeof(field));
+                               if (doteof && field[0] == '.' && field[1] == '\n')
+                                       break;
+                               if (field[0] == 0)
+                                       break;
+                                fprintf(out, "%s", field);
+                       }
+                       break;
 
-                       default:
-                               adios(NULL, "skeleton is poorly formatted");
+               default:
+                       adios(NULL, "skeleton is poorly formatted");
                }
                break;
        }
@@ -413,40 +415,40 @@ getln(char *buffer, int n)
        *cp = 0;
 
        switch (setjmp(sigenv)) {
-               case OK:
-                       wtuser = 1;
-                       break;
+       case OK:
+               wtuser = 1;
+               break;
 
-               case DONE:
-                       wtuser = 0;
-                       return 0;
+       case DONE:
+               wtuser = 0;
+               return 0;
 
-               default:
-                       wtuser = 0;
-                       return NOTOK;
+       default:
+               wtuser = 0;
+               return NOTOK;
        }
 
        for (;;) {
                switch (c = getchar()) {
-                       case EOF:
-                               clearerr(stdin);
-                               longjmp(sigenv, DONE);
-
-                       case '\n':
-                               if (cp[-1] == QUOTE) {
-                                       cp[-1] = c;
-                                       wtuser = 0;
-                                       return 1;
-                               }
-                               *cp++ = c;
-                               *cp = 0;
+               case EOF:
+                       clearerr(stdin);
+                       longjmp(sigenv, DONE);
+
+               case '\n':
+                       if (cp[-1] == QUOTE) {
+                               cp[-1] = c;
                                wtuser = 0;
-                               return 0;
+                               return 1;
+                       }
+                       *cp++ = c;
+                       *cp = 0;
+                       wtuser = 0;
+                       return 0;
 
-                       default:
-                               if (cp < buffer + n)
-                                       *cp++ = c;
-                               *cp = 0;
+               default:
+                       if (cp < buffer + n)
+                               *cp++ = c;
+                       *cp = 0;
                }
        }
 }
index 24cf48b..077f912 100644 (file)
@@ -61,25 +61,26 @@ main(int argc, char **argv)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, switches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, switches);
-                                       done(1);
-                               case UNKWNSW:
-                                       vec[vecp++] = --cp;
-                                       continue;
-
-                               case HELPSW:
-                                       snprintf(buf, sizeof(buf), "%s [switches] [switches for postproc] address ...", invo_name);
-                                       print_help(buf, switches, 1);
-                                       done(1);
-                               case VERSIONSW:
-                                       print_version(invo_name);
-                                       done(1);
-
-                               case FORMSW:
-                                       if (!(form = *argp++) || *form == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       continue;
+                       case AMBIGSW:
+                               ambigsw(cp, switches);
+                               done(1);
+                       case UNKWNSW:
+                               vec[vecp++] = --cp;
+                               continue;
+
+                       case HELPSW:
+                               snprintf(buf, sizeof(buf), "%s [switches] [switches for postproc] address ...", invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
+
+                       case FORMSW:
+                               if (!(form = *argp++) || *form == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
                        }
                }
                addrs = addrs ? add(cp, add(", ", addrs)) : getcpy(cp);
@@ -115,16 +116,16 @@ main(int argc, char **argv)
        for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++)
                sleep(5);
        switch (child_id) {
-               case NOTOK:
-                       admonish(NULL, "unable to fork");/* fall */
-               case OK:
-                       execvp(postproc, vec);
-                       fprintf(stderr, "unable to exec ");
-                       perror(postproc);
-                       _exit(1);
-
-               default:
-                       done(pidXwait(child_id, postproc));
+       case NOTOK:
+               admonish(NULL, "unable to fork");/* fall */
+       case OK:
+               execvp(postproc, vec);
+               fprintf(stderr, "unable to exec ");
+               perror(postproc);
+               _exit(1);
+
+       default:
+               done(pidXwait(child_id, postproc));
        }
 
        return 0;  /* dead code to satisfy the compiler */
@@ -204,48 +205,48 @@ rcvdistout(FILE *inb, char *form, char *addrs)
 
        for (state = FLD;;) {
                switch (state = m_getfld(state, name, tmpbuf, SBUFSIZ, inb)) {
-                       case FLD:
-                       case FLDPLUS:
-                               if ((cptr = wantcomp[CHASH(name)]))
-                                       do {
-                                               if (!mh_strcasecmp(name, cptr->c_name)) {
-                                                       char_read += msg_count;
-                                                       if (!cptr->c_text) {
-                                                               cptr->c_text = tmpbuf;
-                                                               *--savecomp = cptr;
-                                                               tmpbuf = *nxtbuf++;
-                                                       } else {
-                                                               i = strlen(cp = cptr->c_text) - 1;
-                                                               if (cp[i] == '\n') {
-                                                                       if (cptr->c_type & CT_ADDR) {
-                                                                               cp[i] = 0;
-                                                                               cp = add(",\n\t", cp);
-                                                                       } else
-                                                                               cp = add("\t", cp);
-                                                               }
-                                                               cptr->c_text = add(tmpbuf, cp);
-                                                       }
-                                                       while (state == FLDPLUS) {
-                                                               state = m_getfld(state, name, tmpbuf, SBUFSIZ, inb);
-                                                               cptr->c_text = add(tmpbuf, cptr->c_text);
-                                                               char_read += msg_count;
+               case FLD:
+               case FLDPLUS:
+                       if ((cptr = wantcomp[CHASH(name)]))
+                               do {
+                                       if (!mh_strcasecmp(name, cptr->c_name)) {
+                                               char_read += msg_count;
+                                               if (!cptr->c_text) {
+                                                       cptr->c_text = tmpbuf;
+                                                       *--savecomp = cptr;
+                                                       tmpbuf = *nxtbuf++;
+                                               } else {
+                                                       i = strlen(cp = cptr->c_text) - 1;
+                                                       if (cp[i] == '\n') {
+                                                               if (cptr->c_type & CT_ADDR) {
+                                                                       cp[i] = 0;
+                                                                       cp = add(",\n\t", cp);
+                                                               } else
+                                                                       cp = add("\t", cp);
                                                        }
-                                                       break;
+                                                       cptr->c_text = add(tmpbuf, cp);
                                                }
-                                       } while ((cptr = cptr->c_next));
+                                               while (state == FLDPLUS) {
+                                                       state = m_getfld(state, name, tmpbuf, SBUFSIZ, inb);
+                                                       cptr->c_text = add(tmpbuf, cptr->c_text);
+                                                       char_read += msg_count;
+                                               }
+                                               break;
+                                       }
+                               } while ((cptr = cptr->c_next));
 
-                               while (state == FLDPLUS)
-                                       state = m_getfld(state, name, tmpbuf, SBUFSIZ, inb);
-                               break;
+                       while (state == FLDPLUS)
+                               state = m_getfld(state, name, tmpbuf, SBUFSIZ, inb);
+                       break;
 
-                       case LENERR:
-                       case FMTERR:
-                       case BODY:
-                       case FILEEOF:
-                               goto finished;
+               case LENERR:
+               case FMTERR:
+               case BODY:
+               case FILEEOF:
+                       goto finished;
 
-                       default:
-                               adios(NULL, "m_getfld() returned %d", state);
+               default:
+                       adios(NULL, "m_getfld() returned %d", state);
                }
        }
 finished: ;
index 84fcc26..f9687d8 100644 (file)
@@ -53,28 +53,28 @@ main(int argc, char **argv)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, switches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, switches);
-                                       done(1);
-                               case UNKWNSW:
-                                       adios(NULL, "-%s unknown", cp);
-
-                               case HELPSW:
-                                       snprintf(buf, sizeof(buf),
-                                                       "%s [switches] file",
-                                                       invo_name);
-                                       print_help(buf, switches, 1);
-                                       done(1);
-                               case VERSIONSW:
-                                       print_version(invo_name);
-                                       done(1);
-
-                               case MBOXSW:
-                                       mbx_style = MBOX_FORMAT;
-                                       continue;
-                               case MMDFSW:
-                                       mbx_style = MMDF_FORMAT;
-                                       continue;
+                       case AMBIGSW:
+                               ambigsw(cp, switches);
+                               done(1);
+                       case UNKWNSW:
+                               adios(NULL, "-%s unknown", cp);
+
+                       case HELPSW:
+                               snprintf(buf, sizeof(buf),
+                                               "%s [switches] file",
+                                               invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
+
+                       case MBOXSW:
+                               mbx_style = MBOX_FORMAT;
+                               continue;
+                       case MMDFSW:
+                               mbx_style = MMDF_FORMAT;
+                               continue;
                        }
                }
                if (file)
index 20274e7..a71a516 100644 (file)
@@ -111,55 +111,57 @@ main(int argc, char **argv)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, switches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, switches);
-                                       done(1);
-                               case UNKWNSW:
-                                       vec[vecp++] = --cp;
-                                       continue;
-
-                               case HELPSW:
-                                       snprintf(buf, sizeof(buf),
-                                                       "%s [command ...]",
-                                                       invo_name);
-                                       print_help(buf, switches, 1);
-                                       done(1);
-                               case VERSIONSW:
-                                       print_version(invo_name);
-                                       done(1);
-
-                               case BIFFSW:
-                                       biff = 1;
-                                       continue;
-
-                               case FORMSW:
-                                       if (!(form = *argp++) || *form == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       format = NULL;
-                                       continue;
-                               case FMTSW:
-                                       if (!(format = *argp++) || *format == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       form = NULL;
-                                       continue;
-
-                               case WIDTHSW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       width = atoi(cp);
-                                       continue;
-                               case NLSW:
-                                       newline = 1;
-                                       continue;
-                               case NNLSW:
-                                       newline = 0;
-                                       continue;
-                               case BELSW:
-                                       bell = 1;
-                                       continue;
-                               case NBELSW:
-                                       bell = 0;
-                                       continue;
+                       case AMBIGSW:
+                               ambigsw(cp, switches);
+                               done(1);
+                       case UNKWNSW:
+                               vec[vecp++] = --cp;
+                               continue;
+
+                       case HELPSW:
+                               snprintf(buf, sizeof(buf), "%s [command ...]",
+                                               invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
+
+                       case BIFFSW:
+                               biff = 1;
+                               continue;
+
+                       case FORMSW:
+                               if (!(form = *argp++) || *form == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               format = NULL;
+                               continue;
+                       case FMTSW:
+                               if (!(format = *argp++) || *format == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               form = NULL;
+                               continue;
+
+                       case WIDTHSW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               width = atoi(cp);
+                               continue;
+                       case NLSW:
+                               newline = 1;
+                               continue;
+                       case NNLSW:
+                               newline = 0;
+                               continue;
+                       case BELSW:
+                               bell = 1;
+                               continue;
+                       case NBELSW:
+                               bell = 0;
+                               continue;
 
                        }
                }
index ff936bc..95b4f69 100644 (file)
@@ -132,135 +132,145 @@ main(int argc, char **argv)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, switches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, switches);
-                                       done(1);
-                               case UNKWNSW:
-                                       adios(NULL, "-%s unknown", cp);
-
-                               case HELPSW:
-                                       snprintf(buf, sizeof(buf), "%s: [+folder] [msg] [switches]", invo_name);
-                                       print_help(buf, switches, 1);
-                                       done(0);
-                               case VERSIONSW:
-                                       print_version(invo_name);
-                                       done(1);
-
-                               case GROUPSW:
-                                       groupreply++;
-                                       continue;
-                               case NGROUPSW:
-                                       groupreply = 0;
-                                       continue;
-
-                               case ANNOSW:
-                                       anot++;
-                                       continue;
-                               case NANNOSW:
-                                       anot = 0;
-                                       continue;
-
-                               case CCSW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       docc(cp, 1);
-                                       continue;
-                               case NCCSW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       docc(cp, 0);
-                                       continue;
-
-                               case EDITRSW:
-                                       if (!(ed = *argp++) || *ed == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       nedit = 0;
-                                       continue;
-                               case NEDITSW:
-                                       nedit++;
-                                       continue;
-
-                               case WHATSW:
-                                       if (!(whatnowproc = *argp++) ||
-                                                       *whatnowproc == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       nwhat = 0;
-                                       continue;
+                       case AMBIGSW:
+                               ambigsw(cp, switches);
+                               done(1);
+                       case UNKWNSW:
+                               adios(NULL, "-%s unknown", cp);
+
+                       case HELPSW:
+                               snprintf(buf, sizeof(buf), "%s: [+folder] [msg] [switches]", invo_name);
+                               print_help(buf, switches, 1);
+                               done(0);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
+
+                       case GROUPSW:
+                               groupreply++;
+                               continue;
+                       case NGROUPSW:
+                               groupreply = 0;
+                               continue;
+
+                       case ANNOSW:
+                               anot++;
+                               continue;
+                       case NANNOSW:
+                               anot = 0;
+                               continue;
+
+                       case CCSW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               docc(cp, 1);
+                               continue;
+                       case NCCSW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               docc(cp, 0);
+                               continue;
+
+                       case EDITRSW:
+                               if (!(ed = *argp++) || *ed == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               nedit = 0;
+                               continue;
+                       case NEDITSW:
+                               nedit++;
+                               continue;
+
+                       case WHATSW:
+                               if (!(whatnowproc = *argp++) ||
+                                               *whatnowproc == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               nwhat = 0;
+                               continue;
 #ifdef MHE
-                               case BILDSW:
-                                       buildsw++;  /* fall... */
+                       case BILDSW:
+                               buildsw++;  /* fall... */
 #endif /* MHE */
-                               case NWHATSW:
-                                       nwhat++;
-                                       continue;
-
-                               case FCCSW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       dp = NULL;
-                                       if (*cp == '@')
-                                               cp = dp = getcpy(expandfol(cp));
-                                       if (fcc)
-                                               fcc = add(", ", fcc);
-                                       fcc = add(cp, fcc);
-                                       if (dp)
-                                               free(dp);
-                                       continue;
-
-                               case FILESW:
-                                       if (file)
-                                               adios(NULL, "only one file at a time!");
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       file = getcpy(expanddir(cp));
-                                       continue;
-                               case FILTSW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       filter = getcpy(etcpath(cp));
-                                       mime = 0;
-                                       continue;
-                               case FORMSW:
-                                       if (!(form = *argp++) || *form == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       continue;
-
-                               case FRMTSW:
-                                       filter = getcpy(etcpath(mhlreply));
-                                       mime = 0;
-                                       continue;
-                               case NFRMTSW:
-                                       filter = NULL;
-                                       continue;
-
-                               case INPLSW:
-                                       inplace++;
-                                       continue;
-                               case NINPLSW:
-                                       inplace = 0;
-                                       continue;
-
-                               case MIMESW:
-                                       mime++;
-                                       filter = NULL;
-                                       continue;
-                               case NMIMESW:
-                                       mime = 0;
-                                       continue;
-
-                               case QURYSW:
-                                       querysw++;
-                                       continue;
-                               case NQURYSW:
-                                       querysw = 0;
-                                       continue;
-
-                               case WIDTHSW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       if ((outputlinelen = atoi(cp)) < 10)
-                                               adios(NULL, "impossible width %d", outputlinelen);
-                                       continue;
+                       case NWHATSW:
+                               nwhat++;
+                               continue;
+
+                       case FCCSW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               dp = NULL;
+                               if (*cp == '@')
+                                       cp = dp = getcpy(expandfol(cp));
+                               if (fcc)
+                                       fcc = add(", ", fcc);
+                               fcc = add(cp, fcc);
+                               if (dp)
+                                       free(dp);
+                               continue;
+
+                       case FILESW:
+                               if (file)
+                                       adios(NULL, "only one file at a time!");
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               file = getcpy(expanddir(cp));
+                               continue;
+                       case FILTSW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               filter = getcpy(etcpath(cp));
+                               mime = 0;
+                               continue;
+                       case FORMSW:
+                               if (!(form = *argp++) || *form == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
+
+                       case FRMTSW:
+                               filter = getcpy(etcpath(mhlreply));
+                               mime = 0;
+                               continue;
+                       case NFRMTSW:
+                               filter = NULL;
+                               continue;
+
+                       case INPLSW:
+                               inplace++;
+                               continue;
+                       case NINPLSW:
+                               inplace = 0;
+                               continue;
+
+                       case MIMESW:
+                               mime++;
+                               filter = NULL;
+                               continue;
+                       case NMIMESW:
+                               mime = 0;
+                               continue;
+
+                       case QURYSW:
+                               querysw++;
+                               continue;
+                       case NQURYSW:
+                               querysw = 0;
+                               continue;
+
+                       case WIDTHSW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               if ((outputlinelen = atoi(cp)) < 10)
+                                       adios(NULL, "impossible width %d",
+                                                       outputlinelen);
+                               continue;
                        }
                }
                if (*cp == '+' || *cp == '@') {
@@ -363,27 +373,26 @@ void
 docc(char *cp, int ccflag)
 {
        switch (smatch(cp, ccswitches)) {
-               case AMBIGSW:
-                       ambigsw(cp, ccswitches);
-                       done(1);
-               case UNKWNSW:
-                       adios(NULL, "-%scc %s unknown", ccflag ? "" : "no",
-                                       cp);
-
-               case CTOSW:
-                       ccto = ccflag;
-                       break;
-
-               case CCCSW:
-                       cccc = ccflag;
-                       break;
-
-               case CMESW:
-                       ccme = ccflag;
-                       break;
-
-               case CALSW:
-                       ccto = cccc = ccme = ccflag;
-                       break;
+       case AMBIGSW:
+               ambigsw(cp, ccswitches);
+               done(1);
+       case UNKWNSW:
+               adios(NULL, "-%scc %s unknown", ccflag ? "" : "no", cp);
+
+       case CTOSW:
+               ccto = ccflag;
+               break;
+
+       case CCCSW:
+               cccc = ccflag;
+               break;
+
+       case CMESW:
+               ccme = ccflag;
+               break;
+
+       case CALSW:
+               ccto = cccc = ccme = ccflag;
+               break;
        }
 }
index 1bdab9e..b63d013 100644 (file)
@@ -147,60 +147,60 @@ replout(FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen,
        for (state = FLD;;) {
                state = m_getfld(state, name, tmpbuf, SBUFSIZ, inb);
                switch (state) {
-                       case FLD:
-                       case FLDPLUS:
-                               /*
-                               ** if we're interested in this component,
-                               ** save a pointer to the component text,
-                               ** then start using our next free buffer
-                               ** as the component temp buffer (buffer
-                               ** switching saves an extra copy of the
-                               ** component text).
-                               */
-                               if ((cptr = wantcomp[CHASH(name)]))
-                                       do {
-                                               if (!mh_strcasecmp(name, cptr->c_name)) {
-                                                       char_read += msg_count;
-                                                       if (! cptr->c_text) {
-                                                               i = strlen(cptr->c_text = tmpbuf) - 1;
-                                                               if (tmpbuf[i] == '\n')
-                                                                       tmpbuf[i] = '\0';
-                                                               *--savecomp = cptr;
-                                                               tmpbuf = *nxtbuf++;
-                                                       } else {
-                                                               i = strlen(cp = cptr->c_text) - 1;
-                                                               if (cp[i] == '\n') {
-                                                                       if (cptr->c_type & CT_ADDR) {
-                                                                               cp[i] = '\0';
-                                                                               cp = add(",\n\t", cp);
-                                                                       } else {
-                                                                               cp = add("\t", cp);
-                                                                       }
+               case FLD:
+               case FLDPLUS:
+                       /*
+                       ** if we're interested in this component, save
+                       ** a pointer to the component text, then start
+                       ** using our next free buffer as the component
+                       ** temp buffer (buffer switching saves an extra
+                       ** copy of the component text).
+                       */
+                       if ((cptr = wantcomp[CHASH(name)]))
+                               do {
+                                       if (!mh_strcasecmp(name, cptr->c_name)) {
+                                               char_read += msg_count;
+                                               if (! cptr->c_text) {
+                                                       i = strlen(cptr->c_text = tmpbuf) - 1;
+                                                       if (tmpbuf[i] == '\n')
+                                                               tmpbuf[i] = '\0';
+                                                       *--savecomp = cptr;
+                                                       tmpbuf = *nxtbuf++;
+                                               } else {
+                                                       i = strlen(cp = cptr->c_text) - 1;
+                                                       if (cp[i] == '\n') {
+                                                               if (cptr->c_type & CT_ADDR) {
+                                                                       cp[i] = '\0';
+                                                                       cp = add(",\n\t", cp);
+                                                               } else {
+                                                                       cp = add("\t", cp);
                                                                }
-                                                               cptr->c_text = add(tmpbuf, cp);
-                                                       }
-                                                       while (state == FLDPLUS) {
-                                                               state = m_getfld(state, name, tmpbuf,
-                                                                                                 SBUFSIZ, inb);
-                                                               cptr->c_text = add(tmpbuf, cptr->c_text);
-                                                               char_read += msg_count;
                                                        }
-                                                       break;
+                                                       cptr->c_text = add(tmpbuf, cp);
                                                }
-                                       } while ((cptr = cptr->c_next));
+                                               while (state == FLDPLUS) {
+                                                       state = m_getfld(state, name, tmpbuf,
+                                                                                         SBUFSIZ, inb);
+                                                       cptr->c_text = add(tmpbuf, cptr->c_text);
+                                                       char_read += msg_count;
+                                               }
+                                               break;
+                                       }
+                               } while ((cptr = cptr->c_next));
 
-                               while (state == FLDPLUS)
-                                       state = m_getfld(state, name, tmpbuf, SBUFSIZ, inb);
-                               break;
+                       while (state == FLDPLUS)
+                               state = m_getfld(state, name, tmpbuf,
+                                               SBUFSIZ, inb);
+                       break;
 
-                       case LENERR:
-                       case FMTERR:
-                       case BODY:
-                       case FILEEOF:
-                               goto finished;
+               case LENERR:
+               case FMTERR:
+               case BODY:
+               case FILEEOF:
+                       goto finished;
 
-                       default:
-                               adios(NULL, "m_getfld() returned %d", state);
+               default:
+                       adios(NULL, "m_getfld() returned %d", state);
                }
        }
 
@@ -442,28 +442,27 @@ replfilter(FILE *in, FILE *out, char *filter)
        lseek(fileno(in), (off_t) 0, SEEK_SET);
 
        switch (pid = vfork()) {
-               case NOTOK:
-                       adios("fork", "unable to");
-
-               case OK:
-                       dup2(fileno(in), fileno(stdin));
-                       dup2(fileno(out), fileno(stdout));
-                       closefds(3);
-
-                       execlp(mhlproc, mhl, "-form", filter, "-noclear",
-                                       NULL);
-                       errstr = strerror(errno);
-                       write(2, "unable to exec ", 15);
-                       write(2, mhlproc, strlen(mhlproc));
-                       write(2, ": ", 2);
-                       write(2, errstr, strlen(errstr));
-                       write(2, "\n", 1);
-                       _exit(-1);
-
-               default:
-                       if (pidXwait(pid, mhl))
-                               done(1);
-                       fseek(out, 0L, SEEK_END);
-                       break;
+       case NOTOK:
+               adios("fork", "unable to");
+
+       case OK:
+               dup2(fileno(in), fileno(stdin));
+               dup2(fileno(out), fileno(stdout));
+               closefds(3);
+
+               execlp(mhlproc, mhl, "-form", filter, "-noclear", NULL);
+               errstr = strerror(errno);
+               write(2, "unable to exec ", 15);
+               write(2, mhlproc, strlen(mhlproc));
+               write(2, ": ", 2);
+               write(2, errstr, strlen(errstr));
+               write(2, "\n", 1);
+               _exit(-1);
+
+       default:
+               if (pidXwait(pid, mhl))
+                       done(1);
+               fseek(out, 0L, SEEK_END);
+               break;
        }
 }
index 36c1eed..f214f59 100644 (file)
--- a/uip/rmf.c
+++ b/uip/rmf.c
@@ -48,26 +48,26 @@ main(int argc, char **argv)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, switches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, switches);
-                                       done(1);
-                               case UNKWNSW:
-                                       adios(NULL, "-%s unknown", cp);
-
-                               case HELPSW:
-                                       snprintf(buf, sizeof(buf), "%s [+folder] [switches]", invo_name);
-                                       print_help(buf, switches, 1);
-                                       done(1);
-                               case VERSIONSW:
-                                       print_version(invo_name);
-                                       done(1);
-
-                               case INTRSW:
-                                       interactive = 1;
-                                       continue;
-                               case NINTRSW:
-                                       interactive = 0;
-                                       continue;
+                       case AMBIGSW:
+                               ambigsw(cp, switches);
+                               done(1);
+                       case UNKWNSW:
+                               adios(NULL, "-%s unknown", cp);
+
+                       case HELPSW:
+                               snprintf(buf, sizeof(buf), "%s [+folder] [switches]", invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
+
+                       case INTRSW:
+                               interactive = 1;
+                               continue;
+                       case NINTRSW:
+                               interactive = 0;
+                               continue;
                        }
                }
                if (*cp == '+' || *cp == '@') {
@@ -134,20 +134,21 @@ rmf(char *folder)
        register DIR *dd;
 
        switch (i = chdir(maildir = toabsdir(folder))) {
-               case OK:
-                       if (access(".", W_OK) != NOTOK &&
-                                       access("..", W_OK) != NOTOK)
-                               break;  /* fall otherwise */
-
-               case NOTOK:
-                       snprintf(cur, sizeof(cur), "atr-%s-%s",
-                                               current, toabsdir(folder));
-                       if (!context_del(cur)) {
-                               printf("[+%s de-referenced]\n", folder);
-                               return OK;
-                       }
-                       advise(NULL, "you have no profile entry for the %s folder +%s", i == NOTOK ? "unreadable" : "read-only", folder);
-                       return NOTOK;
+       case OK:
+               if (access(".", W_OK) != NOTOK && access("..", W_OK) != NOTOK)
+                       break;  /* fall otherwise */
+
+       case NOTOK:
+               snprintf(cur, sizeof(cur), "atr-%s-%s",
+                                       current, toabsdir(folder));
+               if (!context_del(cur)) {
+                       printf("[+%s de-referenced]\n", folder);
+                       return OK;
+               }
+               advise(NULL, "you have no profile entry for the %s folder +%s",
+                               i == NOTOK ? "unreadable" : "read-only",
+                               folder);
+               return NOTOK;
        }
 
        if ((dd = opendir(".")) == NULL)
@@ -163,33 +164,33 @@ rmf(char *folder)
        j = strlen(backup_prefix);
        while ((dp = readdir(dd))) {
                switch (dp->d_name[0]) {
-                       case '.':
-                               if (strcmp(dp->d_name, ".") == 0 ||
-                                               strcmp(dp->d_name, "..") == 0)
-                                       continue;  /* else fall */
+               case '.':
+                       if (strcmp(dp->d_name, ".") == 0 ||
+                                       strcmp(dp->d_name, "..") == 0)
+                               continue;  /* else fall */
 
-                       case ',':
+               case ',':
 #ifdef MHE
-                       case '+':
+               case '+':
 #endif /* MHE */
 #ifdef UCI
-                       case '_':
-                       case '#':
+               case '_':
+               case '#':
 #endif /* UCI */
+                       break;
+
+               default:
+                       if (m_atoi(dp->d_name))
+                               break;
+                       if (strcmp(dp->d_name, altmsglink) == 0 ||
+                                       strncmp(dp->d_name,
+                                       backup_prefix, j) == 0)
                                break;
 
-                       default:
-                               if (m_atoi(dp->d_name))
-                                       break;
-                               if (strcmp(dp->d_name, altmsglink) == 0 ||
-                                               strncmp(dp->d_name,
-                                               backup_prefix, j) == 0)
-                                       break;
-
-                               admonish(NULL, "file \"%s/%s\" not deleted",
-                                               folder, dp->d_name);
-                               others++;
-                               continue;
+                       admonish(NULL, "file \"%s/%s\" not deleted",
+                                       folder, dp->d_name);
+                       others++;
+                       continue;
                }
                if (unlink(dp->d_name) == NOTOK) {
                        admonish(dp->d_name, "unable to unlink %s:", folder);
index 5cac626..69c2da9 100644 (file)
@@ -88,64 +88,67 @@ main(int argc, char **argv)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, switches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, switches);
-                                       done(1);
-                               case UNKWNSW:
-                                       adios(NULL, "-%s unknown", cp);
-
-                               case HELPSW:
-                                       snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
-                                       print_help(buf, switches, 1);
-                                       done(1);
-                               case VERSIONSW:
-                                       print_version(invo_name);
-                                       done(1);
-
-                               case CLRSW:
-                                       clearflag++;
-                                       continue;
-                               case NCLRSW:
-                                       clearflag = 0;
-                                       continue;
-
-                               case FORMSW:
-                                       if (!(form = *argp++) || *form == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       format = NULL;
-                                       continue;
-                               case FMTSW:
-                                       if (!(format = *argp++) ||
-                                                       *format == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       form = NULL;
-                                       continue;
-
-                               case HEADSW:
-                                       hdrflag++;
-                                       continue;
-                               case NHEADSW:
-                                       hdrflag = 0;
-                                       continue;
-
-                               case WIDTHSW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       width = atoi(cp);
-                                       continue;
-                               case REVSW:
-                                       revflag++;
-                                       continue;
-                               case NREVSW:
-                                       revflag = 0;
-                                       continue;
-
-                               case FILESW:
-                                       if (!(cp = *argp++) || (cp[0] == '-' && cp[1]))
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       if (strcmp(file = cp, "-")!=0)
-                                               file = getcpy(expanddir(cp));
-                                       continue;
+                       case AMBIGSW:
+                               ambigsw(cp, switches);
+                               done(1);
+                       case UNKWNSW:
+                               adios(NULL, "-%s unknown", cp);
+
+                       case HELPSW:
+                               snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
+
+                       case CLRSW:
+                               clearflag++;
+                               continue;
+                       case NCLRSW:
+                               clearflag = 0;
+                               continue;
+
+                       case FORMSW:
+                               if (!(form = *argp++) || *form == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               format = NULL;
+                               continue;
+                       case FMTSW:
+                               if (!(format = *argp++) || *format == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               form = NULL;
+                               continue;
+
+                       case HEADSW:
+                               hdrflag++;
+                               continue;
+                       case NHEADSW:
+                               hdrflag = 0;
+                               continue;
+
+                       case WIDTHSW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               width = atoi(cp);
+                               continue;
+                       case REVSW:
+                               revflag++;
+                               continue;
+                       case NREVSW:
+                               revflag = 0;
+                               continue;
+
+                       case FILESW:
+                               if (!(cp = *argp++) || (cp[0] == '-' && cp[1]))
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               if (strcmp(file = cp, "-")!=0)
+                                       file = getcpy(expanddir(cp));
+                               continue;
                        }
                }
                if (*cp == '+' || *cp == '@') {
@@ -289,23 +292,21 @@ main(int argc, char **argv)
                        switch (state = scan(in, msgnum, 0, nfs, width,
                                                msgnum == mp->curmsg, unseen,
                                                folder, 0L, 1)) {
-                               case SCNMSG:
-                               case SCNENC:
-                               case SCNERR:
-                                       break;
+                       case SCNMSG:
+                       case SCNENC:
+                       case SCNERR:
+                               break;
 
-                               default:
-                                       adios(NULL, "scan() botch(%d)", state);
+                       default:
+                               adios(NULL, "scan() botch(%d)", state);
 
-                               case SCNEOF:
+                       case SCNEOF:
 #if 0
-                                       printf("%*d  empty\n", DMAXFOLDER,
-                                                       msgnum);
+                               printf("%*d  empty\n", DMAXFOLDER, msgnum);
 #else
-                                       advise(NULL, "message %d: empty",
-                                                       msgnum);
+                               advise(NULL, "message %d: empty", msgnum);
 #endif
-                                       break;
+                               break;
                        }
                        hdrflag = 0;
                        fclose(in);
index 8a07418..6eca931 100644 (file)
@@ -192,119 +192,114 @@ scan(FILE *inb, int innum, int outnum, char *nfs, int width, int curflg,
        for (compnum = 1; ;
                        state = m_getfld(state, name, tmpbuf, rlwidth, inb)) {
                switch (state) {
-                       case FLD:
-                       case FLDPLUS:
-                               compnum++;
-                               if (outnum) {
-                                       FPUTS(name);
-                                       if (putc(':', scnout) == EOF)
-                                               DIEWRERR();
-                                       FPUTS(tmpbuf);
-                               }
-                               /*
-                               ** if we're interested in this component,
-                               ** save a pointer to the component text,
-                               ** then start using our next free buffer
-                               ** as the component temp buffer (buffer
-                               ** switching saves an extra copy of the
-                               ** component text).
-                               */
-                               if ((cptr = wantcomp[CHASH(name)])) {
-                                       do {
-                                               if (!mh_strcasecmp(name, cptr->c_name)) {
-                                                       if (! cptr->c_text) {
-                                                               cptr->c_text = tmpbuf;
-                                                               for (cp = tmpbuf + strlen(tmpbuf) - 1;
-                                                                               cp >= tmpbuf; cp--)
-                                                                       if (isspace(*cp))
-                                                                               *cp = 0;
-                                                                       else
-                                                                               break;
-                                                               *--savecomp = cptr;
-                                                               tmpbuf = *nxtbuf++;
-                                                       }
-                                                       break;
+               case FLD:
+               case FLDPLUS:
+                       compnum++;
+                       if (outnum) {
+                               FPUTS(name);
+                               if (putc(':', scnout) == EOF)
+                                       DIEWRERR();
+                               FPUTS(tmpbuf);
+                       }
+                       /*
+                       ** if we're interested in this component, save
+                       ** a pointer to the component text, then start
+                       ** using our next free buffer as the component
+                       ** temp buffer (buffer switching saves an extra
+                       ** copy of the component text).
+                       */
+                       if ((cptr = wantcomp[CHASH(name)])) {
+                               do {
+                                       if (!mh_strcasecmp(name, cptr->c_name)) {
+                                               if (! cptr->c_text) {
+                                                       cptr->c_text = tmpbuf;
+                                                       for (cp = tmpbuf + strlen(tmpbuf) - 1; cp >= tmpbuf; cp--)
+                                                               if (isspace(*cp))
+                                                                       *cp = 0;
+                                                               else
+                                                                       break;
+                                                       *--savecomp = cptr;
+                                                       tmpbuf = *nxtbuf++;
                                                }
-                                       } while ((cptr = cptr->c_next));
-                               }
+                                               break;
+                                       }
+                               } while ((cptr = cptr->c_next));
+                       }
 
-                               while (state == FLDPLUS) {
-                                       state = m_getfld(state, name, tmpbuf,
-                                                       rlwidth, inb);
-                                       if (outnum)
-                                               FPUTS(tmpbuf);
-                               }
-                               break;
+                       while (state == FLDPLUS) {
+                               state = m_getfld(state, name, tmpbuf, rlwidth,
+                                               inb);
+                               if (outnum)
+                                       FPUTS(tmpbuf);
+                       }
+                       break;
 
-                       case BODY:
-                               compnum = -1;
-                               if (! outnum) {
-                                       state = FILEEOF; /* stop now if scan cmd */
-                                       goto finished;
-                               }
-                               if (putc('\n', scnout) == EOF) DIEWRERR();
-                               FPUTS(tmpbuf);
-                               /*
-                               ** performance hack: some people like to
-                               ** run "inc" on things like net.sources or
-                               ** large digests.  We do a copy directly
-                               ** into the output buffer rather than
-                               ** going through an intermediate buffer.
-                               **
-                               ** We need the amount of data m_getfld
-                               ** found & don't want to do a strlen on
-                               ** the long buffer so there's a hack in
-                               ** m_getfld to save the amount of data it
-                               ** returned in the global "msg_count".
-                               */
+               case BODY:
+                       compnum = -1;
+                       if (! outnum) {
+                               state = FILEEOF; /* stop now if scan cmd */
+                               goto finished;
+                       }
+                       if (putc('\n', scnout) == EOF) DIEWRERR();
+                       FPUTS(tmpbuf);
+                       /*
+                       ** performance hack: some people like to run "inc"
+                       ** on things like net.sources or large digests.
+                       ** We do a copy directly into the output buffer
+                       ** rather than going through an intermediate buffer.
+                       **
+                       ** We need the amount of data m_getfld found &
+                       ** don't want to do a strlen on the long buffer so
+                       ** there's a hack in m_getfld to save the amount
+                       ** of data it returned in the global "msg_count".
+                       */
 body:;
-                               while (state == BODY) {
+                       while (state == BODY) {
 #ifdef LINUX_STDIO
-                                       if (scnout->_IO_write_ptr == scnout->_IO_write_end) {
+                               if (scnout->_IO_write_ptr == scnout->_IO_write_end) {
 #elif defined(__DragonFly__)
-                                       if (((struct __FILE_public *)scnout)->_w <= 0) {
+                               if (((struct __FILE_public *)scnout)->_w <= 0) {
 #else
-                                       if (scnout->_cnt <= 0) {
+                               if (scnout->_cnt <= 0) {
 #endif
-                                               if (fflush(scnout) == EOF)
-                                                       DIEWRERR();
-                                       }
+                                       if (fflush(scnout) == EOF)
+                                               DIEWRERR();
+                               }
 #ifdef LINUX_STDIO
-                                       state = m_getfld(state, name, scnout->_IO_write_ptr,
-                                               (long)scnout->_IO_write_ptr-(long)scnout->_IO_write_end , inb);
-                                       scnout->_IO_write_ptr += msg_count;
+                               state = m_getfld(state, name, scnout->_IO_write_ptr, (long)scnout->_IO_write_ptr-(long)scnout->_IO_write_end , inb);
+                               scnout->_IO_write_ptr += msg_count;
 #elif defined(__DragonFly__)
-                                       state = m_getfld(state, name, ((struct __FILE_public *)scnout)->_p, -(((struct __FILE_public *)scnout)->_w), inb );
-                                       ((struct __FILE_public *)scnout)->_w -= msg_count;
-                                       ((struct __FILE_public *)scnout)->_p += msg_count;
+                               state = m_getfld(state, name, ((struct __FILE_public *)scnout)->_p, -(((struct __FILE_public *)scnout)->_w), inb);
+                               ((struct __FILE_public *)scnout)->_w -= msg_count;
+                               ((struct __FILE_public *)scnout)->_p += msg_count;
 #else
-                                       state = m_getfld( state, name, scnout->_ptr, -(scnout->_cnt), inb );
-                                       scnout->_cnt -= msg_count;
-                                       scnout->_ptr += msg_count;
+                               state = m_getfld( state, name, scnout->_ptr, -(scnout->_cnt), inb);
+                               scnout->_cnt -= msg_count;
+                               scnout->_ptr += msg_count;
 #endif
-                               }
-                               goto finished;
-
-                       case LENERR:
-                       case FMTERR:
-                               fprintf(stderr, innum ? "??Format error (message %d) in " : "??Format error in ", outnum ? outnum : innum);
-                               fprintf(stderr, "component %d\n", compnum);
-
-                               if (outnum) {
-                                       FPUTS("\n\nBAD MSG:\n");
-                                       FPUTS(name);
-                                       if (putc('\n', scnout) == EOF)
-                                               DIEWRERR();
-                                       state = BODY;
-                                       goto body;
-                               }
-                               /* fall through */
+                       }
+                       goto finished;
+
+               case LENERR:
+               case FMTERR:
+                       fprintf(stderr, innum ? "??Format error (message %d) in " : "??Format error in ", outnum ? outnum : innum);
+                       fprintf(stderr, "component %d\n", compnum);
+
+                       if (outnum) {
+                               FPUTS("\n\nBAD MSG:\n");
+                               FPUTS(name);
+                               if (putc('\n', scnout) == EOF)
+                                       DIEWRERR();
+                               state = BODY;
+                               goto body;
+                       }
+                       /* fall through */
 
-                       case FILEEOF:
-                               goto finished;
+               case FILEEOF:
+                       goto finished;
 
-                       default:
-                               adios(NULL, "getfld() returned %d", state);
+               default:
+                       adios(NULL, "getfld() returned %d", state);
                }
        }
 
index 051e357..2847add 100644 (file)
@@ -132,112 +132,112 @@ main(int argc, char **argv)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, switches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, switches);
-                                       done(1);
-                               case UNKWNSW:
-                                       adios(NULL, "-%s unknown\n", cp);
-
-                               case HELPSW:
-                                       snprintf(buf, sizeof(buf),
-                                                       "%s [file] [switches]",
-                                                       invo_name);
-                                       print_help(buf, switches, 1);
-                                       done(1);
-                               case VERSIONSW:
-                                       print_version(invo_name);
-                                       done(1);
-
-                               case PUSHSW:
-                                       pushsw++;
-                                       continue;
-                               case NPUSHSW:
-                                       pushsw = 0;
-                                       continue;
-
-                               case UNIQSW:
-                                       unique++;
-                                       continue;
-                               case NUNIQSW:
-                                       unique = 0;
-                                       continue;
-
-                               case FORWSW:
-                                       forwsw++;
-                                       continue;
-                               case NFORWSW:
-                                       forwsw = 0;
-                                       continue;
-
-                               case VERBSW:
-                                       verbsw++;
-                                       vec[vecp++] = --cp;
-                                       continue;
-                               case NVERBSW:
-                                       verbsw = 0;
-                                       vec[vecp++] = --cp;
-                                       continue;
-
-                               case MIMESW:
-                                       mime++;
-                                       vec[vecp++] = --cp;
-                                       continue;
-                               case NMIMESW:
-                                       mime = 0;
-                                       vec[vecp++] = --cp;
-                                       continue;
-
-                               case DEBUGSW:
-                                       debugsw++;  /* fall */
-                               case NFILTSW:
-                               case FRMTSW:
-                               case NFRMTSW:
-                               case BITSTUFFSW:
-                               case NBITSTUFFSW:
-                               case MSGDSW:
-                               case NMSGDSW:
-                               case WATCSW:
-                               case NWATCSW:
-                               case MAILSW:
-                               case SAMLSW:
-                               case SENDSW:
-                               case SOMLSW:
-                               case SNOOPSW:
-                                       vec[vecp++] = --cp;
-                                       continue;
-
-                               case ALIASW:
-                               case FILTSW:
-                               case WIDTHSW:
-                               case CLIESW:
-                               case SERVSW:
-                               case PORTSW:
-                                       vec[vecp++] = --cp;
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       vec[vecp++] = cp;
-                                       continue;
-
-                               case ATTACHSW:
-                                       if (!(attach = *argp++) ||
-                                                       *attach == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       continue;
-
-                               case ATTACHFORMATSW:
-                                       if (! *argp || **argp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-1]);
-                                       else {
-                                               attachformat = atoi(*argp);
-                                               if (attachformat < 0 ||
-                                                       attachformat > ATTACHFORMATS - 1) {
-                                                       advise(NULL, "unsupported attachformat %d",
-                                                                       attachformat);
-                                                       continue;
-                                               }
+                       case AMBIGSW:
+                               ambigsw(cp, switches);
+                               done(1);
+                       case UNKWNSW:
+                               adios(NULL, "-%s unknown\n", cp);
+
+                       case HELPSW:
+                               snprintf(buf, sizeof(buf),
+                                               "%s [file] [switches]",
+                                               invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
+
+                       case PUSHSW:
+                               pushsw++;
+                               continue;
+                       case NPUSHSW:
+                               pushsw = 0;
+                               continue;
+
+                       case UNIQSW:
+                               unique++;
+                               continue;
+                       case NUNIQSW:
+                               unique = 0;
+                               continue;
+
+                       case FORWSW:
+                               forwsw++;
+                               continue;
+                       case NFORWSW:
+                               forwsw = 0;
+                               continue;
+
+                       case VERBSW:
+                               verbsw++;
+                               vec[vecp++] = --cp;
+                               continue;
+                       case NVERBSW:
+                               verbsw = 0;
+                               vec[vecp++] = --cp;
+                               continue;
+
+                       case MIMESW:
+                               mime++;
+                               vec[vecp++] = --cp;
+                               continue;
+                       case NMIMESW:
+                               mime = 0;
+                               vec[vecp++] = --cp;
+                               continue;
+
+                       case DEBUGSW:
+                               debugsw++;  /* fall */
+                       case NFILTSW:
+                       case FRMTSW:
+                       case NFRMTSW:
+                       case BITSTUFFSW:
+                       case NBITSTUFFSW:
+                       case MSGDSW:
+                       case NMSGDSW:
+                       case WATCSW:
+                       case NWATCSW:
+                       case MAILSW:
+                       case SAMLSW:
+                       case SENDSW:
+                       case SOMLSW:
+                       case SNOOPSW:
+                               vec[vecp++] = --cp;
+                               continue;
+
+                       case ALIASW:
+                       case FILTSW:
+                       case WIDTHSW:
+                       case CLIESW:
+                       case SERVSW:
+                       case PORTSW:
+                               vec[vecp++] = --cp;
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               vec[vecp++] = cp;
+                               continue;
+
+                       case ATTACHSW:
+                               if (!(attach = *argp++) || *attach == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
+
+                       case ATTACHFORMATSW:
+                               if (! *argp || **argp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-1]);
+                               else {
+                                       attachformat = atoi(*argp);
+                                       if (attachformat < 0 || attachformat > ATTACHFORMATS - 1) {
+                                               advise(NULL, "unsupported attachformat %d", attachformat);
+                                               continue;
                                        }
-                                       ++argp;
-                                       continue;
+                               }
+                               ++argp;
+                               continue;
                        }
                } else {
                        msgs[msgp++] = cp;
@@ -364,12 +364,12 @@ main(int argc, char **argv)
        for (msgnum = 0; msgnum < msgp; msgnum++) {
                switch (sendsbr(vec, vecp, msgs[msgnum], &st, 1, attach,
                                attachformat)) {
-                       case DONE:
-                               done(++status);
-                       case NOTOK:
-                               status++;  /* fall */
-                       case OK:
-                               break;
+               case DONE:
+                       done(++status);
+               case NOTOK:
+                       status++;  /* fall */
+               case OK:
+                       break;
                }
        }
 
index 1534402..42c2c21 100644 (file)
@@ -675,48 +675,48 @@ alert(char *file, int out)
                sleep(5);
 
        switch (child_id) {
-               case NOTOK:
-                       /* oops -- fork error */
-                       advise("fork", "unable to");
+       case NOTOK:
+               /* oops -- fork error */
+               advise("fork", "unable to");
 
-               case OK:
-                       /* child process -- send it */
-                       SIGNAL(SIGHUP, SIG_IGN);
-                       SIGNAL(SIGINT, SIG_IGN);
-                       SIGNAL(SIGQUIT, SIG_IGN);
-                       SIGNAL(SIGTERM, SIG_IGN);
-                       if (forwsw) {
-                               if ((in = open(file, O_RDONLY)) == NOTOK) {
-                                       admonish(file, "unable to re-open");
-                               } else {
-                                       lseek(out, (off_t) 0, SEEK_END);
-                                       strncpy(buf, "\nMessage not delivered to anyone.\n", sizeof(buf));
-                                       write(out, buf, strlen(buf));
-                                       strncpy(buf, "\n------- Unsent Draft\n\n", sizeof(buf));
-                                       write(out, buf, strlen(buf));
-                                       cpydgst(in, out, file, "temporary file");
-                                       close(in);
-                                       strncpy(buf, "\n------- End of Unsent Draft\n", sizeof(buf));
-                                       write(out, buf, strlen(buf));
-                                       if (rename(file, strncpy(buf, m_backup(file), sizeof(buf))) == NOTOK)
-                                               admonish(buf, "unable to rename %s to", file);
-                               }
+       case OK:
+               /* child process -- send it */
+               SIGNAL(SIGHUP, SIG_IGN);
+               SIGNAL(SIGINT, SIG_IGN);
+               SIGNAL(SIGQUIT, SIG_IGN);
+               SIGNAL(SIGTERM, SIG_IGN);
+               if (forwsw) {
+                       if ((in = open(file, O_RDONLY)) == NOTOK) {
+                               admonish(file, "unable to re-open");
+                       } else {
+                               lseek(out, (off_t) 0, SEEK_END);
+                               strncpy(buf, "\nMessage not delivered to anyone.\n", sizeof(buf));
+                               write(out, buf, strlen(buf));
+                               strncpy(buf, "\n------- Unsent Draft\n\n", sizeof(buf));
+                               write(out, buf, strlen(buf));
+                               cpydgst(in, out, file, "temporary file");
+                               close(in);
+                               strncpy(buf, "\n------- End of Unsent Draft\n", sizeof(buf));
+                               write(out, buf, strlen(buf));
+                               if (rename(file, strncpy(buf, m_backup(file), sizeof(buf))) == NOTOK)
+                                       admonish(buf, "unable to rename %s to", file);
                        }
-                       lseek(out, (off_t) 0, SEEK_SET);
-                       dup2(out, fileno(stdin));
-                       close(out);
-                       /* create subject for error notification */
-                       snprintf(buf, sizeof(buf), "send failed on %s",
-                                       forwsw ? "enclosed draft" : file);
-
-                       execlp(mailproc, mhbasename(mailproc),
-                                       getusername(), "-subject", buf, NULL);
-                       fprintf(stderr, "unable to exec ");
-                       perror(mailproc);
-                       _exit(-1);
-
-               default:  /* no waiting... */
-                       break;
+               }
+               lseek(out, (off_t) 0, SEEK_SET);
+               dup2(out, fileno(stdin));
+               close(out);
+               /* create subject for error notification */
+               snprintf(buf, sizeof(buf), "send failed on %s",
+                               forwsw ? "enclosed draft" : file);
+
+               execlp(mailproc, mhbasename(mailproc), getusername(),
+                               "-subject", buf, NULL);
+               fprintf(stderr, "unable to exec ");
+               perror(mailproc);
+               _exit(-1);
+
+       default:  /* no waiting... */
+               break;
        }
 }
 
@@ -760,34 +760,34 @@ anno(int fd, struct stat *st)
 
        child_id = debugsw ? NOTOK : fork();
        switch (child_id) {
-               case NOTOK:  /* oops */
-                       if (!debugsw)
-                               advise(NULL, "unable to fork, so doing annotations by hand...");
-                       if (cwd == NULL)
-                               cwd = getcpy(pwd());
+       case NOTOK:  /* oops */
+               if (!debugsw)
+                       advise(NULL, "unable to fork, so doing annotations by hand...");
+               if (cwd == NULL)
+                       cwd = getcpy(pwd());
 
-               case OK:
-                       /* block a few signals */
-                       sigemptyset(&set);
-                       sigaddset(&set, SIGHUP);
-                       sigaddset(&set, SIGINT);
-                       sigaddset(&set, SIGQUIT);
-                       sigaddset(&set, SIGTERM);
-                       SIGPROCMASK(SIG_BLOCK, &set, &oset);
-
-                       annoaux(fd);
-                       if (child_id == OK)
-                               _exit(0);
-
-                       /* reset the signal mask */
-                       SIGPROCMASK(SIG_SETMASK, &oset, &set);
-
-                       chdir(cwd);
-                       break;
+       case OK:
+               /* block a few signals */
+               sigemptyset(&set);
+               sigaddset(&set, SIGHUP);
+               sigaddset(&set, SIGINT);
+               sigaddset(&set, SIGQUIT);
+               sigaddset(&set, SIGTERM);
+               SIGPROCMASK(SIG_BLOCK, &set, &oset);
+
+               annoaux(fd);
+               if (child_id == OK)
+                       _exit(0);
+
+               /* reset the signal mask */
+               SIGPROCMASK(SIG_SETMASK, &oset, &set);
+
+               chdir(cwd);
+               break;
 
-               default:  /* no waiting... */
-                       close(fd);
-                       break;
+       default:  /* no waiting... */
+               close(fd);
+               break;
        }
 }
 
index 757b001..80d7e6b 100644 (file)
@@ -87,77 +87,82 @@ main(int argc, char **argv)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, switches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, switches);
-                                       done(1);
-                               case UNKWNSW:
-                               case NPROGSW:
-                                       vec[vecp++] = --cp;
-                                       continue;
-
-                               case HELPSW:
-                                       snprintf(buf, sizeof(buf), "%s [+folder] %s[switches] [switches for showproc]", invo_name, mode == SHOW ? "[msgs] ": "");
-                                       print_help(buf, switches, 1);
-                                       done(1);
-                               case VERSIONSW:
-                                       print_version(invo_name);
-                                       done(1);
-
-                               case FILESW:
-                                       if (mode != SHOW)
+                       case AMBIGSW:
+                               ambigsw(cp, switches);
+                               done(1);
+                       case UNKWNSW:
+                       case NPROGSW:
+                               vec[vecp++] = --cp;
+                               continue;
+
+                       case HELPSW:
+                               snprintf(buf, sizeof(buf), "%s [+folder] %s[switches] [switches for showproc]", invo_name, mode == SHOW ? "[msgs] ": "");
+                               print_help(buf, switches, 1);
+                               done(1);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
+
+                       case FILESW:
+                               if (mode != SHOW)
 usage:
-                                               adios(NULL, "usage: %s [+folder] [switches] [switches for showproc]", invo_name);
-
-                                       if (file)
-                                               adios(NULL, "only one file at a time!");
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       file = getcpy(expanddir(cp));
-                                       continue;
-
-                               case HEADSW:
-                                       headersw++;
-                                       continue;
-                               case NHEADSW:
-                                       headersw = 0;
-                                       continue;
-
-                               case FORMSW:
-                                       vec[vecp++] = --cp;
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       vec[vecp++] = getcpy(etcpath(cp));
-                                       continue;
-
-                               case PROGSW:
-                               case LENSW:
-                               case WIDTHSW:
-                                       vec[vecp++] = --cp;
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       vec[vecp++] = cp;
-                                       continue;
-
-                               case SHOWSW:
-                                       if (!(showproc = *argp++) || *showproc == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       nshow = 0;
-                                       continue;
-                               case NSHOWSW:
-                                       nshow++;
-                                       continue;
-
-                               case SHOWMIMESW:
-                                       if (!(showmimeproc = *argp++) || *showmimeproc == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       nshow = 0;
-                                       continue;
-                               case CHECKMIMESW:
-                                       checkmime++;
-                                       continue;
-                               case NOCHECKMIMESW:
-                                       checkmime = 0;
-                                       continue;
+                                       adios(NULL, "usage: %s [+folder] [switches] [switches for showproc]", invo_name);
+
+                               if (file)
+                                       adios(NULL, "only one file at a time!");
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s", argp[-2]);
+                               file = getcpy(expanddir(cp));
+                               continue;
+
+                       case HEADSW:
+                               headersw++;
+                               continue;
+                       case NHEADSW:
+                               headersw = 0;
+                               continue;
+
+                       case FORMSW:
+                               vec[vecp++] = --cp;
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               vec[vecp++] = getcpy(etcpath(cp));
+                               continue;
+
+                       case PROGSW:
+                       case LENSW:
+                       case WIDTHSW:
+                               vec[vecp++] = --cp;
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               vec[vecp++] = cp;
+                               continue;
+
+                       case SHOWSW:
+                               if (!(showproc = *argp++) || *showproc == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               nshow = 0;
+                               continue;
+                       case NSHOWSW:
+                               nshow++;
+                               continue;
+
+                       case SHOWMIMESW:
+                               if (!(showmimeproc = *argp++) ||
+                                               *showmimeproc == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               nshow = 0;
+                               continue;
+                       case CHECKMIMESW:
+                               checkmime++;
+                               continue;
+                       case NOCHECKMIMESW:
+                               checkmime = 0;
+                               continue;
                        }
                }
                if (*cp == '+' || *cp == '@') {
@@ -190,15 +195,15 @@ usage:
 
        if (!msgp) {
                switch (mode) {
-                       case NEXT:
-                               msgs[msgp++] = "next";
-                               break;
-                       case PREV:
-                               msgs[msgp++] = "prev";
-                               break;
-                       default:
-                               msgs[msgp++] = "cur";
-                               break;
+               case NEXT:
+                       msgs[msgp++] = "next";
+                       break;
+               case PREV:
+                       msgs[msgp++] = "prev";
+                       break;
+               default:
+                       msgs[msgp++] = "cur";
+                       break;
                }
        }
 
index ac9225b..2ac93d1 100644 (file)
@@ -228,92 +228,98 @@ main(int argc, char **argv)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, switches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, switches);
-                                       done(1);
-                               case UNKWNSW:
-                                       adios(NULL, "-%s unknown", cp);
-
-                               case HELPSW:
-                                       snprintf(buf, sizeof(buf), "%s [switches] [address info sender]", invo_name);
-                                       print_help(buf, switches, 0);
-                                       done(1);
-                               case VERSIONSW:
-                                       print_version(invo_name);
-                                       done(1);
-
-                               case ADDRSW:
-                                       if (!(addr = *argp++))
-                                               /* allow -xyz arguments */
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       continue;
-                               case INFOSW:
-                                       if (!(info = *argp++))
-                                               /* allow -xyz arguments */
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       continue;
-                               case USERSW:
-                                       if (!(user = *argp++))
-                                               /* allow -xyz arguments */
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       continue;
-                               case FILESW:
-                                       if (!(file = *argp++) || *file == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       continue;
-                               case SENDERSW:
-                                       if (!(sender = *argp++))
-                                               /* allow -xyz arguments */
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       continue;
-                               case MAILBOXSW:
-                                       if (!(mbox = *argp++) || *mbox == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       continue;
-                               case HOMESW:
-                                       if (!(home = *argp++) || *home == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       continue;
+                       case AMBIGSW:
+                               ambigsw(cp, switches);
+                               done(1);
+                       case UNKWNSW:
+                               adios(NULL, "-%s unknown", cp);
+
+                       case HELPSW:
+                               snprintf(buf, sizeof(buf), "%s [switches] [address info sender]", invo_name);
+                               print_help(buf, switches, 0);
+                               done(1);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
+
+                       case ADDRSW:
+                               if (!(addr = *argp++))
+                                       /* allow -xyz arguments */
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
+                       case INFOSW:
+                               if (!(info = *argp++))
+                                       /* allow -xyz arguments */
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
+                       case USERSW:
+                               if (!(user = *argp++))
+                                       /* allow -xyz arguments */
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
+                       case FILESW:
+                               if (!(file = *argp++) || *file == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
+                       case SENDERSW:
+                               if (!(sender = *argp++))
+                                       /* allow -xyz arguments */
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
+                       case MAILBOXSW:
+                               if (!(mbox = *argp++) || *mbox == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
+                       case HOMESW:
+                               if (!(home = *argp++) || *home == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
 
-                               case MAILSW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       if (mdlvr)
-                                               adios(NULL, "only one maildelivery file at a time!");
-                                       mdlvr = cp;
-                                       continue;
+                       case MAILSW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               if (mdlvr)
+                                       adios(NULL, "only one maildelivery file at a time!");
+                               mdlvr = cp;
+                               continue;
 
-                               case VERBSW:
-                                       verbose++;
-                                       continue;
-                               case NVERBSW:
-                                       verbose = 0;
-                                       continue;
+                       case VERBSW:
+                               verbose++;
+                               continue;
+                       case NVERBSW:
+                               verbose = 0;
+                               continue;
 
-                               case SUPPRESSDUP:
-                                       suppressdup++;
-                                       continue;
-                               case NSUPPRESSDUP:
-                                       suppressdup = 0;
-                                       continue;
-                               case DEBUGSW:
-                                       debug++;
-                                       continue;
+                       case SUPPRESSDUP:
+                               suppressdup++;
+                               continue;
+                       case NSUPPRESSDUP:
+                               suppressdup = 0;
+                               continue;
+                       case DEBUGSW:
+                               debug++;
+                               continue;
                        }
                }
 
                switch (argp - (argv + 1)) {
-                       case 1:
-                               addr = cp;
-                               break;
-
-                       case 2:
-                               info = cp;
-                               break;
-
-                       case 3:
-                               sender = cp;
-                               break;
+               case 1:
+                       addr = cp;
+                       break;
+               case 2:
+                       info = cp;
+                       break;
+               case 3:
+                       sender = cp;
+                       break;
                }
        }
 
@@ -527,42 +533,42 @@ usr_delivery(int fd, char *delivery, int su)
 
                /* find out how to perform the action */
                switch (result[0]) {
-                       case 'N':
-                       case 'n':
-                               /*
-                               ** If previous condition failed, don't
-                               ** do this - else fall through
-                               */
-                                if (!next)
-                                       continue;  /* else fall */
+               case 'N':
+               case 'n':
+                       /*
+                       ** If previous condition failed, don't
+                       ** do this - else fall through
+                       */
+                        if (!next)
+                               continue;  /* else fall */
 
-                       case '?':
-                               /*
-                               ** If already delivered, skip this action.
-                               ** Else consider delivered if action is
-                               ** successful.
-                               */
-                               if (won)
-                                       continue;  /* else fall */
+               case '?':
+                       /*
+                       ** If already delivered, skip this action.
+                       ** Else consider delivered if action is
+                       ** successful.
+                       */
+                       if (won)
+                               continue;  /* else fall */
 
-                       case 'A':
-                       case 'a':
-                               /*
-                               ** Take action, and consider delivered if
-                               ** action is successful.
-                               */
-                               accept = 1;
-                               break;
+               case 'A':
+               case 'a':
+                       /*
+                       ** Take action, and consider delivered if
+                       ** action is successful.
+                       */
+                       accept = 1;
+                       break;
 
-                       case 'R':
-                       case 'r':
-                       default:
-                               /*
-                               ** Take action, but don't consider delivered,
-                               ** even if action is successful
-                               */
-                               accept = 0;
-                               break;
+               case 'R':
+               case 'r':
+               default:
+                       /*
+                       ** Take action, but don't consider delivered,
+                       ** even if action is successful
+                       */
+                       accept = 0;
+                       break;
                }
 
                if (vecp > 5) {
@@ -576,106 +582,104 @@ usr_delivery(int fd, char *delivery, int su)
 
                /* check if the field matches */
                switch (*field) {
-                       case '*':
-                       /* always matches */
+               case '*':
+               /* always matches */
+                       break;
+
+               case 'd':
+               /*
+               ** "default" matches only if the message hasn't
+               ** been delivered yet.
+               */
+                       if (!mh_strcasecmp(field, "default")) {
+                               if (won)
+                                       continue;
                                break;
+                       }  /* else fall */
 
-                       case 'd':
+               default:
+                       /* parse message and build lookup table */
+                       if (!parsed && parse(fd) == -1) {
+                               fclose(fp);
+                               return -1;
+                       }
                        /*
-                       ** "default" matches only if the message hasn't
-                       ** been delivered yet.
+                       ** find header field in lookup table, and
+                       ** see if the pattern matches.
                        */
-                               if (!mh_strcasecmp(field, "default")) {
-                                       if (won)
-                                               continue;
-                                       break;
-                               }  /* else fall */
-
-                       default:
-                               /* parse message and build lookup table */
-                               if (!parsed && parse(fd) == -1) {
-                                       fclose(fp);
-                                       return -1;
-                               }
-                               /*
-                               ** find header field in lookup table, and
-                               ** see if the pattern matches.
-                               */
-                               if ((p = lookup(hdrs, field)) &&
-                                               (p->p_value != NULL) &&
-                                               matches(p->p_value, pattern)
-                                               ) {
-                                       next = 1;
-                               } else {
-                                       next = 0;
-                                       continue;
-                               }
-                               break;
+                       if ((p = lookup(hdrs, field)) && (p->p_value != NULL)
+                                       && matches(p->p_value, pattern)) {
+                               next = 1;
+                       } else {
+                               next = 0;
+                               continue;
+                       }
+                       break;
                }
 
                /* find out the action to perform */
                switch (*action) {
-                       case 'q':
-                               /* deliver to quoted pipe */
-                               if (mh_strcasecmp(action, "qpipe"))
-                                       continue;  /* else fall */
-                       case '^':
-                               expand(tmpbuf, string, fd);
-                               if (split(tmpbuf, vec) < 1)
-                                       continue;
-                               status = usr_pipe(fd, tmpbuf, vec[0], vec, 0);
-                               break;
+               case 'q':
+                       /* deliver to quoted pipe */
+                       if (mh_strcasecmp(action, "qpipe"))
+                               continue;  /* else fall */
+               case '^':
+                       expand(tmpbuf, string, fd);
+                       if (split(tmpbuf, vec) < 1)
+                               continue;
+                       status = usr_pipe(fd, tmpbuf, vec[0], vec, 0);
+                       break;
 
-                       case 'p':
-                               /* deliver to pipe */
-                               if (mh_strcasecmp(action, "pipe"))
-                                       continue;  /* else fall */
-                       case '|':
-                               vec[2] = "sh";
-                               vec[3] = "-c";
-                               expand(tmpbuf, string, fd);
-                               vec[4] = tmpbuf;
-                               vec[5] = NULL;
-                               status = usr_pipe(fd, tmpbuf, "/bin/sh",
-                                               vec + 2, 0);
-                               break;
+               case 'p':
+                       /* deliver to pipe */
+                       if (mh_strcasecmp(action, "pipe"))
+                               continue;  /* else fall */
+               case '|':
+                       vec[2] = "sh";
+                       vec[3] = "-c";
+                       expand(tmpbuf, string, fd);
+                       vec[4] = tmpbuf;
+                       vec[5] = NULL;
+                       status = usr_pipe(fd, tmpbuf, "/bin/sh",
+                                       vec + 2, 0);
+                       break;
 
-                       case 'f':
-                               /* mbox format */
-                               if (!mh_strcasecmp(action, "file")) {
-                                       status = usr_file(fd, string,
-                                                       MBOX_FORMAT);
-                                       break;
-                               }
-                               /* deliver to nmh folder */
-                               else if (mh_strcasecmp(action, "folder"))
-                                       continue;  /* else fall */
-                       case '+':
-                               status = usr_folder(fd, string);
+               case 'f':
+                       /* mbox format */
+                       if (!mh_strcasecmp(action, "file")) {
+                               status = usr_file(fd, string,
+                                               MBOX_FORMAT);
                                break;
+                       }
+                       /* deliver to nmh folder */
+                       else if (mh_strcasecmp(action, "folder"))
+                               continue;  /* else fall */
+               case '+':
+                       status = usr_folder(fd, string);
+                       break;
 
-                       case 'm':
-                               /* mmdf format */
-                               if (!mh_strcasecmp(action, "mmdf")) {
-                                       status = usr_file(fd, string,
-                                                       MMDF_FORMAT);
-                                       break;
-                               }
-                               /* mbox format */
-                               else if (mh_strcasecmp(action, "mbox"))
-                                       continue;  /* else fall */
-
-                       case '>':
-                               /* mbox format */
-                               status = usr_file(fd, string, MBOX_FORMAT);
+               case 'm':
+                       /* mmdf format */
+                       if (!mh_strcasecmp(action, "mmdf")) {
+                               status = usr_file(fd, string,
+                                               MMDF_FORMAT);
                                break;
+                       }
+                       /* mbox format */
+                       else if (mh_strcasecmp(action, "mbox"))
+                               continue;  /* else fall */
 
-                       case 'd':
-                               /* ignore message */
-                               if (mh_strcasecmp(action, "destroy"))
-                                       continue;
-                               status = 0;
-                               break;
+               case '>':
+                       /* mbox format */
+                       status = usr_file(fd, string, MBOX_FORMAT);
+                       break;
+
+               case 'd':
+                       /* ignore message */
+                       if (mh_strcasecmp(action, "destroy"))
+                               continue;
+                       status = 0;
+                       break;
                }
 
                if (status)
@@ -789,59 +793,59 @@ parse(int fd)
        for (i = 0, state = FLD;;) {
                switch (state = m_getfld(state, name, field, sizeof(field),
                                in)) {
-                       case FLD:
-                       case FLDEOF:
-                       case FLDPLUS:
-                               lp = getcpy(field);
-                               while (state == FLDPLUS) {
-                                       state = m_getfld(state, name, field,
-                                                       sizeof(field), in);
-                                       lp = add(field, lp);
-                               }
-                               for (p = hdrs; p->p_name; p++) {
-                                       if (!mh_strcasecmp(p->p_name, name)) {
-                                               if (!(p->p_flags & P_HID)) {
-                                                       if ((cp = p->p_value)) {
-                                                               if (p->p_flags & P_ADR) {
-                                                                       dp = cp + strlen(cp) - 1;
-                                                                       if (*dp == '\n')
-                                                                               *dp = 0;
-                                                                       cp = add(",\n\t", cp);
-                                                               } else {
-                                                                       cp = add("\t", cp);
-                                                               }
+               case FLD:
+               case FLDEOF:
+               case FLDPLUS:
+                       lp = getcpy(field);
+                       while (state == FLDPLUS) {
+                               state = m_getfld(state, name, field,
+                                               sizeof(field), in);
+                               lp = add(field, lp);
+                       }
+                       for (p = hdrs; p->p_name; p++) {
+                               if (!mh_strcasecmp(p->p_name, name)) {
+                                       if (!(p->p_flags & P_HID)) {
+                                               if ((cp = p->p_value)) {
+                                                       if (p->p_flags & P_ADR) {
+                                                               dp = cp + strlen(cp) - 1;
+                                                               if (*dp == '\n')
+                                                                       *dp = 0;
+                                                               cp = add(",\n\t", cp);
+                                                       } else {
+                                                               cp = add("\t", cp);
                                                        }
-                                                       p->p_value = add(lp, cp);
                                                }
-                                               free(lp);
-                                               break;
+                                               p->p_value = add(lp, cp);
                                        }
+                                       free(lp);
+                                       break;
                                }
-                               if (p->p_name == NULL && i < NVEC) {
-                                       p->p_name = getcpy(name);
-                                       p->p_value = lp;
-                                       p->p_flags = P_NIL;
-                                       p++, i++;
-                                       p->p_name = NULL;
-                               }
-                               if (state != FLDEOF)
-                                       continue;
-                               break;
+                       }
+                       if (p->p_name == NULL && i < NVEC) {
+                               p->p_name = getcpy(name);
+                               p->p_value = lp;
+                               p->p_flags = P_NIL;
+                               p++, i++;
+                               p->p_name = NULL;
+                       }
+                       if (state != FLDEOF)
+                               continue;
+                       break;
 
-                       case BODY:
-                       case BODYEOF:
-                       case FILEEOF:
-                               break;
+               case BODY:
+               case BODYEOF:
+               case FILEEOF:
+                       break;
 
-                       case LENERR:
-                       case FMTERR:
-                               advise(NULL, "format error in message");
-                               break;
+               case LENERR:
+               case FMTERR:
+                       advise(NULL, "format error in message");
+                       break;
 
-                       default:
-                               advise(NULL, "internal error in m_getfld");
-                               fclose(in);
-                               return -1;
+               default:
+                       advise(NULL, "internal error in m_getfld");
+                       fclose(in);
+                       return -1;
                }
                break;
        }
@@ -860,7 +864,8 @@ parse(int fd)
        if (debug) {
                for (p = hdrs; p->p_name; p++)
                        debug_printf("hdrs[%d]: name=\"%s\" value=\"%s\"\n",
-                               p - hdrs, p->p_name, p->p_value ? trim(p->p_value) : "");
+                               p - hdrs, p->p_name,
+                               p->p_value ? trim(p->p_value) : "");
        }
 
        return 0;
@@ -1163,84 +1168,84 @@ usr_pipe(int fd, char *cmd, char *pgm, char **vec, int suppress)
                sleep(5);
 
        switch (child_id) {
-               case -1:
-                       /* fork error */
-                       if (verbose)
-                               adorn("fork", "unable to");
-                       return -1;
+       case -1:
+               /* fork error */
+               if (verbose)
+                       adorn("fork", "unable to");
+               return -1;
 
-               case 0:
-                       /* child process */
-                       if (fd != 0)
-                               dup2(fd, 0);
-                       freopen("/dev/null", "w", stdout);
-                       freopen("/dev/null", "w", stderr);
-                       if (fd != 3)
-                               dup2(fd, 3);
-                       closefds(4);
+       case 0:
+               /* child process */
+               if (fd != 0)
+                       dup2(fd, 0);
+               freopen("/dev/null", "w", stdout);
+               freopen("/dev/null", "w", stderr);
+               if (fd != 3)
+                       dup2(fd, 3);
+               closefds(4);
 
 #ifdef TIOCNOTTY
-                       if ((fd = open("/dev/tty", O_RDWR)) != -1) {
-                               ioctl(fd, TIOCNOTTY, NULL);
-                               close(fd);
-                       }
+               if ((fd = open("/dev/tty", O_RDWR)) != -1) {
+                       ioctl(fd, TIOCNOTTY, NULL);
+                       close(fd);
+               }
 #endif /* TIOCNOTTY */
 
-                       /* put in own process group */
-                       setpgid((pid_t) 0, getpid());
+               /* put in own process group */
+               setpgid((pid_t) 0, getpid());
 
-                       *environ = NULL;
-                       m_putenv("USER", pw->pw_name);
-                       m_putenv("HOME", pw->pw_dir);
-                       m_putenv("SHELL", pw->pw_shell);
+               *environ = NULL;
+               m_putenv("USER", pw->pw_name);
+               m_putenv("HOME", pw->pw_dir);
+               m_putenv("SHELL", pw->pw_shell);
 
-                       execvp(pgm, vec);
-                       _exit(-1);
+               execvp(pgm, vec);
+               _exit(-1);
 
-               default:
-                       /* parent process */
-                       if (!setjmp(myctx)) {
-                               SIGNAL(SIGALRM, alrmser);
-                               bytes = fstat(fd, &st) != -1 ?
-                                               (int) st.st_size : 100;
-
-                               /*
-                               ** amount of time to wait depends on
-                               ** message size
-                               */
-                               if (bytes <= 100) {
-                                       /* give at least 5 minutes */
-                                       seconds = 300;
-                               } else if (bytes >= 90000) {
-                                       /* a half hour is long enough */
-                                       seconds = 1800;
-                               } else {
-                                       seconds = (bytes / 60) + 300;
-                               }
-                               alarm((unsigned int) seconds);
-                               status = pidwait(child_id, 0);
-                               alarm(0);
+       default:
+               /* parent process */
+               if (!setjmp(myctx)) {
+                       SIGNAL(SIGALRM, alrmser);
+                       bytes = fstat(fd, &st) != -1 ?
+                                       (int) st.st_size : 100;
 
-                               if (verbose) {
-                                       if (status == 0)
-                                               verbose_printf(", success.\n");
-                                       else
-                                               if ((status & 0xff00) == 0xff00)
-                                                       verbose_printf(", system error\n");
-                                               else
-                                                       pidstatus(status, stdout, ", failed");
-                               }
-                               return (status == 0 ? 0 : -1);
+                       /*
+                       ** amount of time to wait depends on
+                       ** message size
+                       */
+                       if (bytes <= 100) {
+                               /* give at least 5 minutes */
+                               seconds = 300;
+                       } else if (bytes >= 90000) {
+                               /* a half hour is long enough */
+                               seconds = 1800;
                        } else {
-                               /*
-                               ** Ruthlessly kill the child and anything
-                               ** else in its process group.
-                               */
-                               KILLPG(child_id, SIGKILL);
-                               if (verbose)
-                                       verbose_printf(", timed-out; terminated\n");
-                               return -1;
+                               seconds = (bytes / 60) + 300;
                        }
+                       alarm((unsigned int) seconds);
+                       status = pidwait(child_id, 0);
+                       alarm(0);
+
+                       if (verbose) {
+                               if (status == 0)
+                                       verbose_printf(", success.\n");
+                               else
+                                       if ((status & 0xff00) == 0xff00)
+                                               verbose_printf(", system error\n");
+                                       else
+                                               pidstatus(status, stdout, ", failed");
+                       }
+                       return (status == 0 ? 0 : -1);
+               } else {
+                       /*
+                       ** Ruthlessly kill the child and anything
+                       ** else in its process group.
+                       */
+                       KILLPG(child_id, SIGKILL);
+                       if (verbose)
+                               verbose_printf(", timed-out; terminated\n");
+                       return -1;
+               }
        }
 }
 
@@ -1576,75 +1581,75 @@ suppress_duplicates(int fd, char *file)
        for (state = FLD;;) {
                state = m_getfld(state, name, buf, sizeof(buf), in);
                switch (state) {
-                       case FLD:
-                       case FLDPLUS:
-                       case FLDEOF:
-                               /* Search for the message ID */
-                               if (mh_strcasecmp(name, "Message-ID")) {
-                                       while (state == FLDPLUS)
-                                               state = m_getfld(state, name, buf, sizeof(buf), in);
-                                       continue;
-                               }
+               case FLD:
+               case FLDPLUS:
+               case FLDEOF:
+                       /* Search for the message ID */
+                       if (mh_strcasecmp(name, "Message-ID")) {
+                               while (state == FLDPLUS)
+                                       state = m_getfld(state, name, buf,
+                                                       sizeof(buf), in);
+                               continue;
+                       }
 
-                               cp = getcpy(buf);
-                               while (state == FLDPLUS) {
-                                       state = m_getfld(state, name, buf, sizeof(buf), in);
-                                       cp = add(buf, cp);
-                               }
-                               key.dptr = trimcpy(cp);
-                               key.dsize = strlen(key.dptr) + 1;
-                               free(cp);
-                               cp = key.dptr;
-
-                               if (!(db = dbm_open(file, O_RDWR | O_CREAT,
-                                               0600))) {
-                                       advise(file, "unable to perform dbm_open on");
-                                       free(cp);
-                                       fclose(in);
-                                       return -1;
-                               }
-                               /*
-                               ** Since it is difficult to portable
-                               ** lock a ndbm file, we will open and
-                               ** lock the Maildelivery file instead.
-                               ** This will fail if your Maildelivery
-                               ** file doesn't exist.
-                               */
-                               if ((lockfd = lkopen(file, O_RDWR, 0)) == -1) {
-                                       advise(file, "unable to perform file locking on");
-                                       free(cp);
-                                       fclose(in);
-                                       return -1;
-                               }
-                               value = dbm_fetch(db, key);
-                               if (value.dptr) {
-                                       if (verbose)
-                                               verbose_printf("Message-ID: %s\n            already received on %s", cp, value.dptr);
-                                       result = DONE;
-                               } else {
-                                       value.dptr  = ddate + sizeof("Delivery-Date:");
-                                       value.dsize = strlen(value.dptr) + 1;
-                                       if (dbm_store(db, key, value, DBM_INSERT))
-                                               advise(file, "possibly corrupt file");
-                                       result = 0;
-                               }
+                       cp = getcpy(buf);
+                       while (state == FLDPLUS) {
+                               state = m_getfld(state, name, buf,
+                                               sizeof(buf), in);
+                               cp = add(buf, cp);
+                       }
+                       key.dptr = trimcpy(cp);
+                       key.dsize = strlen(key.dptr) + 1;
+                       free(cp);
+                       cp = key.dptr;
 
-                               dbm_close(db);
-                               lkclose(lockfd, file);
+                       if (!(db = dbm_open(file, O_RDWR | O_CREAT, 0600))) {
+                               advise(file, "unable to perform dbm_open on");
                                free(cp);
                                fclose(in);
-                               return result;
-                               break;
+                               return -1;
+                       }
+                       /*
+                       ** Since it is difficult to portable lock a ndbm
+                       ** file, we will open and lock the Maildelivery
+                       ** file instead.  This will fail if your Maildelivery
+                       ** file doesn't exist.
+                       */
+                       if ((lockfd = lkopen(file, O_RDWR, 0)) == -1) {
+                               advise(file, "unable to perform file locking on");
+                               free(cp);
+                               fclose(in);
+                               return -1;
+                       }
+                       value = dbm_fetch(db, key);
+                       if (value.dptr) {
+                               if (verbose)
+                                       verbose_printf("Message-ID: %s\n            already received on %s", cp, value.dptr);
+                               result = DONE;
+                       } else {
+                               value.dptr  = ddate + sizeof("Delivery-Date:");
+                               value.dsize = strlen(value.dptr) + 1;
+                               if (dbm_store(db, key, value, DBM_INSERT))
+                                       advise(file, "possibly corrupt file");
+                               result = 0;
+                       }
 
-                  case BODY:
-                  case BODYEOF:
-                  case FILEEOF:
-                               break;
+                       dbm_close(db);
+                       lkclose(lockfd, file);
+                       free(cp);
+                       fclose(in);
+                       return result;
+                       break;
 
-                  case LENERR:
-                  case FMTERR:
-                  default:
-                               break;
+               case BODY:
+               case BODYEOF:
+               case FILEEOF:
+                       break;
+
+               case LENERR:
+               case FMTERR:
+               default:
+                       break;
                }
 
                break;
index 262e84d..cc163ac 100644 (file)
@@ -215,104 +215,110 @@ main(int argc, char **argv)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, switches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, switches);
-                                       done(1);
-                               case UNKWNSW:
-                                       adios(NULL, "-%s unknown", cp);
+                       case AMBIGSW:
+                               ambigsw(cp, switches);
+                               done(1);
+                       case UNKWNSW:
+                               adios(NULL, "-%s unknown", cp);
+
+                       case HELPSW:
+                               snprintf(buf, sizeof(buf),
+                                               "%s [switches] file",
+                                               invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
+
+                       case DEBUGSW:
+                               debug++;
+                               continue;
 
-                               case HELPSW:
-                                       snprintf(buf, sizeof(buf), "%s [switches] file", invo_name);
-                                       print_help(buf, switches, 1);
-                                       done(1);
-                               case VERSIONSW:
-                                       print_version(invo_name);
+                       case DISTSW:
+                               msgstate = resent;
+                               continue;
+
+                       case FILTSW:
+                               if (!(filter = *argp++) || *filter == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
+                       case NFILTSW:
+                               filter = NULL;
+                               continue;
+
+                       case REMVSW:
+                               rmflg++;
+                               continue;
+                       case NREMVSW:
+                               rmflg = 0;
+                               continue;
+
+                       case BACKSW:
+                               backflg++;
+                               continue;
+                       case NBACKSW:
+                               backflg = 0;
+                               continue;
+
+                       case VERBSW:
+                               verbose++;
+                               continue;
+                       case NVERBSW:
+                               verbose = 0;
+                               continue;
+
+                       case WATCSW:
+                               watch++;
+                               continue;
+                       case NWATCSW:
+                               watch = 0;
+                               continue;
+
+                       case PUSHSW:
+                               pushflg++;
+                               continue;
+                       case NPUSHSW:
+                               pushflg = 0;
+                               continue;
+
+                       case ALIASW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               aliasflg = 1;
+                               if ((state = alias(cp)) != AK_OK)
+                                       adios(NULL, "aliasing error in file %s - %s", cp, akerror(state) );
+                               continue;
+                       case NALIASW:
+                               aliasflg = 0;
+                               continue;
+
+                       case WIDTHSW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               outputlinelen = atoi(cp);
+                               if (outputlinelen <= 10)
+                                       outputlinelen = 72;
+                               continue;
+
+                       case LIBSW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               /* create a minimal context */
+                               if (context_foil(cp) == -1)
                                        done(1);
+                               continue;
 
-                               case DEBUGSW:
-                                       debug++;
-                                       continue;
-
-                               case DISTSW:
-                                       msgstate = resent;
-                                       continue;
-
-                               case FILTSW:
-                                       if (!(filter = *argp++) ||
-                                                       *filter == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       continue;
-                               case NFILTSW:
-                                       filter = NULL;
-                                       continue;
-
-                               case REMVSW:
-                                       rmflg++;
-                                       continue;
-                               case NREMVSW:
-                                       rmflg = 0;
-                                       continue;
-
-                               case BACKSW:
-                                       backflg++;
-                                       continue;
-                               case NBACKSW:
-                                       backflg = 0;
-                                       continue;
-
-                               case VERBSW:
-                                       verbose++;
-                                       continue;
-                               case NVERBSW:
-                                       verbose = 0;
-                                       continue;
-
-                               case WATCSW:
-                                       watch++;
-                                       continue;
-                               case NWATCSW:
-                                       watch = 0;
-                                       continue;
-
-                               case PUSHSW:
-                                       pushflg++;
-                                       continue;
-                               case NPUSHSW:
-                                       pushflg = 0;
-                                       continue;
-
-                               case ALIASW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       aliasflg = 1;
-                                       if ((state = alias(cp)) != AK_OK)
-                                               adios(NULL, "aliasing error in file %s - %s", cp, akerror(state) );
-                                       continue;
-                               case NALIASW:
-                                       aliasflg = 0;
-                                       continue;
-
-                               case WIDTHSW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       outputlinelen = atoi(cp);
-                                       if (outputlinelen <= 10)
-                                               outputlinelen = 72;
-                                       continue;
-
-                               case LIBSW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       /* create a minimal context */
-                                       if (context_foil(cp) == -1)
-                                               done(1);
-                                       continue;
-
-                               case ANNOSW:
-                                       /* -idanno switch ignored */
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       continue;
+                       case ANNOSW:
+                               /* -idanno switch ignored */
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
                        }
                }
                if (msg)
@@ -348,43 +354,44 @@ main(int argc, char **argv)
 
        for (compnum = 1, state = FLD;;) {
                switch (state = m_getfld(state, name, buf, sizeof(buf), in)) {
-                       case FLD:
-                               compnum++;
-                               putfmt(name, buf, out);
-                               continue;
-
-                       case FLDPLUS:
-                               compnum++;
+               case FLD:
+                       compnum++;
+                       putfmt(name, buf, out);
+                       continue;
+
+               case FLDPLUS:
+                       compnum++;
+                       cp = add(buf, cp);
+                       while (state == FLDPLUS) {
+                               state = m_getfld(state, name, buf,
+                                               sizeof(buf), in);
                                cp = add(buf, cp);
-                               while (state == FLDPLUS) {
-                                       state = m_getfld(state, name, buf,
-                                                       sizeof(buf), in);
-                                       cp = add(buf, cp);
-                               }
-                               putfmt(name, cp, out);
-                               free(cp);
-                               continue;
-
-                       case BODY:
-                               finish_headers(out);
-                               fprintf(out, "\n%s", buf);
-                               while (state == BODY) {
-                                       state = m_getfld(state, name, buf,
-                                                       sizeof(buf), in);
-                                       fputs(buf, out);
-                               }
-                               break;
+                       }
+                       putfmt(name, cp, out);
+                       free(cp);
+                       continue;
+
+               case BODY:
+                       finish_headers(out);
+                       fprintf(out, "\n%s", buf);
+                       while (state == BODY) {
+                               state = m_getfld(state, name, buf,
+                                               sizeof(buf), in);
+                               fputs(buf, out);
+                       }
+                       break;
 
-                       case FILEEOF:
-                               finish_headers(out);
-                               break;
+               case FILEEOF:
+                       finish_headers(out);
+                       break;
 
-                       case LENERR:
-                       case FMTERR:
-                               adios(NULL, "message format error in component #%d", compnum);
+               case LENERR:
+               case FMTERR:
+                       adios(NULL, "message format error in component #%d",
+                                       compnum);
 
-                       default:
-                               adios(NULL, "getfld() returned %d", state);
+               default:
+                       adios(NULL, "getfld() returned %d", state);
                }
                break;
        }
@@ -427,16 +434,16 @@ main(int argc, char **argv)
                for (i=0; (pid = vfork()) == NOTOK && i < 5; i++)
                        sleep(5);
                switch (pid) {
-                       case NOTOK:
-                               fprintf(verbose ? stdout : stderr,
-                                               "%s: can't fork to %s\n",
-                                               invo_name, sendmail);
-                               exit(-1);
-                       case OK:
-                               /* we're the child .. */
-                               break;
-                       default:
-                               exit(0);
+               case NOTOK:
+                       fprintf(verbose ? stdout : stderr,
+                                       "%s: can't fork to %s\n",
+                                       invo_name, sendmail);
+                       exit(-1);
+               case OK:
+                       /* we're the child .. */
+                       break;
+               default:
+                       exit(0);
                }
        }
        execv(sendmail, sargv);
@@ -565,63 +572,63 @@ static void
 finish_headers(FILE *out)
 {
        switch (msgstate) {
-               case normal:
-                       if (!(msgflags & MDAT))
-                               fprintf(out, "Date: %s\n", dtimenow(0));
+       case normal:
+               if (!(msgflags & MDAT))
+                       fprintf(out, "Date: %s\n", dtimenow(0));
 
-                       if (msgflags & MFRM) {
+               if (msgflags & MFRM) {
+                       /*
+                       ** There was already a From: in the draft.
+                       ** Don't add one.
+                       */
+                       if (!draft_from_masquerading)
                                /*
-                               ** There was already a From: in the draft.
-                               ** Don't add one.
+                               ** mts.conf didn't contain
+                               ** "masquerade:[...]draft_from[...]"
+                               ** so we'll reveal the user's
+                               ** actual account@thismachine
+                               ** address in a Sender: header
+                               ** (and use it as the envelope
+                               ** From: later).
                                */
-                               if (!draft_from_masquerading)
-                                       /*
-                                       ** mts.conf didn't contain
-                                       ** "masquerade:[...]draft_from[...]"
-                                       ** so we'll reveal the user's
-                                       ** actual account@thismachine
-                                       ** address in a Sender: header
-                                       ** (and use it as the envelope
-                                       ** From: later).
-                                       */
-                                       fprintf(out, "Sender: %s\n", from);
-                       } else
-                               fprintf(out, "From: %s\n", signature);
+                               fprintf(out, "Sender: %s\n", from);
+               } else
+                       fprintf(out, "From: %s\n", signature);
 
 #ifdef notdef
-                       if (!(msgflags & MVIS))
-                               fprintf(out, "Bcc: Blind Distribution List: ;\n");
+               if (!(msgflags & MVIS))
+                       fprintf(out, "Bcc: Blind Distribution List: ;\n");
 #endif /* notdef */
-                       break;
+               break;
 
-               case resent:
-                       if (!(msgflags & MRDT))
-                               fprintf(out, "Resent-Date: %s\n", dtimenow(0));
-                       if (msgflags & MRFM) {
+       case resent:
+               if (!(msgflags & MRDT))
+                       fprintf(out, "Resent-Date: %s\n", dtimenow(0));
+               if (msgflags & MRFM) {
+                       /*
+                       ** There was already a Resent-From: in draft.
+                       ** Don't add one.
+                       */
+                       if (!draft_from_masquerading)
                                /*
-                               ** There was already a Resent-From: in draft.
-                               ** Don't add one.
+                               ** mts.conf didn't contain
+                               ** "masquerade:[...]draft_from[...]"
+                               ** so we'll reveal the user's
+                               ** actual account@thismachine
+                               ** address in a Sender: header
+                               ** (and use it as the envelope
+                               ** From: later).
                                */
-                               if (!draft_from_masquerading)
-                                       /*
-                                       ** mts.conf didn't contain
-                                       ** "masquerade:[...]draft_from[...]"
-                                       ** so we'll reveal the user's
-                                       ** actual account@thismachine
-                                       ** address in a Sender: header
-                                       ** (and use it as the envelope
-                                       ** From: later).
-                                       */
-                                       fprintf(out, "Resent-Sender: %s\n",
-                                                       from);
-                       } else
-                               /* Construct a Resent-From: header. */
-                               fprintf(out, "Resent-From: %s\n", signature);
+                               fprintf(out, "Resent-Sender: %s\n",
+                                               from);
+               } else
+                       /* Construct a Resent-From: header. */
+                       fprintf(out, "Resent-From: %s\n", signature);
 #ifdef notdef
-                       if (!(msgflags & MVIS))
-                               fprintf(out, "Resent-Bcc: Blind Re-Distribution List: ;\n");
+               if (!(msgflags & MVIS))
+                       fprintf(out, "Resent-Bcc: Blind Re-Distribution List: ;\n");
 #endif /* notdef */
-                       break;
+               break;
        }
 
        if (badmsg)
@@ -793,27 +800,27 @@ make_bcc_file(void)
                for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++)
                        sleep(5);
                switch (child_id) {
-                       case NOTOK:
-                               adios("vfork", "unable to");
-
-                       case OK:
-                               dup2(fileno(out), 1);
-
-                               i = 1;
-                               vec[i++] = "-forward";
-                               vec[i++] = "-form";
-                               vec[i++] = filter;
-                               vec[i++] = tmpfil;
-                               vec[i] = NULL;
-
-                               execvp(mhlproc, vec);
-                               adios(mhlproc, "unable to exec");
-
-                       default:
-                               if (status = pidwait(child_id, OK))
-                                       admonish(NULL, "%s lost (status=0%o)",
-                                                       vec[0], status);
-                               break;
+               case NOTOK:
+                       adios("vfork", "unable to");
+
+               case OK:
+                       dup2(fileno(out), 1);
+
+                       i = 1;
+                       vec[i++] = "-forward";
+                       vec[i++] = "-form";
+                       vec[i++] = filter;
+                       vec[i++] = tmpfil;
+                       vec[i] = NULL;
+
+                       execvp(mhlproc, vec);
+                       adios(mhlproc, "unable to exec");
+
+               default:
+                       if (status = pidwait(child_id, OK))
+                               admonish(NULL, "%s lost (status=0%o)",
+                                               vec[0], status);
+                       break;
                }
        }
 
@@ -853,31 +860,29 @@ fcc(char *file, char *folder)
        for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++)
                sleep(5);
        switch (child_id) {
-               case NOTOK:
+       case NOTOK:
+               if (!verbose)
+                       fprintf(stderr, "  %sFcc %s: ", msgstate == resent ?
+                                       "Resent-" : "", folder);
+               fprintf(verbose ? stdout : stderr, "no forks, so not ok\n");
+               break;
+
+       case OK:
+               snprintf(fold, sizeof(fold), "%s%s",
+                       *folder == '+' || *folder == '@' ? "" : "+", folder);
+               execlp(fileproc, mhbasename(fileproc),
+                       "-link", "-file", file, fold, NULL);
+               _exit(-1);
+
+       default:
+               if ((status = pidwait(child_id, OK))) {
                        if (!verbose)
                                fprintf(stderr, "  %sFcc %s: ",
                                                msgstate == resent ?
                                                "Resent-" : "", folder);
-                       fprintf(verbose ? stdout : stderr, "no forks, so not ok\n");
-                       break;
-
-               case OK:
-                       snprintf(fold, sizeof(fold), "%s%s",
-                               *folder == '+' || *folder == '@' ? "" : "+", folder);
-                       execlp(fileproc, mhbasename(fileproc),
-                               "-link", "-file", file, fold, NULL);
-                       _exit(-1);
-
-               default:
-                       if ((status = pidwait(child_id, OK))) {
-                               if (!verbose)
-                                       fprintf(stderr, "  %sFcc %s: ",
-                                                       msgstate == resent ?
-                                                       "Resent-" : "",
-                                                       folder);
-                               fprintf(verbose ? stdout : stderr,
-                                               " errored (0%o)\n", status);
-                       }
+                       fprintf(verbose ? stdout : stderr, " errored (0%o)\n",
+                                       status);
+               }
        }
 
        fflush(stdout);
index 007adb3..ccb149c 100644 (file)
@@ -223,12 +223,12 @@ via_mail(char *mailsw, char *subjsw, char *parmsw, char *descsw,
                vec[vecp++] = "-verbose";
 
        switch (sendsbr(vec, vecp, tmpfil, &st, 0, NULL, 0)) {
-               case DONE:
-               case NOTOK:
-                       status++;
-                       break;
-               case OK:
-                       break;
+       case DONE:
+       case NOTOK:
+               status++;
+               break;
+       case OK:
+               break;
        }
 
        fclose(fp);
index aefe67f..82af31e 100644 (file)
@@ -704,76 +704,74 @@ editfile(char **ed, char **arg, char *file, int use, struct msgs *mp,
        fflush(stdout);
 
        switch (pid = vfork()) {
-               case NOTOK:
-                       advise("fork", "unable to");
-                       status = NOTOK;
-                       break;
-
-               case OK:
-                       if (cwd)
-                               chdir(cwd);
-                       if (altmsg) {
-                               if (mp)
-                                       m_putenv("mhfolder", mp->foldpath);
-                               m_putenv("editalt", altpath);
-                       }
-
-                       vecp = 0;
-                       vec[vecp++] = mhbasename(*ed);
-                       if (arg)
-                               while (*arg)
-                                       vec[vecp++] = *arg++;
-                       vec[vecp++] = file;
-                       vec[vecp] = NULL;
-
-                       execvp(*ed, vec);
-                       fprintf(stderr, "unable to exec ");
-                       perror(*ed);
-                       _exit(-1);
+       case NOTOK:
+               advise("fork", "unable to");
+               status = NOTOK;
+               break;
+
+       case OK:
+               if (cwd)
+                       chdir(cwd);
+               if (altmsg) {
+                       if (mp)
+                               m_putenv("mhfolder", mp->foldpath);
+                       m_putenv("editalt", altpath);
+               }
 
-               default:
-                       if ((status = pidwait(pid, NOTOK))) {
+               vecp = 0;
+               vec[vecp++] = mhbasename(*ed);
+               if (arg)
+                       while (*arg)
+                               vec[vecp++] = *arg++;
+               vec[vecp++] = file;
+               vec[vecp] = NULL;
+
+               execvp(*ed, vec);
+               fprintf(stderr, "unable to exec ");
+               perror(*ed);
+               _exit(-1);
+
+       default:
+               if ((status = pidwait(pid, NOTOK))) {
 #ifdef ATTVIBUG
-                               if ((cp = mhbasename(*ed)) &&
-                                               strcmp(cp, "vi") == 0 &&
-                                               (status & 0x00ff) == 0)
-                                       status = 0;
-                               else {
+                       if ((cp = mhbasename(*ed)) && strcmp(cp, "vi") == 0 &&
+                                       (status & 0x00ff) == 0)
+                               status = 0;
+                       else {
 #endif
-                               if (((status & 0xff00) != 0xff00)
-                                       && (!reedit || (status & 0x00ff))) {
-                                       if (!use && (status & 0xff00) && (rename(file, cp = m_backup (file)) != NOTOK)) {
-                                               advise(NULL, "problems with edit--draft left in %s", cp);
-                                       } else {
-                                               advise(NULL, "problems with edit--%s preserved", file);
-                                       }
+                       if (((status & 0xff00) != 0xff00)
+                               && (!reedit || (status & 0x00ff))) {
+                               if (!use && (status & 0xff00) && (rename(file, cp = m_backup (file)) != NOTOK)) {
+                                       advise(NULL, "problems with edit--draft left in %s", cp);
+                               } else {
+                                       advise(NULL, "problems with edit--%s preserved", file);
                                }
-                               status = -2;  /* maybe "reedit ? -2 : -1"? */
-                               break;
+                       }
+                       status = -2;  /* maybe "reedit ? -2 : -1"? */
+                       break;
 #ifdef ATTVIBUG
-                               }
-#endif
                        }
+#endif
+               }
 
-                       reedit++;
+               reedit++;
 #ifdef HAVE_LSTAT
-                       if (altmsg && mp && !is_readonly(mp) && (slinked ?
-                                       lstat (linkpath, &st) != NOTOK &&
-                                       S_ISREG(st.st_mode) &&
-                                       copyf(linkpath, altpath) == NOTOK :
-                                       stat(linkpath, &st) != NOTOK &&
-                                       st.st_nlink == 1 &&
-                                       (unlink(altpath) == NOTOK ||
-                                       link(linkpath, altpath) == NOTOK)))
-                               advise(linkpath, "unable to update %s from", altmsg);
+               if (altmsg && mp && !is_readonly(mp) && (slinked ?
+                               lstat (linkpath, &st) != NOTOK &&
+                               S_ISREG(st.st_mode) &&
+                               copyf(linkpath, altpath) == NOTOK :
+                               stat(linkpath, &st) != NOTOK &&
+                               st.st_nlink == 1 &&
+                               (unlink(altpath) == NOTOK ||
+                               link(linkpath, altpath) == NOTOK)))
+                       advise(linkpath, "unable to update %s from", altmsg);
 #else /* HAVE_LSTAT */
-                       if (altmsg && mp && !is_readonly(mp) &&
-                                       stat(linkpath, &st) != NOTOK &&
-                                       st.st_nlink == 1 &&
-                                       (unlink(altpath) == NOTOK ||
-                                       link(linkpath, altpath) == NOTOK))
-                               advise(linkpath, "unable to update %s from",
-                                               altmsg);
+               if (altmsg && mp && !is_readonly(mp) &&
+                               stat(linkpath, &st) != NOTOK &&
+                               st.st_nlink == 1 &&
+                               (unlink(altpath) == NOTOK ||
+                               link(linkpath, altpath) == NOTOK))
+                       advise(linkpath, "unable to update %s from", altmsg);
 #endif /* HAVE_LSTAT */
        }
 
@@ -858,28 +856,28 @@ sendfile(char **arg, char *file, int pushsw)
        for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++)
                sleep(5);
        switch (child_id) {
-               case NOTOK:
-                       advise(NULL, "unable to fork, so sending directly...");
-               case OK:
-                       vecp = 0;
-                       vec[vecp++] = invo_name;
-                       if (pushsw)
-                               vec[vecp++] = "-push";
-                       if (arg)
-                               while (*arg)
-                                       vec[vecp++] = *arg++;
-                       vec[vecp++] = file;
-                       vec[vecp] = NULL;
-
-                       execvp(sendproc, vec);
-                       fprintf(stderr, "unable to exec ");
-                       perror(sendproc);
-                       _exit(-1);
-
-               default:
-                       if (pidwait(child_id, OK) == 0)
-                               done(0);
-                       return 1;
+       case NOTOK:
+               advise(NULL, "unable to fork, so sending directly...");
+       case OK:
+               vecp = 0;
+               vec[vecp++] = invo_name;
+               if (pushsw)
+                       vec[vecp++] = "-push";
+               if (arg)
+                       while (*arg)
+                               vec[vecp++] = *arg++;
+               vec[vecp++] = file;
+               vec[vecp] = NULL;
+
+               execvp(sendproc, vec);
+               fprintf(stderr, "unable to exec ");
+               perror(sendproc);
+               _exit(-1);
+
+       default:
+               if (pidwait(child_id, OK) == 0)
+                       done(0);
+               return 1;
        }
 }
 
@@ -939,41 +937,42 @@ check_draft(char *msgnam)
                return 0;
        for (state = FLD;;)
                switch (state = m_getfld(state, name, buf, sizeof(buf), fp)) {
-                       case FLD:
-                       case FLDPLUS:
-                       case FLDEOF:
-                               /*
-                               ** If draft already contains any of the
-                               ** Content-XXX fields, then assume it already
-                               ** been converted.
-                               */
-                               if (uprf(name, XXX_FIELD_PRF)) {
-                                       fclose(fp);
-                                       return 0;
-                               }
-                               while (state == FLDPLUS)
-                                       state = m_getfld(state, name, buf,
-                                                       sizeof(buf), fp);
-                               break;
+               case FLD:
+               case FLDPLUS:
+               case FLDEOF:
+                       /*
+                       ** If draft already contains any of the
+                       ** Content-XXX fields, then assume it already
+                       ** been converted.
+                       */
+                       if (uprf(name, XXX_FIELD_PRF)) {
+                               fclose(fp);
+                               return 0;
+                       }
+                       while (state == FLDPLUS)
+                               state = m_getfld(state, name, buf,
+                                               sizeof(buf), fp);
+                       break;
 
-                       case BODY:
-                               do {
-                                       char *bp;
+               case BODY:
+                       do {
+                               char *bp;
 
-                                       for (bp = buf; *bp; bp++)
-                                               if (*bp != ' ' && *bp != '\t' && *bp != '\n') {
-                                                       fclose(fp);
-                                                       return 1;
-                                               }
+                               for (bp = buf; *bp; bp++)
+                                       if (*bp != ' ' && *bp != '\t' &&
+                                                       *bp != '\n') {
+                                               fclose(fp);
+                                               return 1;
+                                       }
 
-                                       state = m_getfld(state, name, buf,
-                                                       sizeof(buf), fp);
-                               } while (state == BODY);
-                               /* and fall... */
+                               state = m_getfld(state, name, buf,
+                                               sizeof(buf), fp);
+                       } while (state == BODY);
+                       /* and fall... */
 
-                       default:
-                               fclose(fp);
-                               return 0;
+               default:
+                       fclose(fp);
+                       return 0;
                }
 }
 
@@ -1131,106 +1130,108 @@ sendit(char *sp, char **arg, char *file, int pushed)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, sendswitches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, sendswitches);
-                                       return;
-                               case UNKWNSW:
-                                       advise(NULL, "-%s unknown\n", cp);
-                                       return;
+                       case AMBIGSW:
+                               ambigsw(cp, sendswitches);
+                               return;
+                       case UNKWNSW:
+                               advise(NULL, "-%s unknown\n", cp);
+                               return;
 
-                               case SHELPSW:
-                                       snprintf(buf, sizeof(buf),
-                                                       "%s [switches]", sp);
-                                       print_help(buf, sendswitches, 1);
-                                       return;
-                               case SVERSIONSW:
-                                       print_version(invo_name);
+                       case SHELPSW:
+                               snprintf(buf, sizeof(buf),
+                                               "%s [switches]", sp);
+                               print_help(buf, sendswitches, 1);
+                               return;
+                       case SVERSIONSW:
+                               print_version(invo_name);
+                               return;
+
+                       case SPSHSW:
+                               pushed++;
+                               continue;
+                       case NSPSHSW:
+                               pushed = 0;
+                               continue;
+
+                       case UNIQSW:
+                               unique++;
+                               continue;
+                       case NUNIQSW:
+                               unique = 0;
+                               continue;
+                       case FORWSW:
+                               forwsw++;
+                               continue;
+                       case NFORWSW:
+                               forwsw = 0;
+                               continue;
+
+                       case VERBSW:
+                               verbsw++;
+                               vec[vecp++] = --cp;
+                               continue;
+                       case NVERBSW:
+                               verbsw = 0;
+                               vec[vecp++] = --cp;
+                               continue;
+
+                       case DEBUGSW:
+                               debugsw++;  /* fall */
+                       case NFILTSW:
+                       case FRMTSW:
+                       case NFRMTSW:
+                       case BITSTUFFSW:
+                       case NBITSTUFFSW:
+                       case MIMESW:
+                       case NMIMESW:
+                       case MSGDSW:
+                       case NMSGDSW:
+                       case WATCSW:
+                       case NWATCSW:
+                       case MAILSW:
+                       case SAMLSW:
+                       case SSNDSW:
+                       case SOMLSW:
+                       case SNOOPSW:
+                               vec[vecp++] = --cp;
+                               continue;
+
+                       case ALIASW:
+                       case FILTSW:
+                       case WIDTHSW:
+                       case CLIESW:
+                       case SERVSW:
+                       case PORTSW:
+                               vec[vecp++] = --cp;
+                               if (!(cp = *argp++) || *cp == '-') {
+                                       advise(NULL, "missing argument to %s",
+                                                       argp[-2]);
                                        return;
+                               }
+                               vec[vecp++] = cp;
+                               continue;
 
-                               case SPSHSW:
-                                       pushed++;
-                                       continue;
-                               case NSPSHSW:
-                                       pushed = 0;
-                                       continue;
-
-                               case UNIQSW:
-                                       unique++;
-                                       continue;
-                               case NUNIQSW:
-                                       unique = 0;
-                                       continue;
-                               case FORWSW:
-                                       forwsw++;
-                                       continue;
-                               case NFORWSW:
-                                       forwsw = 0;
-                                       continue;
-
-                               case VERBSW:
-                                       verbsw++;
-                                       vec[vecp++] = --cp;
-                                       continue;
-                               case NVERBSW:
-                                       verbsw = 0;
-                                       vec[vecp++] = --cp;
-                                       continue;
-
-                               case DEBUGSW:
-                                       debugsw++;  /* fall */
-                               case NFILTSW:
-                               case FRMTSW:
-                               case NFRMTSW:
-                               case BITSTUFFSW:
-                               case NBITSTUFFSW:
-                               case MIMESW:
-                               case NMIMESW:
-                               case MSGDSW:
-                               case NMSGDSW:
-                               case WATCSW:
-                               case NWATCSW:
-                               case MAILSW:
-                               case SAMLSW:
-                               case SSNDSW:
-                               case SOMLSW:
-                               case SNOOPSW:
-                                       vec[vecp++] = --cp;
-                                       continue;
-
-                               case ALIASW:
-                               case FILTSW:
-                               case WIDTHSW:
-                               case CLIESW:
-                               case SERVSW:
-                               case PORTSW:
-                                       vec[vecp++] = --cp;
-                                       if (!(cp = *argp++) || *cp == '-') {
-                                               advise(NULL, "missing argument to %s", argp[-2]);
-                                               return;
-                                       }
-                                       vec[vecp++] = cp;
-                                       continue;
-
-                               case SNDATTACHSW:
-                                       if (!(attach = *argp++) ||
-                                                       *attach == '-') {
-                                               advise(NULL, "missing argument to %s", argp[-2]);
-                                               return;
-                                       }
-                                       continue;
+                       case SNDATTACHSW:
+                               if (!(attach = *argp++) || *attach == '-') {
+                                       advise(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                                       return;
+                               }
+                               continue;
 
-                               case SNDATTACHFORMAT:
-                                       if (! *argp || **argp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-1]);
-                                       else {
-                                               attachformat = atoi(*argp);
-                                               if (attachformat < 0 || attachformat > ATTACHFORMATS - 1) {
-                                                       advise(NULL, "unsupported attachformat %d", attachformat);
-                                                       continue;
-                                               }
+                       case SNDATTACHFORMAT:
+                               if (! *argp || **argp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-1]);
+                               else {
+                                       attachformat = atoi(*argp);
+                                       if (attachformat < 0 || attachformat > ATTACHFORMATS - 1) {
+                                               advise(NULL, "unsupported attachformat %d", attachformat);
+                                               continue;
                                        }
-                                       ++argp;
-                                       continue;
+                               }
+                               ++argp;
+                               continue;
                        }
                }
                advise(NULL, "usage: %s [switches]", sp);