X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/05d8af21d26673279a1ca079ad9c6f301426fe0e..420e2298044905daba7dc2a670e0f62863a0c404:/uip/scansbr.c diff --git a/uip/scansbr.c b/uip/scansbr.c index 232a4190..f863e9b7 100644 --- a/uip/scansbr.c +++ b/uip/scansbr.c @@ -68,6 +68,7 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, char *scnmsg = NULL; FILE *scnout = NULL; char name[NAMESZ]; + int bufsz; static int rlwidth, slwidth; static size_t scanl_size; @@ -162,7 +163,8 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, * 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) { + bufsz = rlwidth; + if ((state = m_getfld (FLD, name, tmpbuf, &bufsz, inb)) == FILEEOF) { if (ferror(inb)) { advise("read", "unable to"); /* "read error" */ return SCNFAT; @@ -184,7 +186,8 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, } /* scan - main loop */ - for (compnum = 1; ; state = m_getfld (state, name, tmpbuf, rlwidth, inb)) { + for (compnum = 1; ; + bufsz = rlwidth, state = m_getfld (state, name, tmpbuf, &bufsz, inb)) { switch (state) { case FLD: case FLDPLUS: @@ -215,7 +218,8 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, } while (state == FLDPLUS) { - state = m_getfld (state, name, tmpbuf, rlwidth, inb); + bufsz = rlwidth; + state = m_getfld (state, name, tmpbuf, &bufsz, inb); if (outnum) FPUTS (tmpbuf); } @@ -229,8 +233,8 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, */ if ((i = strlen(tmpbuf)) < rlwidth) { - state = m_getfld (state, name, tmpbuf + i, - rlwidth - i, inb); + bufsz = rlwidth - i; + state = m_getfld (state, name, tmpbuf + i, &bufsz, inb); } if (! outnum) { @@ -264,7 +268,8 @@ body:; } while (state == BODY) { - state = m_getfld(state, name, tmpbuf, rlwidth, inb); + bufsz = rlwidth; + state = m_getfld(state, name, tmpbuf, &bufsz, inb); FPUTS(tmpbuf); } goto finished;