Created pluspath function to check for '+' prefix and change flag for
authorJoel Reicher <jjr@panacea.null.org>
Thu, 27 Apr 2006 12:00:28 +0000 (12:00 +0000)
committerJoel Reicher <jjr@panacea.null.org>
Thu, 27 Apr 2006 12:00:28 +0000 (12:00 +0000)
path() appropriately. This eliminates some duplicate prefix processing,
but not all. The path functions need to be restructed; this is the first
step.

32 files changed:
h/prototypes.h
sbr/path.c
uip/anno.c
uip/burst.c
uip/comp.c
uip/dist.c
uip/flist.c
uip/folder.c
uip/forw.c
uip/inc.c
uip/mark.c
uip/mhbuildsbr.c
uip/mhlist.c
uip/mhn.c
uip/mhpath.c
uip/mhshow.c
uip/mhstore.c
uip/mhstoresbr.c
uip/mhtest.c
uip/msh.c
uip/mshcmds.c
uip/packf.c
uip/pick.c
uip/popi.c
uip/rcvstore.c
uip/refile.c
uip/repl.c
uip/rmf.c
uip/rmm.c
uip/scan.c
uip/show.c
uip/sortm.c

index 7e772e0..7e8948e 100644 (file)
@@ -89,6 +89,7 @@ char *path(char *, int);
 int peekc(FILE *ib);
 int pidwait (pid_t, int);
 int pidstatus (int, FILE *, char *);
 int peekc(FILE *ib);
 int pidwait (pid_t, int);
 int pidstatus (int, FILE *, char *);
+char *pluspath(char *);
 void print_help (char *, struct swit *, int);
 void print_sw (char *, struct swit *, char *);
 void print_version (char *);
 void print_help (char *, struct swit *, int);
 void print_sw (char *, struct swit *, char *);
 void print_version (char *);
index 0ae27d3..7475fa0 100644 (file)
@@ -26,6 +26,11 @@ static char *pwds;
 static char *expath(char *,int);
 static void compath(char *);
 
 static char *expath(char *,int);
 static void compath(char *);
 
+char *
+pluspath(char *name)
+{
+       return path(name + 1, *name == '+' ? TFOLDER : TSUBCWF);
+}
 
 char *
 path(char *name, int flag)
 
 char *
 path(char *name, int flag)
index 0d44134..ca3497a 100644 (file)
@@ -211,7 +211,7 @@ main (int argc, char **argv)
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
-               folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+               folder = pluspath (cp);
        } else
                app_msgarg(&msgs, cp);
     }
        } else
                app_msgarg(&msgs, cp);
     }
index 908de0d..319918b 100644 (file)
@@ -111,7 +111,7 @@ main (int argc, char **argv)
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
-               folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+               folder = pluspath (cp);
        } else {
            msgs[msgp++] = cp;
        }
        } else {
            msgs[msgp++] = cp;
        }
index 8fced48..67cf83b 100644 (file)
@@ -172,7 +172,7 @@ main (int argc, char **argv)
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
-               folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+               folder = pluspath (cp);
        } else {
            if (msg)
                adios (NULL, "only one message at a time!");
        } else {
            if (msg)
                adios (NULL, "only one message at a time!");
index 70e515e..d8c261d 100644 (file)
@@ -180,7 +180,7 @@ main (int argc, char **argv)
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
-               folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+               folder = pluspath (cp);
        } else {
            if (msg)
                adios (NULL, "only one message at a time!");
        } else {
            if (msg)
                adios (NULL, "only one message at a time!");
index 36be1ed..cb80978 100644 (file)
@@ -232,7 +232,7 @@ main(int argc, char **argv)
            }
            if (*cp == '+' || *cp == '@') {
                foldersToDo[numfolders++] =
            }
            if (*cp == '+' || *cp == '@') {
                foldersToDo[numfolders++] =
-                   path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+                   pluspath (cp);
            } else
                foldersToDo[numfolders++] = cp;
        }
            } else
                foldersToDo[numfolders++] = cp;
        }
index 98c66ed..f04ae2f 100644 (file)
@@ -259,7 +259,7 @@ main (int argc, char **argv)
            if (argfolder)
                adios (NULL, "only one folder at a time!");
            else
            if (argfolder)
                adios (NULL, "only one folder at a time!");
            else
