]> git.marmaro.de Git - mmh/commitdiff
Improved pluspath() and used it instead of path() where appropriate.
authormarkus schnalke <meillo@marmaro.de>
Sat, 5 Nov 2011 17:40:23 +0000 (18:40 +0100)
committermarkus schnalke <meillo@marmaro.de>
Sat, 5 Nov 2011 17:40:23 +0000 (18:40 +0100)
sbr/m_draft.c
sbr/path.c
uip/refile.c
uip/repl.c

index 39203157ffdbcff9b1b0f60268aa5a121ceeded5..4d1feffbdf82597b6e52148594230b86b3f54f61 100644 (file)
@@ -24,8 +24,7 @@ m_draft(char *which)
        char *folder;
 
        cp = draftfolder;
-       folder = path(*cp == '+' || *cp == '@' ? cp + 1 : cp,
-                       *cp != '@' ? TFOLDER : TSUBCWF);
+       folder = pluspath(cp);
 
        chdir(m_maildir(""));
        strncpy(buffer, m_maildir(folder), sizeof(buffer));
index b3a8fff58ac81de6ace96c9c331ab243626fb267..3dd552c146a2115b3ffe0a2d48392ed88a908b34 100644 (file)
@@ -100,7 +100,7 @@ expath(char *name, int type)
        char buffer[BUFSIZ];
 
        if (type == TSUBCWF) {
-               /* @folder to +folder */
+               /* convert TSUBCWF to TFOLDER */
                snprintf(buffer, sizeof(buffer), "%s/%s",
                                getfolder(FCUR), name);
                name = m_mailpath(buffer);
@@ -166,7 +166,7 @@ expath(char *name, int type)
 
 
 /*
-**
+** Return a path name
 */
 char *
 path(char *name, int type)
@@ -189,5 +189,12 @@ path(char *name, int type)
 char *
 pluspath(char *name)
 {
-       return path(name+1, (*name == '+') ? TFOLDER : TSUBCWF);
+       switch (*name) {
+       case '+':
+               return path(name+1, TFOLDER);
+       case '@':
+               return path(name+1, TSUBCWF);
+       default:
+               return path(name, TFILE);
+       }
 }
index f391f617f95bfd74fef6325e8bb2e22025887e4e..34e55ce1ff006ed2cb320c764764e3867a6eaeb8 100644 (file)
@@ -128,10 +128,7 @@ main(int argc, char **argv)
                                if (!(cp = *argp++) || *cp == '-')
                                        adios(NULL, "missing argument to %s",
                                                        argp[-2]);
-                               folder = path(*cp == '+' || *cp == '@' ?
-                                               cp + 1 : cp,
-                                               *cp != '@' ?
-                                               TFOLDER : TSUBCWF);
+                               folder = pluspath(cp);
                                continue;
                        case FILESW:
                                if (filep > NFOLDERS)
index 006cabea96f17a251f066a3d5c660e1be15692ed..8d10e5d7ec58255ffb09b8cb81d949fd5ca795eb 100644 (file)
@@ -199,8 +199,7 @@ main(int argc, char **argv)
                                                adios(NULL, "missing argument to %s", argp[-2]);
                                        dp = NULL;
                                        if (*cp == '@')
-                                               cp = dp = path(cp + 1,
-                                                               TSUBCWF);
+                                               cp = dp = pluspath(cp);
                                        if (fcc)
                                                fcc = add(", ", fcc);
                                        fcc = add(cp, fcc);