Removed LBL compile condition (format: addtoseq).
[mmh] / uip / scan.c
index 69c2da9..6881c34 100644 (file)
@@ -44,13 +44,6 @@ static struct swit switches[] = {
 
 
 /*
-** global for sbr/formatsbr.c - yech!
-*/
-#ifdef LBL
-extern struct msgs *fmt_current_folder;
-#endif
-
-/*
 ** prototypes
 */
 void clear_screen(void);  /* from termsbr.c */
@@ -204,7 +197,7 @@ main(int argc, char **argv)
        */
 
        if (!msgs.size)
-               app_msgarg(&msgs, "all");
+               app_msgarg(&msgs, seq_all);
        if (!folder)
                folder = getcurfol();
        maildir = toabsdir(folder);
@@ -231,43 +224,33 @@ main(int argc, char **argv)
        context_save();  /* save the context file */
 
        /*
-       ** Get the sequence number for each sequence
-       ** specified by Unseen-Sequence
+       ** Get the sequence number for each `unseen' sequence
        */
-       if ((cp = context_find(usequence)) && *cp) {
+       if (!(cp = context_find(usequence))) {
+               cp = seq_unseen;  /* use default, if not set */
+       }
+       if (*cp) {
                char **ap, *dp;
 
                dp = getcpy(cp);
                ap = brkstring(dp, " ", "\n");
-               for (i = 0; ap && *ap; i++, ap++)
+               for (i = 0; ap && *ap; i++, ap++) {
                        seqnum[i] = seq_getnum(mp, *ap);
-
+               }
                num_unseen_seq = i;
-               if (dp)
+               if (dp) {
                        free(dp);
+               }
        }
 
        ontty = isatty(fileno(stdout));
 
-#ifdef LBL
-       else
-               fmt_current_folder = mp;
-#endif
-
        for (msgnum = revflag ? mp->hghsel : mp->lowsel;
                 (revflag ? msgnum >= mp->lowsel : msgnum <= mp->hghsel);
                 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
+                               admonish(cp, "unable to open message");
                                continue;
                        }
 
@@ -301,11 +284,7 @@ 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;
                        }
                        hdrflag = 0;
@@ -315,10 +294,6 @@ main(int argc, char **argv)
                }
        }
 
-#ifdef LBL
-       seq_save(mp);  /* because formatsbr might have made changes */
-#endif
-
        folder_free(mp);  /* free folder/message structure */
        if (clearflag)
                clear_screen();