From 96d282ece610550c78bf9426bc5d9404465445d5 Mon Sep 17 00:00:00 2001 From: Philippe Charnier Date: Sun, 17 Aug 2003 09:06:08 +0000 Subject: [PATCH] add FBSDID, compare getopt() against -1, use fprintf() + exit() in usage() instead of errx() to get the message starting with "usage:". --- usr.sbin/nghook/main.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/usr.sbin/nghook/main.c b/usr.sbin/nghook/main.c index ec9d724aa813..678c297fd663 100644 --- a/usr.sbin/nghook/main.c +++ b/usr.sbin/nghook/main.c @@ -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 +__FBSDID("$FreeBSD$"); + #include #include #include @@ -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); } -