X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fscansbr.c;fp=uip%2Fscansbr.c;h=299027a99c1aaa535eb254db7c0ce0b663930181;hb=e51cee378fd6a0f8d6f3af2a125715036d1f2f8c;hp=9f6306d280facadf446250009da70aec30dc0b6a;hpb=5b7d1b7785d365515b0a9b5cfcb88d6b0e13ec51;p=mmh diff --git a/uip/scansbr.c b/uip/scansbr.c index 9f6306d..299027a 100644 --- a/uip/scansbr.c +++ b/uip/scansbr.c @@ -78,6 +78,7 @@ scan(FILE *inb, int innum, int outnum, char *fmtstr, int width, int curflg, char deliverydate[BUFSIZ]; int incing = (outnum > 0); int scanfolder = (outnum == 0); + long fpos; /* first-time only initialization */ if (!scanl) { @@ -122,6 +123,7 @@ scan(FILE *inb, int innum, int outnum, char *fmtstr, int width, int curflg, dat[0] = innum ? innum : outnum; dat[1] = curflg; dat[4] = unseen; + fpos = ftell(inb); /* ** Get the first field. If the message is non-empty @@ -203,7 +205,16 @@ scan(FILE *inb, int innum, int outnum, char *fmtstr, int width, int curflg, case BODY: compnum = -1; if (!incing) { - state = FILEEOF; /* stop here if scan cmd */ + /* stop here if scan cmd */ + if (scanfolder) { + state = FILEEOF; + goto finished; + } + /* for mboxes: snarf the body */ + while (state == BODY) { + state = m_getfld(state, name, tmpbuf, + SBUFSIZ, inb); + } goto finished; } FPUTS("\n"); @@ -279,6 +290,10 @@ finished: if (incing) { if ((dat[2] = ftell(scnout)) == EOF) adios(scnmsg, "write error on"); + } else if (!scanfolder) { + if ((dat[2] = ftell(inb)) == EOF) + adios(scnmsg, "write error on"); + dat[2] -= fpos; } if ((datecomp && !datecomp->c_text) || scanfolder) {