diff options
author | Rob Landley <rob@landley.net> | 2018-11-02 20:07:02 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2018-11-02 20:07:02 -0500 |
commit | 6a73e13d75d31da2c3f1145d8487725f0073a4b8 (patch) | |
tree | 17b5bb8b6b5e94b1c93818954cf322a39941a4be /toys/posix/uniq.c | |
parent | 49e1d8733ebcaf130623c68a2393a3c43702a524 (diff) | |
download | toybox-6a73e13d75d31da2c3f1145d8487725f0073a4b8.tar.gz |
Convert more option vars to the new (single letter) coding style.
Diffstat (limited to 'toys/posix/uniq.c')
-rw-r--r-- | toys/posix/uniq.c | 14 |
1 files changed, 6 insertions, 8 deletions
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 { |