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));
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);
/*
-**
+** Return a path name
*/
char *
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);
+ }
}
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)
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);