#ifdef LOCALE
setlocale(LC_ALL, "");
#endif
- invo_name = r1bindex(argv[0], '/');
+ invo_name = mhbasename(argv[0]);
/* read user profile/context */
context_read();
while ((cp = *argp++)) {
if (*cp == '-') {
switch (smatch(++cp, switches)) {
- case AMBIGSW:
- ambigsw(cp, switches);
- done(1);
- case UNKWNSW:
- adios(NULL, "-%s unknown", cp);
-
- case HELPSW:
- snprintf(buf, sizeof(buf), "%s [+folder] [msg] [switches]", invo_name);
- print_help(buf, switches, 1);
- done(1);
- case VERSIONSW:
- print_version(invo_name);
- done(1);
-
- case EDITRSW:
- if (!(ed = *argp++) || *ed == '-')
- adios(NULL, "missing argument to %s", argp[-2]);
- nedit = 0;
- continue;
- case NEDITSW:
- nedit++;
- continue;
-
- case WHATSW:
- if (!(whatnowproc = *argp++) || *whatnowproc == '-')
- adios(NULL, "missing argument to %s", argp[-2]);
- nwhat = 0;
- continue;
- case NWHATSW:
- nwhat++;
- continue;
-
- case FORMSW:
- if (!(form = *argp++) || *form == '-')
- adios(NULL, "missing argument to %s", argp[-2]);
- continue;
-
- case USESW:
- use++;
- continue;
- case NUSESW:
- use = NOUSE;
- continue;
+ case AMBIGSW:
+ ambigsw(cp, switches);
+ done(1);
+ case UNKWNSW:
+ adios(NULL, "-%s unknown", cp);
+
+ case HELPSW:
+ snprintf(buf, sizeof(buf), "%s [+folder] [msg] [switches]", invo_name);
+ print_help(buf, switches, 1);
+ done(1);
+ case VERSIONSW:
+ print_version(invo_name);
+ done(1);
+
+ case EDITRSW:
+ if (!(ed = *argp++) || *ed == '-')
+ adios(NULL, "missing argument to %s", argp[-2]);
+ nedit = 0;
+ continue;
+ case NEDITSW:
+ nedit++;
+ continue;
+
+ case WHATSW:
+ if (!(whatnowproc = *argp++) || *whatnowproc == '-')
+ adios(NULL, "missing argument to %s", argp[-2]);
+ nwhat = 0;
+ continue;
+ case NWHATSW:
+ nwhat++;
+ continue;
+
+ case FORMSW:
+ if (!(form = *argp++) || *form == '-')
+ adios(NULL, "missing argument to %s", argp[-2]);
+ continue;
+
+ case USESW:
+ use++;
+ continue;
+ case NUSESW:
+ use = NOUSE;
+ continue;
}
}
if (*cp == '+' || *cp == '@') {
if (folder)
adios(NULL, "only one folder at a time!");
else
- folder = pluspath(cp);
+ folder = getcpy(expandfol(cp));
} else {
if (msg)
adios(NULL, "only one message at a time!");
cwd = getcpy(pwd());
- if (!context_find("path"))
- free(path("./", TFOLDER));
-
if (form && (folder || msg))
- adios(NULL, "can't mix forms and folders/msgs");
+ adios(NULL, "can't mix forms and folders/msgs");
if (!use && (folder || msg)) {
/*
if (!msg)
msg = "cur";
if (!folder)
- folder = getfolder(1);
- maildir = m_maildir(folder);
+ folder = getcurfol();
+ maildir = toabsdir(folder);
if (chdir(maildir) == NOTOK)
adios(maildir, "unable to change directory to");
if (!(argp = getans("\nDisposition? ", aqrunl)))
done(1);
switch (i = smatch(*argp, aqrunl)) {
- case NOSW:
- done(0);
- case NEWSW:
- use = NOUSE;
- goto try_it_again;
- case YESW:
- break;
- case USELSW:
- use++;
- goto edit_it;
- case LISTDSW:
- showfile(++argp, drft);
- break;
- case REFILSW:
- if (refile(++argp, drft) == 0)
- i = YESW;
- break;
- default:
- advise(NULL, "say what?");
- break;
+ case NOSW:
+ done(0);
+ case NEWSW:
+ use = NOUSE;
+ goto try_it_again;
+ case YESW:
+ break;
+ case USELSW:
+ use++;
+ goto edit_it;
+ case LISTDSW:
+ showfile(++argp, drft);
+ break;
+ case REFILSW:
+ if (refile(++argp, drft) == 0)
+ i = YESW;
+ break;
+ default:
+ advise(NULL, "say what?");
+ break;
}
}
} else if (use) {