Skip fields in the manner required by POSIX, and the way V7 did it.
MFC after: 1 week
This commit is contained in:
parent
c1c9929e9f
commit
382ac430cd
@ -208,16 +208,14 @@ char *
|
||||
skip(str)
|
||||
register char *str;
|
||||
{
|
||||
register int infield, nchars, nfields;
|
||||
register int nchars, nfields;
|
||||
|
||||
for (nfields = numfields, infield = 0; nfields && *str; ++str)
|
||||
if (isblank((unsigned char)*str)) {
|
||||
if (infield) {
|
||||
infield = 0;
|
||||
--nfields;
|
||||
}
|
||||
} else if (!infield)
|
||||
infield = 1;
|
||||
for (nfields = 0; *str != '\0' && nfields++ != numfields; ) {
|
||||
while (isblank((unsigned char)*str))
|
||||
str++;
|
||||
while (*str != '\0' && !isblank((unsigned char)*str))
|
||||
str++;
|
||||
}
|
||||
for (nchars = numchars; nchars-- && *str; ++str);
|
||||
return(str);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user