summaryrefslogtreecommitdiffstats
path: root/usr.bin/uniq/uniq.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/uniq/uniq.c')
-rw-r--r--usr.bin/uniq/uniq.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/usr.bin/uniq/uniq.c b/usr.bin/uniq/uniq.c
index 85733f0..c8bb5d4 100644
--- a/usr.bin/uniq/uniq.c
+++ b/usr.bin/uniq/uniq.c
@@ -208,16 +208,14 @@ char *
skip(str)
register char *str;
{
- register int infield, 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;
+ register int nchars, nfields;
+
+ 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);
}
OpenPOWER on IntegriCloud