From: markus schnalke Date: Sat, 5 Nov 2011 17:40:23 +0000 (+0100) Subject: Improved pluspath() and used it instead of path() where appropriate. X-Git-Tag: mmh-thesis-end~474 X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=5bfae54a3c9f2be059454d04875ba66fcbf1e6d4;p=mmh Improved pluspath() and used it instead of path() where appropriate. --- diff --git a/sbr/m_draft.c b/sbr/m_draft.c index 3920315..4d1feff 100644 --- a/sbr/m_draft.c +++ b/sbr/m_draft.c @@ -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)); diff --git a/sbr/path.c b/sbr/path.c index b3a8fff..3dd552c 100644 --- a/sbr/path.c +++ b/sbr/path.c @@ -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); + } } diff --git a/uip/refile.c b/uip/refile.c index f391f61..34e55ce 100644 --- a/uip/refile.c +++ b/uip/refile.c @@ -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) diff --git a/uip/repl.c b/uip/repl.c index 006cabe..8d10e5d 100644 --- a/uip/repl.c +++ b/uip/repl.c @@ -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);