Add usage

This commit is contained in:
sin 2015-11-26 16:00:26 +00:00
parent 013bcdee35
commit 71ece08aad

10
noice.c
View file

@ -878,12 +878,22 @@ moretyping:
} }
} }
void
usage(char *argv0)
{
fprintf(stderr, "usage: %s [dir]\n", argv0);
exit(1);
}
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
char cwd[PATH_MAX], *ipath; char cwd[PATH_MAX], *ipath;
char *ifilter; char *ifilter;
if (argc > 2)
usage(argv[0]);
/* Confirm we are in a terminal */ /* Confirm we are in a terminal */
if (!isatty(0) || !isatty(1)) { if (!isatty(0) || !isatty(1)) {
fprintf(stderr, "stdin or stdout is not a tty\n"); fprintf(stderr, "stdin or stdout is not a tty\n");