From 6a73e13d75d31da2c3f1145d8487725f0073a4b8 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Fri, 2 Nov 2018 20:07:02 -0500 Subject: Convert more option vars to the new (single letter) coding style. --- toys/posix/uniq.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'toys/posix/uniq.c') diff --git a/toys/posix/uniq.c b/toys/posix/uniq.c index 114fc19b..78c82544 100644 --- a/toys/posix/uniq.c +++ b/toys/posix/uniq.c @@ -28,16 +28,14 @@ config UNIQ #include "toys.h" GLOBALS( - long maxchars; - long nchars; - long nfields; + long w, s, f; long repeats; ) static char *skip(char *str) { - long nchars = TT.nchars, nfields = TT.nfields; + long nchars = TT.s, nfields = TT.f; // Skip fields first while (nfields--) { @@ -77,7 +75,7 @@ void uniq_main(void) char *t1, *t2; // If requested get the chosen fields + character offsets. - if (TT.nfields || TT.nchars) { + if (TT.f || TT.s) { t1 = skip(thisline); t2 = skip(prevline); } else { @@ -85,10 +83,10 @@ void uniq_main(void) t2 = prevline; } - if (TT.maxchars == 0) + if (!TT.w) diff = !(toys.optflags & FLAG_i) ? strcmp(t1, t2) : strcasecmp(t1, t2); - else diff = !(toys.optflags & FLAG_i) ? strncmp(t1, t2, TT.maxchars) - : strncasecmp(t1, t2, TT.maxchars); + else diff = !(toys.optflags & FLAG_i) ? strncmp(t1, t2, TT.w) + : strncasecmp(t1, t2, TT.w); if (!diff) TT.repeats++; else { -- cgit v1.2.3