From: Joel Reicher Date: Thu, 27 Apr 2006 12:00:28 +0000 (+0000) Subject: Created pluspath function to check for '+' prefix and change flag for X-Git-Tag: nmh-1_3_RC1~31 X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=0569d6d1631dc90d4f2f2df6bdd0599c7ecc7814;p=mmh Created pluspath function to check for '+' prefix and change flag for path() appropriately. This eliminates some duplicate prefix processing, but not all. The path functions need to be restructed; this is the first step. --- diff --git a/h/prototypes.h b/h/prototypes.h index 7e772e0..7e8948e 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -89,6 +89,7 @@ char *path(char *, int); 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 *); diff --git a/sbr/path.c b/sbr/path.c index 0ae27d3..7475fa0 100644 --- a/sbr/path.c +++ b/sbr/path.c @@ -26,6 +26,11 @@ static char *pwds; 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) diff --git a/uip/anno.c b/uip/anno.c index 0d44134..ca3497a 100644 --- a/uip/anno.c +++ b/uip/anno.c @@ -211,7 +211,7 @@ main (int argc, char **argv) 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); } diff --git a/uip/burst.c b/uip/burst.c index 908de0d..319918b 100644 --- a/uip/burst.c +++ b/uip/burst.c @@ -111,7 +111,7 @@ main (int argc, char **argv) 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; } diff --git a/uip/comp.c b/uip/comp.c index 8fced48..67cf83b 100644 --- a/uip/comp.c +++ b/uip/comp.c @@ -172,7 +172,7 @@ main (int argc, char **argv) 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!"); diff --git a/uip/dist.c b/uip/dist.c index 70e515e..d8c261d 100644 --- a/uip/dist.c +++ b/uip/dist.c @@ -180,7 +180,7 @@ main (int argc, char **argv) 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!"); diff --git a/uip/flist.c b/uip/flist.c index 36be1ed..cb80978 100644 --- a/uip/flist.c +++ b/uip/flist.c @@ -232,7 +232,7 @@ main(int argc, char **argv) } if (*cp == '+' || *cp == '@') { foldersToDo[numfolders++] = - path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF); + pluspath (cp); } else foldersToDo[numfolders++] = cp; } diff --git a/uip/folder.c b/uip/folder.c index 98c66ed..f04ae2f 100644 --- a/uip/folder.c +++ b/uip/folder.c @@ -259,7 +259,7 @@ main (int argc, char **argv) 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!"); diff --git a/uip/forw.c b/uip/forw.c index 93870b1..7645e38 100644 --- a/uip/forw.c +++ b/uip/forw.c @@ -285,7 +285,7 @@ main (int argc, char **argv) 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; } diff --git a/uip/inc.c b/uip/inc.c index aee194a..a2ecb44 100644 --- 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 - folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF); + folder = pluspath (cp); } else { adios (NULL, "usage: %s [+folder] [switches]", invo_name); } diff --git a/uip/mark.c b/uip/mark.c index e26ca6a..4799b23 100644 --- a/uip/mark.c +++ b/uip/mark.c @@ -137,7 +137,7 @@ main (int argc, char **argv) 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); } diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c index 4882ecb..8906d7f 100644 --- a/uip/mhbuildsbr.c +++ b/uip/mhbuildsbr.c @@ -3254,7 +3254,7 @@ use_forw: if (folder) adios (NULL, "only one folder per #forw directive"); else - folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF); + folder = pluspath (cp); } } diff --git a/uip/mhlist.c b/uip/mhlist.c index b130cf1..1de53e3 100644 --- a/uip/mhlist.c +++ b/uip/mhlist.c @@ -242,7 +242,7 @@ do_cache: 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); } diff --git a/uip/mhn.c b/uip/mhn.c index cfeac94..809568c 100644 --- 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 - folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF); + folder = pluspath (cp); } else app_msgarg(&msgs, cp); } diff --git a/uip/mhpath.c b/uip/mhpath.c index 00983d5..3974515 100644 --- a/uip/mhpath.c +++ b/uip/mhpath.c @@ -67,7 +67,7 @@ main(int argc, char **argv) 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); } diff --git a/uip/mhshow.c b/uip/mhshow.c index df4cf51..3e7e3a5 100644 --- a/uip/mhshow.c +++ b/uip/mhshow.c @@ -283,7 +283,7 @@ do_cache: 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); } diff --git a/uip/mhstore.c b/uip/mhstore.c index 08891f5..dc62724 100644 --- a/uip/mhstore.c +++ b/uip/mhstore.c @@ -229,7 +229,7 @@ do_cache: 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); } diff --git a/uip/mhstoresbr.c b/uip/mhstoresbr.c index bf5088e..23b4ef2 100644 --- a/uip/mhstoresbr.c +++ b/uip/mhstoresbr.c @@ -565,7 +565,7 @@ store_content (CT ct, CT p) /* Get the folder name */ if (cp[1]) - folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF); + folder = pluspath (cp); else folder = getfolder (1); diff --git a/uip/mhtest.c b/uip/mhtest.c index 140c7d9..5e6494a 100644 --- a/uip/mhtest.c +++ b/uip/mhtest.c @@ -230,7 +230,7 @@ do_cache: 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); } diff --git a/uip/msh.c b/uip/msh.c index 257fc42..4b91790 100644 --- 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 - folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF); + folder = pluspath (cp); } else if (file) diff --git a/uip/mshcmds.c b/uip/mshcmds.c index f2c913c..60f3413 100644 --- a/uip/mshcmds.c +++ b/uip/mshcmds.c @@ -593,7 +593,7 @@ filehak (char **args) 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); @@ -703,7 +703,7 @@ foldcmd (char **args) return; } else - folder = fmsh ? path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF) + folder = fmsh ? pluspath (cp) : cp + 1; } else diff --git a/uip/packf.c b/uip/packf.c index e074505..9f95466 100644 --- a/uip/packf.c +++ b/uip/packf.c @@ -98,7 +98,7 @@ main (int argc, char **argv) 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); } diff --git a/uip/pick.c b/uip/pick.c index 8fd294e..dff628a 100644 --- a/uip/pick.c +++ b/uip/pick.c @@ -177,7 +177,7 @@ main (int argc, char **argv) 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); } diff --git a/uip/popi.c b/uip/popi.c index 3a03c0a..f522042 100644 --- a/uip/popi.c +++ b/uip/popi.c @@ -191,7 +191,7 @@ main (int argc, char **argv) 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); diff --git a/uip/rcvstore.c b/uip/rcvstore.c index 7b15491..4e14afb 100644 --- a/uip/rcvstore.c +++ b/uip/rcvstore.c @@ -134,7 +134,7 @@ main (int argc, char **argv) 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); } diff --git a/uip/refile.c b/uip/refile.c index e77fe0b..0b3afe1 100644 --- a/uip/refile.c +++ b/uip/refile.c @@ -163,7 +163,7 @@ main (int argc, char **argv) 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); } diff --git a/uip/repl.c b/uip/repl.c index e5fa527..7a1aca1 100644 --- a/uip/repl.c +++ b/uip/repl.c @@ -319,7 +319,7 @@ main (int argc, char **argv) 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!"); diff --git a/uip/rmf.c b/uip/rmf.c index fb951ed..1cacbc4 100644 --- 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 - folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF); + folder = pluspath (cp); } else { adios (NULL, "usage: %s [+folder] [switches]", invo_name); } diff --git a/uip/rmm.c b/uip/rmm.c index 75b1c70..b1e887e 100644 --- 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 - folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF); + folder = pluspath (cp); } else app_msgarg(&msgs, cp); } diff --git a/uip/scan.c b/uip/scan.c index 4334efe..05f8bf8 100644 --- a/uip/scan.c +++ b/uip/scan.c @@ -155,7 +155,7 @@ main (int argc, char **argv) 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); } diff --git a/uip/show.c b/uip/show.c index 31a05e9..2db32d7 100644 --- a/uip/show.c +++ b/uip/show.c @@ -179,7 +179,7 @@ usage: 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; diff --git a/uip/sortm.c b/uip/sortm.c index 5faec79..d483d86 100644 --- a/uip/sortm.c +++ b/uip/sortm.c @@ -160,7 +160,7 @@ main (int argc, char **argv) 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); }