add FBSDID, compare getopt() against -1, use fprintf() + exit() in usage()
instead of errx() to get the message starting with "usage:".
This commit is contained in:
parent
9a4e73fe5e
commit
96d282ece6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=119020
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* main.c
|
||||
*
|
||||
@ -34,10 +33,12 @@
|
||||
* THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
* $Whistle: main.c,v 1.9 1999/01/20 00:26:26 archie Exp $
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -80,7 +81,7 @@ main(int ac, char *av[])
|
||||
int ch;
|
||||
|
||||
/* Parse flags */
|
||||
while ((ch = getopt(ac, av, "adlnsS")) != EOF) {
|
||||
while ((ch = getopt(ac, av, "adlnsS")) != -1) {
|
||||
switch (ch) {
|
||||
case 'a':
|
||||
asciiFlag = 1;
|
||||
@ -243,6 +244,6 @@ WriteAscii(u_char *buf, int len)
|
||||
static void
|
||||
Usage(void)
|
||||
{
|
||||
errx(EX_USAGE, "usage: nghook [-adlnsS] path [hookname]");
|
||||
fprintf(stderr, "usage: nghook [-adlnsS] path [hookname]\n");
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user