projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
scansbr: Fixed scan and inc.
[mmh]
/
uip
/
scansbr.c
diff --git
a/uip/scansbr.c
b/uip/scansbr.c
index
9f6306d
..
299027a
100644
(file)
--- 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);
char deliverydate[BUFSIZ];
int incing = (outnum > 0);
int scanfolder = (outnum == 0);
+ long fpos;
/* first-time only initialization */
if (!scanl) {
/* 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;
dat[0] = innum ? innum : outnum;
dat[1] = curflg;
dat[4] = unseen;
+ fpos = ftell(inb);
/*
** Get the first field. If the message is non-empty
/*
** 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) {
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");
goto finished;
}
FPUTS("\n");
@@
-279,6
+290,10
@@
finished:
if (incing) {
if ((dat[2] = ftell(scnout)) == EOF)
adios(scnmsg, "write error on");
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) {
}
if ((datecomp && !datecomp->c_text) || scanfolder) {