diff options
| -rw-r--r-- | argv.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -1,6 +1,8 @@ #include <stdio.h> #include <string.h> +static const char usage[] = "argv [-n] [-0] [-d CHAR] [--] [ARG ...]"; + int main(int argc, const char **argv) { @@ -13,9 +15,12 @@ main(int argc, const char **argv) break; } else if (!strcmp(*arg, "-n")) { endchar = 0; - } else if (!strcmp(*arg, "-d")) { + } else if (!strcmp(*arg, "-h") || !strcmp(*arg, "--help")) { + puts(usage); + return 0; + } else if (!strcmp(*arg, "-d") || !strcmp(*arg, "--delim")) { if (!*++arg) { - fprintf(stderr, "Missing arg for -d\n"); + fputs(usage, stderr); return 1; } delim = **++arg; |
