Make use of EX_USAGE for usage().

This commit is contained in:
Xin LI 2010-12-14 00:21:34 +00:00
parent b4dac21d68
commit 6715165066
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=216422

View File

@ -53,6 +53,7 @@ static const char rcsid[] =
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sysexits.h>
#include <unistd.h> #include <unistd.h>
#ifdef SHELL #ifdef SHELL
@ -115,14 +116,14 @@ main(int argc, char *argv[])
case '?': case '?':
default: default:
usage(); usage();
return (1); /* NOTREACHED */
} }
argc -= optind; argc -= optind;
argv += optind; argv += optind;
if (argc < 1) { if (argc < 1) {
usage(); usage();
return (1); /* NOTREACHED */
} }
#ifdef SHELL #ifdef SHELL
@ -562,4 +563,5 @@ static void
usage(void) usage(void)
{ {
(void)fprintf(stderr, "usage: printf format [arguments ...]\n"); (void)fprintf(stderr, "usage: printf format [arguments ...]\n");
exit(EX_USAGE);
} }