- int i, compnum, encrypted, state;
- char *cp, *tmpbuf, **nxtbuf;
- char *saved_c_text;
- struct comp *cptr;
- struct comp **savecomp;
- char *scnmsg;
- FILE *scnout;
- char name[NAMESZ];
- static int rlwidth, slwidth;
-
-#ifdef RPATHS
- char returnpath[BUFSIZ];
- char deliverydate[BUFSIZ];
-#endif
-
- /* first-time only initialization */
- if (!scanl) {
- if (width == 0) {
- if ((width = sc_width ()) < WIDTH/2)
- width = WIDTH/2;
- else if (width > MAXSCANL)
- width = MAXSCANL;
- }
- dat[3] = slwidth = width;
- scanl = (char *) mh_xmalloc((size_t) MB_CUR_MAX * (slwidth + 2) );
- if (outnum)
- umask(~m_gmprot());
-
- /* Compile format string */
- ncomps = fmt_compile (nfs, &fmt) + 1;
-
-#ifdef JLR
- fmt_top = fmt;
-#endif /* JLR */
- FINDCOMP(bodycomp, "body");
- FINDCOMP(datecomp, "date");
- FINDCOMP(cptr, "folder");
- if (cptr && folder)
- cptr->c_text = folder;
- FINDCOMP(cptr, "encrypted");
- if (!cptr)
- if ((cptr = (struct comp *) calloc (1, sizeof(*cptr)))) {
- cptr->c_name = "encrypted";
- cptr->c_next = wantcomp[i = CHASH (cptr->c_name)];
- wantcomp[i] = cptr;
- ncomps++;
+ static int slwidth;
+ int compnum, i;
+ enum state state;
+ struct field f = {{0}};
+ char *cp;
+ struct comp *cptr;
+ char *scnmsg = NULL;
+ FILE *scnout = NULL;
+ int incing = (outnum != SCN_MBOX && outnum != SCN_FOLD);
+ int scanfolder = (outnum == SCN_FOLD);
+ long fpos;
+ struct stat st;
+ int blankline;
+
+ /* first-time only initialization */
+ if (!scanl) {
+ if (incing)
+ umask(~m_gmprot());
+
+ if (fmtstr) {
+ if (width == 0) {
+ if ((width = sc_width()) < WIDTH/2)
+ width = WIDTH/2;
+ else if (width > MAXSCANL)
+ width = MAXSCANL;
+ }
+ dat[3] = slwidth = width;
+ scanl = mh_xcalloc(slwidth + 2, SCAN_CHARWIDTH); /* probably for \n and \0 */
+ /* Compile format string */
+ ncomps = fmt_compile(fmtstr, &fmt) + 1;
+ FINDCOMP(datecomp, "date");
+ } else {
+ ncomps = 1;
+ datecomp = NULL;
+ }