diff -c h/fmt_compile.h.virgin h/fmt_compile.h *** h/fmt_compile.h.virgin Fri Apr 30 11:08:34 1999 --- h/fmt_compile.h Sun Jul 13 12:49:29 2003 *************** *** 82,88 **** #define FT_FORMATADDR 66 /* let external routine format addr */ #define FT_MYMBOX 67 /* do "mymbox" test on comp */ ! /* misc. */ /* ADDTOSEQ only works if you include "options LBL" */ #define FT_ADDTOSEQ 68 /* add current msg to a sequence */ /* conditionals & control flow (must be last) */ --- 82,88 ---- #define FT_FORMATADDR 66 /* let external routine format addr */ #define FT_MYMBOX 67 /* do "mymbox" test on comp */ ! /* misc. */ #define FT_ADDTOSEQ 68 /* add current msg to a sequence */ /* conditionals & control flow (must be last) */ diff -c sbr/fmt_scan.c.virgin sbr/fmt_scan.c *** sbr/fmt_scan.c.virgin Sun Sep 26 10:45:56 1999 --- sbr/fmt_scan.c Sun Jul 13 12:29:59 2003 *************** *** 26,34 **** extern char *formataddr (); /* hook for custom address formatting */ - #ifdef LBL struct msgs *fmt_current_folder; /* current folder (set by main program) */ - #endif extern int fmt_norm; /* defined in sbr/fmt_def.c = AD_NAME */ struct mailname fmt_mnull; --- 26,32 ---- *************** *** 815,828 **** break; case FT_ADDTOSEQ: - #ifdef LBL /* If we're working on a folder (as opposed to a file), add the * current msg to sequence given in literal field. Don't * disturb string or value registers. */ if (fmt_current_folder) ! seq_addmsg(fmt_current_folder, fmt->f_text, dat[0], -1); ! #endif break; } fmt++; --- 813,824 ---- break; case FT_ADDTOSEQ: /* If we're working on a folder (as opposed to a file), add the * current msg to sequence given in literal field. Don't * disturb string or value registers. */ if (fmt_current_folder) ! seq_addmsg(fmt_current_folder, fmt->f_text, dat[0], -1, 0); break; } fmt++; diff -c uip/inc.c.virgin uip/inc.c *** uip/inc.c.virgin Fri Mar 17 12:11:04 2000 --- uip/inc.c Sun Jul 13 12:39:51 2003 *************** *** 116,121 **** --- 116,126 ---- extern int errno; /* + * global for sbr/fmt_scan.c - yech! + */ + extern struct msgs *fmt_current_folder; + + /* * flags for the mail source */ #define INC_FILE 0 *************** *** 477,482 **** --- 482,488 ---- /* read folder and create message structure */ if (!(mp = folder_read (folder))) adios (NULL, "unable to read folder %s", folder); + fmt_current_folder = mp; #ifdef POP go_to_it: *************** *** 584,592 **** * messages. If not, then realloc the folder and add enough * space for all new messages plus 10 additional slots. */ ! if (mp->hghmsg + nmsgs >= mp->hghoff ! && !(mp = folder_realloc (mp, mp->lowoff, mp->hghmsg + nmsgs + 10))) ! adios (NULL, "unable to allocate folder storage"); } for (i = 1; i <= nmsgs; i++) { --- 590,601 ---- * messages. If not, then realloc the folder and add enough * space for all new messages plus 10 additional slots. */ ! if (mp->hghmsg + nmsgs >= mp->hghoff) { ! if (!(mp = folder_realloc (mp, mp->lowoff, ! mp->hghmsg + nmsgs + 10))) ! adios (NULL, "unable to allocate folder storage"); ! fmt_current_folder = mp; ! } } for (i = 1; i <= nmsgs; i++) { *************** *** 701,711 **** * Check if we need to allocate more space for message status. * If so, then add space for an additional 100 messages. */ ! if (msgnum >= mp->hghoff ! && !(mp = folder_realloc (mp, mp->lowoff, mp->hghoff + 100))) { ! advise (NULL, "unable to allocate folder storage"); ! i = NOTOK; ! break; } #if 0 --- 710,722 ---- * Check if we need to allocate more space for message status. * If so, then add space for an additional 100 messages. */ ! if (msgnum >= mp->hghoff) { ! if (!(mp = folder_realloc (mp, mp->lowoff, mp->hghoff + 100))) { ! advise (NULL, "unable to allocate folder storage"); ! i = NOTOK; ! break; ! } ! fmt_current_folder = mp; } #if 0 *************** *** 722,730 **** newmsg = folder_addmsg(mp, tmpfilenam); #endif /* create scanline for new message */ ! switch (i = scan (in, msgnum + 1, msgnum + 1, nfs, width, ! msgnum == hghnum && chgflag, 1, NULL, 0L, noisy)) { case SCNFAT: case SCNEOF: break; --- 733,757 ---- newmsg = folder_addmsg(mp, tmpfilenam); #endif + /* message must exist during scan() for "addtoseq" to work */ + ++mp->hghmsg; + ++msgnum; + clear_msg_flags (mp, msgnum); + set_exists (mp, msgnum); + /* create scanline for new message */ ! i = scan (in, msgnum, msgnum, nfs, width, ! msgnum == hghnum && chgflag, 1, NULL, 0L, noisy); ! ! /* back out if there isn't really a new message */ ! if (i != SCNMSG && i != SCNENC) { ! clear_msg_flags (mp, msgnum); ! --mp->hghmsg; ! --msgnum; ! } ! ! switch (i) { ! case SCNFAT: case SCNEOF: break; *************** *** 754,763 **** if (noisy) fflush (stdout); - msgnum++; - mp->hghmsg++; - clear_msg_flags (mp, msgnum); - set_exists (mp, msgnum); set_unseen (mp, msgnum); mp->msgflags |= SEQMOD; continue; --- 781,786 ---- *************** *** 767,776 **** } #ifdef POP ! if (p < 0) { /* error */ #else ! if (i < 0) { /* error */ #endif if (locked) { #ifdef MAILGROUP /* Be sure we can unlock mail file */ --- 790,800 ---- } #ifdef POP ! if (p < 0) /* error */ #else ! if (i < 0) /* error */ #endif + { if (locked) { #ifdef MAILGROUP /* Be sure we can unlock mail file */ diff -c uip/scan.c.virgin uip/scan.c *** uip/scan.c.virgin Fri Feb 4 12:28:24 2000 --- uip/scan.c Sun Jul 13 12:43:31 2003 *************** *** 50,60 **** extern int errno; /* ! * global for sbr/formatsbr.c - yech! */ - #ifdef LBL extern struct msgs *fmt_current_folder; - #endif /* * prototypes --- 50,58 ---- extern int errno; /* ! * global for sbr/fmt_scan.c - yech! */ extern struct msgs *fmt_current_folder; /* * prototypes *************** *** 275,284 **** 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); --- 273,279 ---- ontty = isatty (fileno (stdout)); ! fmt_current_folder = mp; for (msgnum = revflag ? mp->hghsel : mp->lowsel; (revflag ? msgnum >= mp->lowsel : msgnum <= mp->hghsel); *************** *** 340,348 **** } } - #ifdef LBL seq_save (mp); /* because formatsbr might have made changes */ - #endif folder_free (mp); /* free folder/message structure */ if (clearflag) --- 335,341 ----