Use an usage() rather than doing the fprintf inside option parsing.
This commit is contained in:
parent
5a8b5dcfa4
commit
f46221a82d
@ -70,6 +70,7 @@ int bflag, eflag, nflag, sflag, tflag, vflag;
|
||||
int rval;
|
||||
const char *filename;
|
||||
|
||||
static void usage(void);
|
||||
static void scanfiles(char **argv, int cooked);
|
||||
static void cook_cat(FILE *);
|
||||
static void raw_cat(int);
|
||||
@ -109,9 +110,7 @@ main(int argc, char *argv[])
|
||||
vflag = 1;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"usage: cat [-benstuv] [file ...]\n");
|
||||
exit(1);
|
||||
usage();
|
||||
}
|
||||
argv += optind;
|
||||
|
||||
@ -124,6 +123,13 @@ main(int argc, char *argv[])
|
||||
exit(rval);
|
||||
}
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
fprintf(stderr, "usage: cat [-benstuv] [file ...]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void
|
||||
scanfiles(char **argv, int cooked)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user