-               argfolder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+               argfolder = pluspath (cp);
        } else {
            if (msg)
                adios (NULL, "only one (current) message at a time!");
        } else {
            if (msg)
                adios (NULL, "only one (current) message at a time!");
index 93870b1..7645e38 100644 (file)
@@ -285,7 +285,7 @@ main (int argc, char **argv)
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
-               folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+               folder = pluspath (cp);
        } else {
            msgs[msgp++] = cp;
        }
        } else {
            msgs[msgp++] = cp;
        }
index aee194a..a2ecb44 100644 (file)
--- a/uip/inc.c
+++ b/uip/inc.c
@@ -457,7 +457,7 @@ main (int argc, char **argv)
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
-               folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+               folder = pluspath (cp);
        } else {
            adios (NULL, "usage: %s [+folder] [switches]", invo_name);
        }
        } else {
            adios (NULL, "usage: %s [+folder] [switches]", invo_name);
        }
index e26ca6a..4799b23 100644 (file)
@@ -137,7 +137,7 @@ main (int argc, char **argv)
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
-               folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+               folder = pluspath (cp);
        } else
                app_msgarg(&msgs, cp);
     }
        } else
                app_msgarg(&msgs, cp);
     }
index 4882ecb..8906d7f 100644 (file)
@@ -3254,7 +3254,7 @@ use_forw:
                if (folder)
                    adios (NULL, "only one folder per #forw directive");
                else
                if (folder)
                    adios (NULL, "only one folder per #forw directive");
                else
-                   folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+                   folder = pluspath (cp);
            }
        }
 
            }
        }
 
index b130cf1..1de53e3 100644 (file)
@@ -242,7 +242,7 @@ do_cache:
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
-               folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+               folder = pluspath (cp);
        } else
                app_msgarg(&msgs, cp);
     }
        } else
                app_msgarg(&msgs, cp);
     }
index cfeac94..809568c 100644 (file)
--- a/uip/mhn.c
+++ b/uip/mhn.c
@@ -427,7 +427,7 @@ do_cache:
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
-               folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+               folder = pluspath (cp);
        } else
                app_msgarg(&msgs, cp);
     }
        } else
                app_msgarg(&msgs, cp);
     }
index 00983d5..3974515 100644 (file)
@@ -67,7 +67,7 @@ main(int argc, char **argv)
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
-               folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+               folder = pluspath (cp);
        } else
                app_msgarg(&msgs, cp);
     }
        } else
                app_msgarg(&msgs, cp);
     }
index df4cf51..3e7e3a5 100644 (file)
@@ -283,7 +283,7 @@ do_cache:
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
-               folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+               folder = pluspath (cp);
        } else
                app_msgarg(&msgs, cp);
     }
        } else
                app_msgarg(&msgs, cp);
     }
index 08891f5..dc62724 100644 (file)
@@ -229,7 +229,7 @@ do_cache:
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
-               folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+               folder = pluspath (cp);
        } else
                app_msgarg(&msgs, cp);
     }
        } else
                app_msgarg(&msgs, cp);
     }
index bf5088e..23b4ef2 100644 (file)
@@ -565,7 +565,7 @@ store_content (CT ct, CT p)
 
        /* Get the folder name */
        if (cp[1])
 
        /* Get the folder name */
        if (cp[1])
-           folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+           folder = pluspath (cp);
        else
            folder = getfolder (1);
 
        else
            folder = getfolder (1);
 
index 140c7d9..5e6494a 100644 (file)
@@ -230,7 +230,7 @@ do_cache:
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
-               folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+               folder = pluspath (cp);
        } else
                app_msgarg(&msgs, cp);
     }
        } else
                app_msgarg(&msgs, cp);
     }
index 257fc42..4b91790 100644 (file)
--- a/uip/msh.c
+++ b/uip/msh.c
@@ -351,7 +351,7 @@ main (int argc, char **argv)
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
-               folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+               folder = pluspath (cp);
        }
        else
            if (file)
        }
        else
            if (file)
index f2c913c..60f3413 100644 (file)
@@ -593,7 +593,7 @@ filehak (char **args)
        if (cwd == NULL)
            cwd = getcpy (pwd ());
        chdir (m_maildir (""));
        if (cwd == NULL)
            cwd = getcpy (pwd ());
        chdir (m_maildir (""));
-       cp = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+       cp = pluspath (cp);
        if (access (m_maildir (cp), F_OK) == NOTOK)
            result = OK;
        free (cp);
        if (access (m_maildir (cp), F_OK) == NOTOK)
            result = OK;
        free (cp);
