X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/0569d6d1631dc90d4f2f2df6bdd0599c7ecc7814..8664e81329d0811d0b0f35521a850b74ac276da3:/uip/scan.c diff --git a/uip/scan.c b/uip/scan.c index 05f8bf88..06b12c62 100644 --- a/uip/scan.c +++ b/uip/scan.c @@ -2,8 +2,6 @@ /* * scan.c -- display a one-line "scan" listing of folder or messages * - * $Id$ - * * This code is Copyright (c) 2002, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for * complete copyright information. @@ -53,6 +51,8 @@ static struct swit switches[] = { extern struct msgs *fmt_current_folder; #endif +extern m_getfld_state_t gstate; + /* * prototypes */ @@ -101,10 +101,10 @@ main (int argc, char **argv) snprintf (buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name); print_help (buf, switches, 1); - done (1); + done (0); case VERSIONSW: print_version(invo_name); - done (1); + done (0); case CLRSW: clearflag++; @@ -186,19 +186,19 @@ main (int argc, char **argv) adios (file, "unable to open"); } -#ifndef JLR if (hdrflag) { printf ("FOLDER %s\t%s\n", file, dtimenow (1)); } -#endif /* JLR */ - m_unknown (in); + m_getfld_state_init (&gstate); + m_unknown (gstate, in); for (msgnum = 1; ; ++msgnum) { state = scan (in, msgnum, -1, nfs, width, 0, 0, hdrflag ? file : NULL, 0L, 1); if (state != SCNMSG && state != SCNENC) break; } + m_getfld_state_destroy (&gstate); fclose (in); done (0); } @@ -263,22 +263,13 @@ main (int argc, char **argv) msgnum += (revflag ? -1 : 1)) { if (is_selected(mp, msgnum)) { if ((in = fopen (cp = m_name (msgnum), "r")) == NULL) { -#if 0 - if (errno != EACCES) -#endif admonish (cp, "unable to open message"); -#if 0 - else - printf ("%*d unreadable\n", DMAXFOLDER, msgnum); -#endif continue; } -#ifndef JLR if (hdrflag) { printf ("FOLDER %s\t%s\n", folder, dtimenow(1)); } -#endif /* JLR */ /* * Check if message is in any sequence given @@ -292,6 +283,7 @@ main (int argc, char **argv) } } + m_getfld_state_init (&gstate); switch (state = scan (in, msgnum, 0, nfs, width, msgnum == mp->curmsg, unseen, folder, 0L, 1)) { @@ -304,19 +296,17 @@ main (int argc, char **argv) adios (NULL, "scan() botch (%d)", state); case SCNEOF: -#if 0 - printf ("%*d empty\n", DMAXFOLDER, msgnum); -#else advise (NULL, "message %d: empty", msgnum); -#endif break; } + m_getfld_state_destroy (&gstate); hdrflag = 0; fclose (in); if (ontty) fflush (stdout); } } + m_getfld_state_destroy (&gstate); #ifdef LBL seq_save (mp); /* because formatsbr might have made changes */ @@ -326,5 +316,6 @@ main (int argc, char **argv) if (clearflag) clear_screen (); - return done (0); + done (0); + return 1; }