diff --git a/TODO b/TODO index 91aa2a6..20be4b8 100644 --- a/TODO +++ b/TODO @@ -54,8 +54,6 @@ tr string1 [string2] unexpand [-a] [-t N] [file...] -uniq [-diuc] [input [output]] - unlink file who diff --git a/uniq.c b/uniq.c index 303eaa4..fe1448f 100644 --- a/uniq.c +++ b/uniq.c @@ -41,12 +41,13 @@ main(int argc, char *argv[]) if(optind == argc) uniq(stdin, ""); - else for(; optind < argc; optind++) { + else if(optind == argc - 1) { if(!(fp = fopen(argv[optind], "r"))) eprintf("fopen %s:", argv[optind]); uniq(fp, argv[optind]); fclose(fp); - } + } else + enprintf(2, "too many arguments\n"); uniq_finish(); return EXIT_SUCCESS;