X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/ecd50cc5f6c2a427e821483993678b78c94ffdfd..fcaa3047b2a23fc0c36be518d1ca1ea0b0cb3b66:/uip/scansbr.c?ds=inline diff --git a/uip/scansbr.c b/uip/scansbr.c index bbc5a168..b6df6830 100644 --- a/uip/scansbr.c +++ b/uip/scansbr.c @@ -5,20 +5,26 @@ * complete copyright information. */ -#include -#include -#include -#include -#include -#include -#include "../sbr/terminal.h" +#include "h/mh.h" +#include "sbr/dtime.h" +#include "scansbr.h" +#include "sbr/m_name.h" +#include "sbr/m_gmprot.h" +#include "sbr/m_getfld.h" +#include "sbr/getcpy.h" +#include "sbr/error.h" +#include "h/addrsbr.h" +#include "h/fmt_scan.h" +#include "h/tws.h" +#include "h/utils.h" +#include "sbr/terminal.h" static struct format *fmt; static struct comp *datecomp; /* pntr to "date" comp */ static struct comp *bodycomp; /* pntr to "body" pseudo-comp * * (if referenced) */ static int ncomps = 0; /* # of interesting components */ -static char **compbuffers = 0; /* buffers for component text */ +static char **compbuffers = 0; /* buffers for component text */ static struct comp **used_buf = 0; /* stack for comp that use buffers */ static int dat[5]; /* aux. data for format routine */ @@ -51,7 +57,7 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, { static bool deja_vu; static int tty_width; - int i, compnum, encrypted, state; + int i, compnum, state; char *cp, *tmpbuf, *startbody, **nxtbuf; char *saved_c_text = NULL; struct comp *cptr; @@ -90,9 +96,6 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, cptr = fmt_findcomp("folder"); if (cptr && folder) cptr->c_text = mh_xstrdup(folder); - if (fmt_addcompentry("encrypted")) { - ncomps++; - } cptr = fmt_findcomp("dtimenow"); if (cptr) cptr->c_text = getcpy(dtimenow (0)); @@ -224,7 +227,7 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, if (outnum == 0) { state = FILEEOF; /* stop now if scan cmd */ if (bodycomp && startbody == NULL) - startbody = tmpbuf; + startbody = tmpbuf; goto finished; } if (scnout) { @@ -263,7 +266,7 @@ body:; case LENERR: case FMTERR: - if (innum) + if (innum) fprintf (stderr, "??Format error (message %d) in ", outnum ? outnum : innum); else @@ -284,7 +287,7 @@ body:; goto finished; default: - adios (NULL, "getfld() returned %d", state); + die("getfld() returned %d", state); } } @@ -337,9 +340,6 @@ finished: if (noisy) fputs (charstring_buffer (*scanl), stdout); - cptr = fmt_findcomp ("encrypted"); - encrypted = cptr && cptr->c_text; - /* return dynamically allocated buffers to pool */ while ((cptr = *savecomp++)) { cptr->c_text = NULL; @@ -348,17 +348,19 @@ finished: if (scnout && (ferror(scnout) || fclose (scnout) == EOF)) DIEWRERR(); - return (state != FILEEOF ? SCNERR : encrypted ? SCNENC : SCNMSG); + return state != FILEEOF ? SCNERR : SCNMSG; } /* The following two functions allow access to the global gstate above. */ void -scan_finished(void) { +scan_finished(void) +{ m_getfld_state_destroy (&gstate); } void -scan_detect_mbox_style (FILE *f) { +scan_detect_mbox_style (FILE *f) +{ m_unknown (&gstate, f); }