@@ -703,7 +703,7 @@ foldcmd (char **args)
                return;
            }
            else
                return;
            }
            else
-               folder = fmsh ? path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF)
+               folder = fmsh ? pluspath (cp)
                            : cp + 1;
        }
        else
                            : cp + 1;
        }
        else
index e074505..9f95466 100644 (file)
@@ -98,7 +98,7 @@ main (int argc, char **argv)
        if (*cp == '+' || *cp == '@') {
            if (folder)
                adios (NULL, "only one folder at a time!");
        if (*cp == '+' || *cp == '@') {
            if (folder)
                adios (NULL, "only one folder at a time!");
-           folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+           folder = pluspath (cp);
        } else
                app_msgarg(&msgs, cp);
     }
        } else
                app_msgarg(&msgs, cp);
     }
index 8fd294e..dff628a 100644 (file)
@@ -177,7 +177,7 @@ main (int argc, char **argv)
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
-               folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+               folder = pluspath (cp);
        } else
                app_msgarg(&msgs, cp);
     }
        } else
                app_msgarg(&msgs, cp);
     }
index 3a03c0a..f522042 100644 (file)
@@ -191,7 +191,7 @@ main (int argc, char **argv)
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
-               folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+               folder = pluspath (cp);
        }
        else
            adios (NULL, "usage: %s [+folder] [switches]", invo_name);
        }
        else
            adios (NULL, "usage: %s [+folder] [switches]", invo_name);
index 7b15491..4e14afb 100644 (file)
@@ -134,7 +134,7 @@ main (int argc, char **argv)
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
-               folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+               folder = pluspath (cp);
        } else {
            adios (NULL, "usage: %s [+folder] [switches]", invo_name);
        }
        } else {
            adios (NULL, "usage: %s [+folder] [switches]", invo_name);
        }
index e77fe0b..0b3afe1 100644 (file)
@@ -163,7 +163,7 @@ main (int argc, char **argv)
            if (foldp > NFOLDERS)
                adios (NULL, "only %d folders allowed!", NFOLDERS);
            folders[foldp++].f_name =
            if (foldp > NFOLDERS)
                adios (NULL, "only %d folders allowed!", NFOLDERS);
            folders[foldp++].f_name =
-               path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+               pluspath (cp);
        } else
                app_msgarg(&msgs, cp);
     }
        } else
                app_msgarg(&msgs, cp);
     }
index e5fa527..7a1aca1 100644 (file)
@@ -319,7 +319,7 @@ main (int argc, char **argv)
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
-               folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+               folder = pluspath (cp);
        } else {
            if (msg)
                adios (NULL, "only one message at a time!");
        } else {
            if (msg)
                adios (NULL, "only one message at a time!");
index fb951ed..1cacbc4 100644 (file)
--- a/uip/rmf.c
+++ b/uip/rmf.c
@@ -78,7 +78,7 @@ main (int argc, char **argv)
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
-               folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+               folder = pluspath (cp);
        } else {
            adios (NULL, "usage: %s [+folder] [switches]", invo_name);
        }
        } else {
            adios (NULL, "usage: %s [+folder] [switches]", invo_name);
        }
index 75b1c70..b1e887e 100644 (file)
--- a/uip/rmm.c
+++ b/uip/rmm.c
@@ -77,7 +77,7 @@ main (int argc, char **argv)
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
-               folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+               folder = pluspath (cp);
        } else
                app_msgarg(&msgs, cp);
     }
        } else
                app_msgarg(&msgs, cp);
     }
index 4334efe..05f8bf8 100644 (file)
@@ -155,7 +155,7 @@ main (int argc, char **argv)
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
-               folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+               folder = pluspath (cp);
        } else
                app_msgarg(&msgs, cp);
     }
        } else
                app_msgarg(&msgs, cp);
     }
index 31a05e9..2db32d7 100644 (file)
@@ -179,7 +179,7 @@ usage:
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
-               folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+               folder = pluspath (cp);
        } else {
            if (mode != SHOW)
                goto usage;
        } else {
            if (mode != SHOW)
                goto usage;
index 5faec79..d483d86 100644 (file)
@@ -160,7 +160,7 @@ main (int argc, char **argv)
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
            if (folder)
                adios (NULL, "only one folder at a time!");
            else
-               folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+               folder = pluspath (cp);
        } else
                app_msgarg(&msgs, cp);
     }
        } else
                app_msgarg(&msgs, cp);
     }