From: markus schnalke Date: Sat, 5 Nov 2011 16:56:07 +0000 (+0100) Subject: Introduced FDEF and FCUR for speaking arguments to getfolder(). X-Git-Tag: mmh-thesis-end~476 X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=097c84b61603c4a4c5837f3dcc09c30a1e751702;p=mmh Introduced FDEF and FCUR for speaking arguments to getfolder(). Maybe it would be better to two separate functions, but I cannot imagine good names for them ... :-( --- diff --git a/h/mh.h b/h/mh.h index 2e3be95..59b5c0f 100644 --- a/h/mh.h +++ b/h/mh.h @@ -257,6 +257,9 @@ extern char *msg_delim; /* .. */ #define TFILE 1 /* path() given a file */ #define TSUBCWF 2 /* path() given a @folder */ +#define FDEF 0 /* getfolder() want default */ +#define FCUR 1 /* getfolder() want current */ + #define OUTPUTLINELEN 72 /* default line length for headers */ /* diff --git a/sbr/m_maildir.c b/sbr/m_maildir.c index 95f72af..957e44b 100644 --- a/sbr/m_maildir.c +++ b/sbr/m_maildir.c @@ -66,7 +66,7 @@ exmaildir(char *folder) /* use current folder if none is specified */ if (folder == NULL) - folder = getfolder(1); + folder = getfolder(FCUR); if (!(*folder != '/' && strncmp(folder, CWD, NCWD) && strcmp(folder, DOT) && strcmp(folder, DOTDOT) diff --git a/sbr/path.c b/sbr/path.c index 8802eaa..b3a8fff 100644 --- a/sbr/path.c +++ b/sbr/path.c @@ -101,7 +101,8 @@ expath(char *name, int type) if (type == TSUBCWF) { /* @folder to +folder */ - snprintf(buffer, sizeof(buffer), "%s/%s", getfolder(1), name); + snprintf(buffer, sizeof(buffer), "%s/%s", + getfolder(FCUR), name); name = m_mailpath(buffer); packpath(name); snprintf(buffer, sizeof(buffer), "%s/", m_maildir("")); diff --git a/uip/anno.c b/uip/anno.c index b7c1563..3a0fa8c 100644 --- a/uip/anno.c +++ b/uip/anno.c @@ -213,7 +213,7 @@ main(int argc, char **argv) if (!msgs.size) app_msgarg(&msgs, "cur"); if (!folder) - folder = getfolder(1); + folder = getfolder(FCUR); maildir = m_maildir(folder); if (chdir(maildir) == NOTOK) diff --git a/uip/burst.c b/uip/burst.c index a8f42d0..032c5b5 100644 --- a/uip/burst.c +++ b/uip/burst.c @@ -118,7 +118,7 @@ main(int argc, char **argv) if (!msgp) msgs[msgp++] = "cur"; if (!folder) - folder = getfolder(1); + folder = getfolder(FCUR); maildir = m_maildir(folder); if (chdir(maildir) == NOTOK) diff --git a/uip/comp.c b/uip/comp.c index 7a49362..9f0929d 100644 --- a/uip/comp.c +++ b/uip/comp.c @@ -148,7 +148,7 @@ main(int argc, char **argv) if (!msg) msg = "cur"; if (!folder) - folder = getfolder(1); + folder = getfolder(FCUR); maildir = m_maildir(folder); if (chdir(maildir) == NOTOK) diff --git a/uip/dist.c b/uip/dist.c index 5ff0d6c..131cda9 100644 --- a/uip/dist.c +++ b/uip/dist.c @@ -166,7 +166,7 @@ main(int argc, char **argv) if (!msg) msg = "cur"; if (!folder) - folder = getfolder(1); + folder = getfolder(FCUR); maildir = m_maildir(folder); if (chdir(maildir) == NOTOK) diff --git a/uip/flist.c b/uip/flist.c index 4bf3f82..5d9dfcc 100644 --- a/uip/flist.c +++ b/uip/flist.c @@ -240,7 +240,7 @@ main(int argc, char **argv) free(path("./", TFOLDER)); /* get current folder */ - strncpy(curfolder, getfolder(1), sizeof(curfolder)); + strncpy(curfolder, getfolder(FCUR), sizeof(curfolder)); /* get nmh base directory */ nmhdir = m_maildir(""); diff --git a/uip/folder.c b/uip/folder.c index 25ab068..4fa9424 100644 --- a/uip/folder.c +++ b/uip/folder.c @@ -273,15 +273,15 @@ main(int argc, char **argv) } else { adios(NULL, "no other folder"); } - for (cp = getcpy(getfolder(1)); *ap; ap++) + for (cp = getcpy(getfolder(FCUR)); *ap; ap++) cp = add(*ap, add(" ", cp)); free(dp); context_replace(stack, cp); /* update folder stack */ } else { /* update folder stack */ context_replace(stack, (cp = context_find (stack)) ? - concat(getfolder(1), " ", cp, NULL) : - getcpy(getfolder(1))); + concat(getfolder(FCUR), " ", cp, NULL) : + getcpy(getfolder(FCUR))); } } @@ -320,7 +320,7 @@ main(int argc, char **argv) /* Listing the folder stack */ if (listsw) { - printf("%s", argfolder ? argfolder : getfolder(1)); + printf("%s", argfolder ? argfolder : getfolder(FCUR)); if ((cp = context_find(stack))) { dp = getcpy(cp); for (ap = brkstring(dp, " ", "\n"); *ap; ap++) diff --git a/uip/forw.c b/uip/forw.c index 13aaaa9..002bb67 100644 --- a/uip/forw.c +++ b/uip/forw.c @@ -265,7 +265,7 @@ main(int argc, char **argv) if (!msgp) msgs[msgp++] = "cur"; if (!folder) - folder = getfolder(1); + folder = getfolder(FCUR); maildir = m_maildir(folder); if (chdir(maildir) == NOTOK) diff --git a/uip/inc.c b/uip/inc.c index c06c57c..d23bf32 100644 --- a/uip/inc.c +++ b/uip/inc.c @@ -303,7 +303,7 @@ main(int argc, char **argv) if (!context_find("path")) free(path("./", TFOLDER)); if (!folder) - folder = getfolder(0); + folder = getfolder(FDEF); maildir = m_maildir(folder); if ((maildir_copy = strdup(maildir)) == (char *)0) diff --git a/uip/mark.c b/uip/mark.c index fa5c2cb..d56a161 100644 --- a/uip/mark.c +++ b/uip/mark.c @@ -156,7 +156,7 @@ main(int argc, char **argv) if (!msgs.size) app_msgarg(&msgs, listsw ? "all" :"cur"); if (!folder) - folder = getfolder(1); + folder = getfolder(FCUR); maildir = m_maildir(folder); if (chdir(maildir) == NOTOK) diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c index 23163f7..94c1ce7 100644 --- a/uip/mhbuildsbr.c +++ b/uip/mhbuildsbr.c @@ -721,7 +721,7 @@ use_forw: /* else, use the current folder */ if (!folder) - folder = add(getfolder(1), NULL); + folder = add(getfolder(FCUR), NULL); if (!(mp = folder_read(folder))) adios(NULL, "unable to read folder %s", folder); diff --git a/uip/mhlist.c b/uip/mhlist.c index f33e39b..5eb0937 100644 --- a/uip/mhlist.c +++ b/uip/mhlist.c @@ -291,7 +291,7 @@ do_cache: if (!msgs.size) app_msgarg(&msgs, "cur"); if (!folder) - folder = getfolder(1); + folder = getfolder(FCUR); maildir = m_maildir(folder); if (chdir(maildir) == NOTOK) diff --git a/uip/mhpath.c b/uip/mhpath.c index bce976d..2281ba0 100644 --- a/uip/mhpath.c +++ b/uip/mhpath.c @@ -72,7 +72,7 @@ main(int argc, char **argv) free(path("./", TFOLDER)); if (!folder) - folder = getfolder(1); + folder = getfolder(FCUR); maildir = m_maildir(folder); /* If no messages are given, print folder pathname */ diff --git a/uip/mhshow.c b/uip/mhshow.c index ba5c037..bb7a8e7 100644 --- a/uip/mhshow.c +++ b/uip/mhshow.c @@ -363,7 +363,7 @@ do_cache: if (!msgs.size) app_msgarg(&msgs, "cur"); if (!folder) - folder = getfolder(1); + folder = getfolder(FCUR); maildir = m_maildir(folder); if (chdir(maildir) == NOTOK) diff --git a/uip/mhstore.c b/uip/mhstore.c index 7be9163..f61a5c0 100644 --- a/uip/mhstore.c +++ b/uip/mhstore.c @@ -306,7 +306,7 @@ do_cache: if (!msgs.size) app_msgarg(&msgs, "cur"); if (!folder) - folder = getfolder(1); + folder = getfolder(FCUR); maildir = m_maildir(folder); if (chdir(maildir) == NOTOK) diff --git a/uip/mhstoresbr.c b/uip/mhstoresbr.c index 027dac6..0fa70ca 100644 --- a/uip/mhstoresbr.c +++ b/uip/mhstoresbr.c @@ -556,7 +556,7 @@ store_content(CT ct, CT p) if (cp[1]) folder = pluspath(cp); else - folder = getfolder(1); + folder = getfolder(FCUR); /* Check if folder exists */ create_folder(m_mailpath(folder), 0, exit); diff --git a/uip/mhtest.c b/uip/mhtest.c index 17ca1ab..581349f 100644 --- a/uip/mhtest.c +++ b/uip/mhtest.c @@ -284,7 +284,7 @@ do_cache: if (!msgs.size) app_msgarg(&msgs, "cur"); if (!folder) - folder = getfolder(1); + folder = getfolder(FCUR); maildir = m_maildir(folder); if (chdir(maildir) == NOTOK) diff --git a/uip/packf.c b/uip/packf.c index d4df05c..727298c 100644 --- a/uip/packf.c +++ b/uip/packf.c @@ -128,7 +128,7 @@ main(int argc, char **argv) app_msgarg(&msgs, "all"); if (!folder) - folder = getfolder(1); + folder = getfolder(FCUR); maildir = m_maildir(folder); if (chdir(maildir) == NOTOK) diff --git a/uip/pick.c b/uip/pick.c index 93a2400..69b9415 100644 --- a/uip/pick.c +++ b/uip/pick.c @@ -199,7 +199,7 @@ main(int argc, char **argv) app_msgarg(&msgs, "all"); if (!folder) - folder = getfolder(1); + folder = getfolder(FCUR); maildir = m_maildir(folder); if (chdir(maildir) == NOTOK) diff --git a/uip/rcvstore.c b/uip/rcvstore.c index 06b8b69..a120c66 100644 --- a/uip/rcvstore.c +++ b/uip/rcvstore.c @@ -149,7 +149,7 @@ main(int argc, char **argv) /* if no folder is given, use default folder */ if (!folder) - folder = getfolder(0); + folder = getfolder(FDEF); maildir = m_maildir(folder); /* check if folder exists */ diff --git a/uip/refile.c b/uip/refile.c index a79e8be..f391f61 100644 --- a/uip/refile.c +++ b/uip/refile.c @@ -192,7 +192,7 @@ main(int argc, char **argv) if (!msgs.size) app_msgarg(&msgs, "cur"); if (!folder) - folder = getfolder(1); + folder = getfolder(FCUR); strncpy(maildir, m_maildir(folder), sizeof(maildir)); if (chdir(maildir) == NOTOK) diff --git a/uip/repl.c b/uip/repl.c index 61ba08c..006cabe 100644 --- a/uip/repl.c +++ b/uip/repl.c @@ -310,7 +310,7 @@ main(int argc, char **argv) if (!msg) msg = "cur"; if (!folder) - folder = getfolder(1); + folder = getfolder(FCUR); maildir = m_maildir(folder); if (chdir(maildir) == NOTOK) diff --git a/uip/rmf.c b/uip/rmf.c index 71fd017..94198d0 100644 --- a/uip/rmf.c +++ b/uip/rmf.c @@ -84,7 +84,7 @@ main(int argc, char **argv) if (!context_find("path")) free(path("./", TFOLDER)); if (!folder) { - folder = getfolder(1); + folder = getfolder(FCUR); defolder++; } if (strcmp(m_mailpath(folder), pwd()) == 0) @@ -100,9 +100,9 @@ main(int argc, char **argv) if (cp > newfolder) *cp = '\0'; else - strncpy(newfolder, getfolder(0), sizeof(newfolder)); + strncpy(newfolder, getfolder(FDEF), sizeof(newfolder)); } else { - strncpy(newfolder, getfolder(0), sizeof(newfolder)); + strncpy(newfolder, getfolder(FDEF), sizeof(newfolder)); } if (interactive) { diff --git a/uip/rmm.c b/uip/rmm.c index 7f77340..aca436a 100644 --- a/uip/rmm.c +++ b/uip/rmm.c @@ -83,7 +83,7 @@ main(int argc, char **argv) if (!msgs.size) app_msgarg(&msgs, "cur"); if (!folder) - folder = getfolder(1); + folder = getfolder(FCUR); maildir = m_maildir(folder); if (chdir(maildir) == NOTOK) diff --git a/uip/scan.c b/uip/scan.c index b42d8a2..4b0b338 100644 --- a/uip/scan.c +++ b/uip/scan.c @@ -207,7 +207,7 @@ main(int argc, char **argv) if (!msgs.size) app_msgarg(&msgs, "all"); if (!folder) - folder = getfolder(1); + folder = getfolder(FCUR); maildir = m_maildir(folder); if (chdir(maildir) == NOTOK) diff --git a/uip/show.c b/uip/show.c index b19f762..ceb9018 100644 --- a/uip/show.c +++ b/uip/show.c @@ -206,7 +206,7 @@ usage: } if (!folder) - folder = getfolder(1); + folder = getfolder(FCUR); maildir = m_maildir(folder); if (chdir(maildir) == NOTOK) diff --git a/uip/sortm.c b/uip/sortm.c index ffe14f8..5151889 100644 --- a/uip/sortm.c +++ b/uip/sortm.c @@ -171,7 +171,7 @@ main(int argc, char **argv) if (!datesw) datesw = "date"; if (!folder) - folder = getfolder(1); + folder = getfolder(FCUR); maildir = m_maildir(folder); if (chdir(maildir) == NOTOK)