Reformated comments and long lines
[mmh] / uip / dist.c
index 10ef995..86c564f 100644 (file)
@@ -1,10 +1,10 @@
 /*
- * dist.c -- re-distribute a message
- *
- * This code is Copyright (c) 2002, by the authors of nmh.  See the
- * COPYRIGHT file in the root directory of the nmh distribution for
- * complete copyright information.
- */
+** dist.c -- re-distribute a message
+**
+** This code is Copyright (c) 2002, by the authors of nmh.  See the
+** COPYRIGHT file in the root directory of the nmh distribution for
+** complete copyright information.
+*/
 
 #include <h/mh.h>
 #include <h/utils.h>
@@ -15,70 +15,40 @@ static struct swit switches[] = {
        { "annotate", 0 },
 #define NANNOSW  1
        { "noannotate", 0 },
-#define DFOLDSW  2
-       { "draftfolder +folder", 0 },
-#define DMSGSW  3
-       { "draftmessage msg", 0 },
-#define NDFLDSW  4
-       { "nodraftfolder", 0 },
-#define EDITRSW  5
+#define EDITRSW  2
        { "editor editor", 0 },
-#define NEDITSW  6
+#define NEDITSW  3
        { "noedit", 0 },
-#define FORMSW  7
+#define FORMSW  4
        { "form formfile", 0 },
-#define INPLSW  8
+#define INPLSW  5
        { "inplace", 0 },
-#define NINPLSW  9
+#define NINPLSW  6
        { "noinplace", 0 },
-#define WHATSW  10
+#define WHATSW  7
        { "whatnowproc program", 0 },
-#define NWHATSW  11
+#define NWHATSW  8
        { "nowhatnowproc", 0 },
-#define VERSIONSW  12
+#define VERSIONSW  9
        { "version", 0 },
-#define HELPSW  13
+#define HELPSW  10
        { "help", 0 },
-#define FILESW  14
+#define FILESW  11
        { "file file", -4 },  /* interface from msh */
        { NULL, 0 }
 };
 
-static struct swit aqrnl[] = {
-#define NOSW  0
-       { "quit", 0 },
-#define YESW  1
-       { "replace", 0 },
-#define LISTDSW  2
-       { "list", 0 },
-#define REFILSW  3
-       { "refile +folder", 0 },
-#define NEWSW  4
-       { "new", 0 },
-       { NULL, 0 }
-};
-
-
-static struct swit aqrl[] = {
-       { "quit", 0 },
-       { "replace", 0 },
-       { "list", 0 },
-       { "refile +folder", 0 },
-       { NULL, 0 }
-};
-
 
 int
 main (int argc, char **argv)
 {
        int anot = 0, inplace = 1, nedit = 0;
-       int nwhat = 0, i, in, isdf = 0, out;
-       char *cp, *cwd, *maildir, *msgnam, *dfolder = NULL;
-       char *dmsg = NULL, *ed = NULL, *file = NULL, *folder = NULL;
+       int nwhat = 0, in, out;
+       char *cp, *cwd, *maildir, *msgnam;
+       char *ed = NULL, *file = NULL, *folder = NULL;
        char *form = NULL, *msg = NULL, buf[BUFSIZ], drft[BUFSIZ];
        char **argp, **arguments;
        struct msgs *mp = NULL;
-       struct stat st;
 
 #ifdef LOCALE
        setlocale(LC_ALL, "");
@@ -152,25 +122,6 @@ main (int argc, char **argv)
                                case NINPLSW:
                                        inplace = 0;
                                        continue;
-
-                               case DFOLDSW:
-                                       if (dfolder)
-                                               adios (NULL, "only one draft folder at a time!");
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       dfolder = path (*cp == '+' || *cp == '@' ? cp + 1 : cp,
-                                                       *cp != '@' ? TFOLDER : TSUBCWF);
-                                       continue;
-                               case DMSGSW:
-                                       if (dmsg)
-                                               adios (NULL, "only one draft message at a time!");
-                                       if (!(dmsg = *argp++) || *dmsg == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       continue;
-                               case NDFLDSW:
-                                       dfolder = NULL;
-                                       isdf = NOTOK;
-                                       continue;
                        }
                }
                if (*cp == '+' || *cp == '@') {
@@ -195,36 +146,8 @@ main (int argc, char **argv)
 
        in = open_form(&form, distcomps);
 
-try_it_again:
-       strncpy (drft, m_draft (dfolder, dmsg, NOUSE, &isdf), sizeof(drft));
+       strncpy (drft, m_draft("new"), sizeof(drft));
 
-       /* Check if draft already exists */
-       if (stat (drft, &st) != NOTOK) {
-               printf ("Draft \"%s\" exists (%ld bytes).", drft, (long) st.st_size);
-               for (i = LISTDSW; i != YESW;) {
-                       if (!(argp = getans ("\nDisposition? ", isdf ? aqrnl : aqrl)))
-                               done (1);
-                       switch (i = smatch (*argp, isdf ? aqrnl : aqrl)) {
-                               case NOSW:
-                                       done (0);
-                               case NEWSW:
-                                       dmsg = NULL;
-                                       goto try_it_again;
-                               case YESW:
-                                       break;
-                               case LISTDSW:
-                                       showfile (++argp, drft);
-                                       break;
-                               case REFILSW:
-                                       if (refile (++argp, drft) == 0)
-                                               i = YESW;
-                                       break;
-                               default:
-                                       advise (NULL, "say what?");
-                                       break;
-                       }
-               }
-       }
        if ((out = creat (drft, m_gmprot ())) == NOTOK)
                adios (drft, "unable to create");
 
@@ -234,13 +157,13 @@ try_it_again:
 
        if (file) {
                /*
-                * Dist a file
-                */
+               ** Dist a file
+               */
                anot = 0;  /* don't want to annotate a file */
        } else {
                /*
-                * Dist a message
-                */
+               ** Dist a message
+               */
                if (!msg)
                        msg = "cur";
                if (!folder)