1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-14 10:09:48 +00:00

Skip fields in the manner required by POSIX, and the way V7 did it.

MFC after:	1 week
This commit is contained in:
Tim J. Robbins 2002-06-21 07:59:31 +00:00
parent c1c9929e9f
commit 382ac430cd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=98547

View File

@ -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);
}