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] [msgs] [switches]", invo_name);
- print_help(buf, switches, 1);
- done(1);
- case VERSIONSW:
- print_version(invo_name);
- done(1);
-
- case CLRSW:
- clearflag++;
- continue;
- case NCLRSW:
- clearflag = 0;
- continue;
-
- case FORMSW:
- if (!(form = *argp++) || *form == '-')
- adios(NULL, "missing argument to %s", argp[-2]);
- format = NULL;
- continue;
- case FMTSW:
- if (!(format = *argp++) ||
- *format == '-')
- adios(NULL, "missing argument to %s", argp[-2]);
- form = NULL;
- continue;
-
- case HEADSW:
- hdrflag++;
- continue;
- case NHEADSW:
- hdrflag = 0;
- continue;
-
- case WIDTHSW:
- if (!(cp = *argp++) || *cp == '-')
- adios(NULL, "missing argument to %s", argp[-2]);
- width = atoi(cp);
- continue;
- case REVSW:
- revflag++;
- continue;
- case NREVSW:
- revflag = 0;
- continue;
-
- case FILESW:
- if (!(cp = *argp++) || (cp[0] == '-' && cp[1]))
- adios(NULL, "missing argument to %s", argp[-2]);
- if (strcmp(file = cp, "-"))
- file = path(cp, TFILE);
- continue;
+ case AMBIGSW:
+ ambigsw(cp, switches);
+ done(1);
+ case UNKWNSW:
+ adios(NULL, "-%s unknown", cp);
+
+ case HELPSW:
+ snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
+ print_help(buf, switches, 1);
+ done(1);
+ case VERSIONSW:
+ print_version(invo_name);
+ done(1);
+
+ case CLRSW:
+ clearflag++;
+ continue;
+ case NCLRSW:
+ clearflag = 0;
+ continue;
+
+ case FORMSW:
+ if (!(form = *argp++) || *form == '-')
+ adios(NULL, "missing argument to %s",
+ argp[-2]);
+ format = NULL;
+ continue;
+ case FMTSW:
+ if (!(format = *argp++) || *format == '-')
+ adios(NULL, "missing argument to %s",
+ argp[-2]);
+ form = NULL;
+ continue;
+
+ case HEADSW:
+ hdrflag++;
+ continue;
+ case NHEADSW:
+ hdrflag = 0;
+ continue;
+
+ case WIDTHSW:
+ if (!(cp = *argp++) || *cp == '-')
+ adios(NULL, "missing argument to %s",
+ argp[-2]);
+ width = atoi(cp);
+ continue;
+ case REVSW:
+ revflag++;
+ continue;
+ case NREVSW:
+ revflag = 0;
+ continue;
+
+ case FILESW:
+ if (!(cp = *argp++) || (cp[0] == '-' && cp[1]))
+ adios(NULL, "missing argument to %s",
+ argp[-2]);
+ if (strcmp(file = cp, "-")!=0)
+ file = getcpy(expanddir(cp));
+ continue;
}
}
if (*cp == '+' || *cp == '@') {
if (folder)
adios(NULL, "only one folder at a time!");
else
- folder = pluspath(cp);
+ folder = getcpy(expandfol(cp));
} else
- app_msgarg(&msgs, cp);
+ app_msgarg(&msgs, cp);
}
- if (!context_find("path"))
- free(path("./", TFOLDER));
-
/*
** Get new format string. Must be before chdir().
*/
if (strcmp(file, "-") == 0) {
in = stdin;
file = "stdin";
- } else {
- if ((in = fopen(file, "r")) == NULL)
- adios(file, "unable to open");
+ } else if (!(in = fopen(file, "r"))) {
+ adios(file, "unable to open");
}
#ifndef JLR
if (!msgs.size)
app_msgarg(&msgs, "all");
if (!folder)
- folder = getfolder(FCUR);
- maildir = m_maildir(folder);
+ folder = getcurfol();
+ maildir = toabsdir(folder);
if (chdir(maildir) == NOTOK)
adios(maildir, "unable to change directory to");
done(1);
seq_setprev(mp); /* set the Previous-Sequence */
- context_replace(pfolder, folder); /* update current folder */
+ context_replace(curfolder, folder); /* update current folder */
seq_save(mp); /* synchronize message sequences */
context_save(); /* save the context file */
switch (state = scan(in, msgnum, 0, nfs, width,
msgnum == mp->curmsg, unseen,
folder, 0L, 1)) {
- case SCNMSG:
- case SCNENC:
- case SCNERR:
- break;
+ case SCNMSG:
+ case SCNENC:
+ case SCNERR:
+ break;
- default:
- adios(NULL, "scan() botch(%d)", state);
+ default:
+ adios(NULL, "scan() botch(%d)", state);
- case SCNEOF:
+ case SCNEOF:
#if 0
- printf("%*d empty\n", DMAXFOLDER,
- msgnum);
+ printf("%*d empty\n", DMAXFOLDER, msgnum);
#else
- advise(NULL, "message %d: empty",
- msgnum);
+ advise(NULL, "message %d: empty", msgnum);
#endif
- break;
+ break;
}
hdrflag = 0;
fclose(in);