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)
-