#include <h/tws.h>
#include <h/utils.h>
+m_getfld_state_t gstate;
+
#define MAXSCANL 256 /* longest possible scan line */
/*
* and we're doing an "inc", open the output file.
*/
bufsz = rlwidth;
- if ((state = m_getfld (FLD, name, tmpbuf, &bufsz, inb)) == FILEEOF) {
+ m_getfld_state_reset (&gstate);
+ if ((state = m_getfld (&gstate, name, tmpbuf, &bufsz, inb)) == FILEEOF) {
if (ferror(inb)) {
advise("read", "unable to"); /* "read error" */
return SCNFAT;
/* scan - main loop */
for (compnum = 1; ;
- bufsz = rlwidth, state = m_getfld (state, name, tmpbuf, &bufsz, inb)) {
+ bufsz = rlwidth, state = m_getfld (&gstate, name, tmpbuf, &bufsz, inb)) {
switch (state) {
case FLD:
case FLDPLUS:
while (state == FLDPLUS) {
bufsz = rlwidth;
- state = m_getfld (state, name, tmpbuf, &bufsz, inb);
+ state = m_getfld (&gstate, name, tmpbuf, &bufsz, inb);
if (outnum)
FPUTS (tmpbuf);
}
if ((i = strlen(tmpbuf)) < rlwidth) {
bufsz = rlwidth - i;
- state = m_getfld (state, name, tmpbuf + i, &bufsz, inb);
+ state = m_getfld (&gstate, name, tmpbuf + i, &bufsz, inb);
}
if (! outnum) {
while (state == BODY) {
bufsz = rlwidth;
- state = m_getfld(state, name, tmpbuf, &bufsz, inb);
+ state = m_getfld (&gstate, name, tmpbuf, &bufsz, inb);
FPUTS(tmpbuf);
}
goto finished;