=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/uniq/uniq.c,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- src/usr.bin/uniq/uniq.c 2022/01/01 17:44:18 1.32 +++ src/usr.bin/uniq/uniq.c 2022/01/01 18:20:52 1.33 @@ -1,4 +1,4 @@ -/* $OpenBSD: uniq.c,v 1.32 2022/01/01 17:44:18 cheloha Exp $ */ +/* $OpenBSD: uniq.c,v 1.33 2022/01/01 18:20:52 cheloha Exp $ */ /* $NetBSD: uniq.c,v 1.7 1995/08/31 22:03:48 jtc Exp $ */ /* @@ -35,12 +35,12 @@ #include #include -#include #include #include #include #include #include +#include #include #include #include @@ -57,6 +57,7 @@ int main(int argc, char *argv[]) { + const char *errstr; char *p, *prevline, *t, *thisline, *tmp; size_t prevsize, thissize, tmpsize; ssize_t len; @@ -69,8 +70,6 @@ obsolete(argv); while ((ch = getopt(argc, argv, "cdf:is:u")) != -1) { - const char *errstr; - switch (ch) { case 'c': cflag = 1; @@ -81,8 +80,7 @@ case 'f': numfields = strtonum(optarg, 0, LLONG_MAX, &errstr); if (errstr) - errx(1, "field skip value is %s: %s", - errstr, optarg); + errx(1, "fields is %s: %s", errstr, optarg); break; case 'i': iflag = 1; @@ -90,9 +88,7 @@ case 's': numchars = strtonum(optarg, 0, LLONG_MAX, &errstr); if (errstr) - errx(1, - "character skip value is %s: %s", - errstr, optarg); + errx(1, "chars is %s: %s", errstr, optarg); break; case 'u': uflag = 1; @@ -101,7 +97,6 @@ usage(); } } - argc -= optind; argv += optind; @@ -129,7 +124,7 @@ free(prevline); if (ferror(stdin)) err(1, "getline"); - exit(0); + return 0; } if (prevline[len - 1] == '\n') prevline[len - 1] = '\0'; @@ -173,7 +168,7 @@ show(prevline); free(prevline); - exit(0); + return 0; } /* @@ -256,10 +251,8 @@ __dead void usage(void) { - extern char *__progname; - - (void)fprintf(stderr, + fprintf(stderr, "usage: %s [-ci] [-d | -u] [-f fields] [-s chars] [input_file [output_file]]\n", - __progname); + getprogname()); exit(1); }