int width = 0;
int i, state, msgnum;
int seqnum[NUMATTRS], unseen, num_unseen_seq = 0;
char *cp, *maildir, *file = NULL, *folder = NULL;
char *form = NULL, buf[BUFSIZ];
int width = 0;
int i, state, msgnum;
int seqnum[NUMATTRS], unseen, num_unseen_seq = 0;
char *cp, *maildir, *file = NULL, *folder = NULL;
char *form = NULL, buf[BUFSIZ];
case HELPSW:
snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
print_help(buf, switches, 1);
case HELPSW:
snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
print_help(buf, switches, 1);
- /*
- ** Get new format string. Must be before chdir().
- */
- nfs = new_fs(form, FORMAT);
+ /* Set format string. Must be before chdir(). */
+ fmtstr = new_fs(form, scanformat);
/* check if "file" is really stdin */
if (strcmp(file, "-") == 0) {
in = stdin;
file = "stdin";
} else if (!(in = fopen(file, "r"))) {
/* check if "file" is really stdin */
if (strcmp(file, "-") == 0) {
in = stdin;
file = "stdin";
} else if (!(in = fopen(file, "r"))) {
- state = scan(in, msgnum, -1, nfs, width, 0, 0,
- NULL, 0L, 1);
- if (state != SCNMSG && state != SCNENC)
+ state = scan(in, msgnum, SCN_MBOX, fmtstr, width, 0, 0);
+ if (state != SCNMSG)
- adios(NULL, "unable to read folder %s", folder);
+ adios(EX_IOERR, NULL, "unable to read folder %s", folder);
/* parse all the message ranges/sequences and set SELECTED */
for (msgnum = 0; msgnum < msgs.size; msgnum++)
if (!m_convert(mp, msgs.msgs[msgnum]))
/* parse all the message ranges/sequences and set SELECTED */
for (msgnum = 0; msgnum < msgs.size; msgnum++)
if (!m_convert(mp, msgs.msgs[msgnum]))
- context_replace(curfolder, folder); /* update current folder */
- seq_save(mp); /* synchronize message sequences */
- context_save(); /* save the context file */
+ context_replace(curfolder, folder);
+ seq_save(mp);
+ context_save();
ap = brkstring(dp, " ", "\n");
for (i = 0; ap && *ap; i++, ap++) {
seqnum[i] = seq_getnum(mp, *ap);
}
num_unseen_seq = i;
if (dp) {
ap = brkstring(dp, " ", "\n");
for (i = 0; ap && *ap; i++, ap++) {
seqnum[i] = seq_getnum(mp, *ap);
}
num_unseen_seq = i;
if (dp) {
- if (is_selected(mp, msgnum)) {
- if ((in = fopen(cp = m_name(msgnum), "r")) == NULL) {
- admonish(cp, "unable to open message");
- continue;
- }
+ if (!is_selected(mp, msgnum)) {
+ continue;
+ }
- /*
- ** Check if message is in any sequence given
- ** by Unseen-Sequence profile entry.
- */
- unseen = 0;
- for (i = 0; i < num_unseen_seq; i++) {
- if (in_sequence(mp, seqnum[i], msgnum)) {
- unseen = 1;
- break;
- }
- }
+ if ((in = fopen(cp = m_name(msgnum), "r")) == NULL) {
+ admonish(cp, "unable to open message");
+ continue;
+ }
- switch (state = scan(in, msgnum, 0, nfs, width,
- msgnum == mp->curmsg, unseen,
- folder, 0L, 1)) {
- case SCNMSG:
- case SCNENC:
- case SCNERR:
+ /*
+ ** Check if message is in any sequence given
+ ** by Unseen-Sequence profile entry.
+ */
+ unseen = 0;
+ for (i = 0; i < num_unseen_seq; i++) {
+ if (in_sequence(mp, seqnum[i], msgnum)) {
+ unseen = 1;
- default:
- adios(NULL, "scan() botch(%d)", state);
+ switch (state = scan(in, msgnum, SCN_FOLD, fmtstr,
+ width, msgnum==mp->curmsg, unseen)) {
+ case SCNMSG:
+ case SCNERR:
+ break;
- case SCNEOF:
- advise(NULL, "message %d: empty", msgnum);
- break;
- }
- fclose(in);
- if (ontty)
- fflush(stdout);
+ default:
+ adios(EX_SOFTWARE, NULL, "scan() botch(%d)", state);
+
+ case SCNEOF:
+ advise(NULL, "message %d: empty", msgnum);
+ break;