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