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 3920315..4d1feff 100644 (file)
@@ -24,8 +24,7 @@ m_draft(char *which)
        char *folder;
 
        cp = draftfolder;
        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));
 
        chdir(m_maildir(""));
        strncpy(buffer, m_maildir(folder), sizeof(buffer));
index b3a8fff..3dd552c 100644 (file)
@@ -100,7 +100,7 @@ expath(char *name, int type)
        char buffer[BUFSIZ];
 
        if (type == TSUBCWF) {
        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);
                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)
 */
 char *
 path(char *name, int type)
@@ -189,5 +189,12 @@ path(char *name, int type)
 char *
 pluspath(char *name)
 {
 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 f391f61..34e55ce 100644 (file)
@@ -128,10 +128,7 @@ main(int argc, char **argv)
                                if (!(cp = *argp++) || *cp == '-')
                                        adios(NULL, "missing argument to %s",
                                                        argp[-2]);
                                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)
                                continue;
                        case FILESW:
                                if (filep > NFOLDERS)
index 006cabe..8d10e5d 100644 (file)
@@ -199,8 +199,7 @@ main(int argc, char **argv)
                                                adios(NULL, "missing argument to %s", argp[-2]);
                                        dp = NULL;
                                        if (*cp == '@')
                                                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);
                                        if (fcc)
                                                fcc = add(", ", fcc);
                                        fcc = add(cp, fcc);