--- chgrp.c | 3 ++- chown.c | 4 +++- cksum.c | 12 +++++++++++- ed.c | 4 ++-- find.c | 2 +- grep.c | 3 ++- join.c | 4 ++-- nl.c | 5 +++-- renice.c | 2 +- seq.c | 4 ++-- sort.c | 2 +- tar.c | 6 ++++-- touch.c | 3 ++- tr.c | 2 +- xargs.c | 3 ++- 15 files changed, 39 insertions(+), 20 deletions(-) diff --git a/chgrp.c b/chgrp.c index ee5c503..748b92e 100644 --- a/chgrp.c +++ b/chgrp.c _AT_@ -5,6 +5,7 @@ #include <grp.h> #include <unistd.h> +#include "arg.h" #include "fs.h" #include "util.h" _AT_@ -37,7 +38,7 @@ chgrp(const char *path, struct stat *st, void *data, struct recursor *r) static void usage(void) { - eprintf("usage: chgrp [-h] [-R [-H | -L | -P]] group file ...\n"); + eprintf("usage: %s [-h] [-R [-H | -L | -P]] group file ...\n", argv0); } int diff --git a/chown.c b/chown.c index f06d541..170287a 100644 --- a/chown.c +++ b/chown.c _AT_@ -40,7 +40,9 @@ chownpwgr(const char *path, struct stat *st, void *data, struct recursor *r) static void usage(void) { - eprintf("usage: %s [-h] [-R [-H | -L | -P]] [owner][:[group]] file ...\n", argv0); + eprintf("usage: %s [-h] [-R [-H | -L | -P]] owner[:group] file ...\n" + " %s [-h] [-R [-H | -L | -P]] :group file ...\n", + argv0, argv0); } int diff --git a/cksum.c b/cksum.c index 570ca81..ea58d47 100644 --- a/cksum.c +++ b/cksum.c _AT_@ -3,6 +3,7 @@ #include <stdio.h> #include <string.h> +#include "arg.h" #include "util.h" static int ret = 0; _AT_@ -89,12 +90,21 @@ cksum(FILE *fp, const char *s) putchar('\n'); } +static void +usage(void) +{ + eprintf("usage: %s [file ...]\n", argv0); +} + int main(int argc, char *argv[]) { FILE *fp; - argv0 = argv[0], argc--, argv++; + ARGBEGIN { + default: + usage(); + } ARGEND if (!argc) { cksum(stdin, NULL); diff --git a/ed.c b/ed.c index a3de436..6771cf2 100644 --- a/ed.c +++ b/ed.c _AT_@ -14,6 +14,7 @@ #include <string.h> #include "arg.h" +#include "util.h" #define REGEXSIZE 100 #define LINESIZE 80 _AT_@ -1310,8 +1311,7 @@ doglobal(void) static void usage(void) { - fputs("ed [-s][-p][file]\n", stderr); - exit(1); + eprintf("usage: %s [-s] [-p] [file]\n", argv0); } static void diff --git a/find.c b/find.c index 72926e1..ad0c731 100644 --- a/find.c +++ b/find.c _AT_@ -992,7 +992,7 @@ find(char *path, struct findhist *hist) static void usage(void) { - eprintf("usage: %s [-H|-L] path... [expression...]\n", argv0); + eprintf("usage: %s [-H | -L] path ... [expression ...]\n", argv0); } int diff --git a/grep.c b/grep.c index c47e218..ca255ff 100644 --- a/grep.c +++ b/grep.c _AT_@ -166,7 +166,8 @@ end: static void usage(void) { - enprintf(Error, "usage: %s [-EFHchilnqsvwx] [-e pattern] [-f file] [pattern] [file ...]\n", argv0); + enprintf(Error, "usage: %s [-EFHchilnqsvwx] [-e pattern] [-f file] " + "[pattern] [file ...]\n", argv0); } int diff --git a/join.c b/join.c index 4c68ad3..160b45d 100644 --- a/join.c +++ b/join.c _AT_@ -64,8 +64,8 @@ static struct outlist output; static void usage(void) { - eprintf("usage: %s [-1 field] [-2 field] [-o list] [-e string] " - "[-a | -v fileno] [-t delim] file1 file2\n", argv0); + eprintf("usage: %s [-1 field] [-2 field] [-a fileno | -v fileno] " + "[-e string] [-o list] [-t delim] file1 file2\n", argv0); } static void diff --git a/nl.c b/nl.c index b46932a..2e32a13 100644 --- a/nl.c +++ b/nl.c _AT_@ -93,8 +93,9 @@ static void usage(void) { eprintf("usage: %s [-p] [-b type] [-d delim] [-f type]\n" - " [-h type] [-i num] [-l num] [-n format]\n" - " [-s sep] [-v num] [-w num] [file]\n", argv0); + " %*s [-h type] [-i num] [-l num] [-n format]\n" + " %*s [-s sep] [-v num] [-w num] [file]\n", + argv0, strlen(argv0), " ", strlen(argv0), " "); } static char diff --git a/renice.c b/renice.c index 74171b6..358c560 100644 --- a/renice.c +++ b/renice.c _AT_@ -37,7 +37,7 @@ renice(int which, int who, long adj) static void usage(void) { - eprintf("renice -n num [-g | -p | -u] id ...\n"); + eprintf("usage: %s -n num [-g | -p | -u] id ...\n", argv0); } int diff --git a/seq.c b/seq.c index 46a213b..29ff0b5 100644 --- a/seq.c +++ b/seq.c _AT_@ -72,8 +72,8 @@ format: static void usage(void) { - eprintf("usage: %s [-f fmt] [-s sep] [-w] [startnum" - " [step]] endnum\n", argv0); + eprintf("usage: %s [-f fmt] [-s sep] [-w] [startnum [step]] endnum\n", + argv0); } int diff --git a/sort.c b/sort.c index 0761d0f..c40b9b1 100644 --- a/sort.c +++ b/sort.c _AT_@ -241,7 +241,7 @@ static void usage(void) { enprintf(2, "usage: %s [-Cbcmnru] [-o outfile] [-t delim] " - "[-k def]... [file ...]\n", argv0); + "[[-k def] ...] [file ...]\n", argv0); } int diff --git a/tar.c b/tar.c index e8dd26a..10b2e30 100644 --- a/tar.c +++ b/tar.c _AT_@ -490,8 +490,10 @@ xt(int argc, char *argv[], int mode) static void usage(void) { - eprintf("usage: %s [-C dir] [-J | -Z | -a | -j | -z] -x [-m | -t] [-f file] [file ...]\n" - " %s [-C dir] [-J | -Z | -a | -j | -z] [-h] -c path ... [-f file]\n", argv0, argv0); + eprintf("usage: %s [-C dir] [-J | -Z | -a | -j | -z] -x [-m | -t] " + "[-f file] [file ...]\n" + " %s [-C dir] [-J | -Z | -a | -j | -z] [-h] -c path ... " + "[-f file]\n", argv0, argv0); } int diff --git a/touch.c b/touch.c index e2dc04a..b957fa5 100644 --- a/touch.c +++ b/touch.c _AT_@ -111,7 +111,8 @@ parsetime(char *str, time_t current) static void usage(void) { - eprintf("usage: %s [-acm] [-d time | -r ref_file | -t time | -T time] file ...\n", argv0); + eprintf("usage: %s [-acm] [-d time | -r ref_file | -t time | -T time] " + "file ...\n", argv0); } int diff --git a/tr.c b/tr.c index b40f0cc..8119deb 100644 --- a/tr.c +++ b/tr.c _AT_@ -166,7 +166,7 @@ literal: static void usage(void) { - eprintf("usage: %s [-cCds] set1 [set2]\n", argv0); + eprintf("usage: %s [-Ccds] set1 [set2]\n", argv0); } int diff --git a/xargs.c b/xargs.c index 242106b..0d5dd53 100644 --- a/xargs.c +++ b/xargs.c _AT_@ -188,7 +188,8 @@ spawn(void) static void usage(void) { - eprintf("usage: %s [-rtx] [-E eofstr] [-n num] [-s num] [cmd [arg ...]]\n", argv0); + eprintf("usage: %s [-rtx] [-E eofstr] [-n num] [-s num] " + "[cmd [arg ...]]\n", argv0); } int -- 2.6.4Received on Mon Dec 21 2015 - 17:20:34 CET
This archive was generated by hypermail 2.3.0 : Mon Dec 21 2015 - 17:24:13 CET