- int i, compnum, encrypted, state;
- unsigned char *cp, *tmpbuf;
- char **nxtbuf;
- char *saved_c_text = NULL;
- struct comp *cptr;
- struct comp **savecomp;
- char *scnmsg = NULL;
- FILE *scnout = NULL;
- 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) SCAN_CHARWIDTH * (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++;
- }
- FINDCOMP (cptr, "dtimenow");
- if (cptr)
- cptr->c_text = getcpy(dtimenow (0));
- nxtbuf = compbuffers = (char **) calloc((size_t) ncomps, sizeof(char *));
- if (nxtbuf == NULL)
- adios (NULL, "unable to allocate component buffers");
- used_buf = (struct comp **) calloc((size_t) (ncomps+1),
- sizeof(struct comp *));
- if (used_buf == NULL)
- adios (NULL, "unable to allocate component buffer stack");
- used_buf += ncomps+1; *--used_buf = 0;
- rlwidth = bodycomp && (width > SBUFSIZ) ? width : SBUFSIZ;
- for (i = ncomps; i--; )
- *nxtbuf++ = mh_xmalloc(rlwidth);
- }
-
- /*
- * each-message initialization
- */
- nxtbuf = compbuffers;
- savecomp = used_buf;
- tmpbuf = *nxtbuf++;
- dat[0] = innum ? innum : outnum;
- dat[1] = curflg;
- dat[4] = unseen;
-
- /*
- * Get the first field. If the message is non-empty
- * and we're doing an "inc", open the output file.
- */
- if ((state = m_getfld (FLD, name, tmpbuf, rlwidth, inb)) == FILEEOF) {
- if (ferror(inb)) {
- advise("read", "unable to"); /* "read error" */
- return SCNFAT;
- } else {
- return SCNEOF;
+ int i, compnum, state;
+ unsigned char *cp, *tmpbuf;
+ char **nxtbuf;
+ char *saved_c_text = NULL;
+ struct comp *cptr;
+ struct comp **savecomp;
+ char *scnmsg = NULL;
+ FILE *scnout = NULL;
+ char name[NAMESZ];
+ static int rlwidth, slwidth;
+ char returnpath[BUFSIZ];
+ char deliverydate[BUFSIZ];
+
+ /* 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) SCAN_CHARWIDTH *
+ (slwidth + 2) );
+ if (outnum)
+ umask(~m_gmprot());
+
+ /* Compile format string */
+ ncomps = fmt_compile(fmtstr, &fmt) + 1;
+
+ FINDCOMP(bodycomp, "body");
+ FINDCOMP(datecomp, "date");
+ nxtbuf = compbuffers = (char **) calloc((size_t) ncomps,
+ sizeof(char *));
+ if (nxtbuf == NULL)
+ adios(NULL, "unable to allocate component buffers");
+ used_buf = (struct comp **) calloc((size_t) (ncomps+1),
+ sizeof(struct comp *));
+ if (used_buf == NULL)
+ adios(NULL, "unable to allocate component buffer stack");
+ used_buf += ncomps+1; *--used_buf = 0;
+ rlwidth = bodycomp && (width > SBUFSIZ) ? width : SBUFSIZ;
+ for (i = ncomps; i--; )
+ *nxtbuf++ = mh_xmalloc(rlwidth);