summaryrefslogtreecommitdiffstats
path: root/libexec/revnetgroup/revnetgroup.c
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>1997-11-25 07:14:34 +0000
committercharnier <charnier@FreeBSD.org>1997-11-25 07:14:34 +0000
commita8f4ef9a1d73a061da542afd0f8035bae3f08053 (patch)
tree91ac9a20a8ad83fbeeefd62c04804645e7ac50a3 /libexec/revnetgroup/revnetgroup.c
parentcf4eb29e4783f9f144996339a3e84512d0877644 (diff)
downloadFreeBSD-src-a8f4ef9a1d73a061da542afd0f8035bae3f08053.zip
FreeBSD-src-a8f4ef9a1d73a061da542afd0f8035bae3f08053.tar.gz
Use warn(3). Hardcode progname instead of using argv[0]. Use Pa for file
name.
Diffstat (limited to 'libexec/revnetgroup/revnetgroup.c')
-rw-r--r--libexec/revnetgroup/revnetgroup.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/libexec/revnetgroup/revnetgroup.c b/libexec/revnetgroup/revnetgroup.c
index f098167..3599acd 100644
--- a/libexec/revnetgroup/revnetgroup.c
+++ b/libexec/revnetgroup/revnetgroup.c
@@ -34,21 +34,20 @@
* Written by Bill Paul <wpaul@ctr.columbia.edu>
* Center for Telecommunications Research
* Columbia University, New York City
- *
- * $Id: revnetgroup.c,v 1.7 1997/03/28 15:48:15 imp Exp $
*/
+#ifndef lint
+static const char rcsid[] =
+ "$Id$";
+#endif /* not lint */
+
+#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <errno.h>
-#include <err.h>
+#include <unistd.h>
#include "hash.h"
-#ifndef lint
-static const char rcsid[] = "$Id: revnetgroup.c,v 1.7 1997/03/28 15:48:15 imp Exp $";
-#endif
-
/* Default location of netgroup file. */
char *netgroup = "/etc/netgroup";
@@ -61,15 +60,13 @@ struct group_entry *gtable[TABLESIZE];
*/
struct member_entry *mtable[TABLESIZE];
-void usage(prog)
-char *prog;
+static void
+usage()
{
- fprintf (stderr,"usage: %s -u|-h [-f netgroup file]\n",prog);
+ fprintf (stderr,"usage: revnetgroup -u|-h [-f netgroup file]\n");
exit(1);
}
-extern char *optarg;
-
int
main(argc, argv)
int argc;
@@ -85,21 +82,21 @@ main(argc, argv)
int hosts = -1, i;
if (argc < 2)
- usage(argv[0]);
+ usage();
while ((ch = getopt(argc, argv, "uhf:")) != -1) {
switch(ch) {
case 'u':
if (hosts != -1) {
warnx("please use only one of -u or -h");
- usage(argv[0]);
+ usage();
}
hosts = 0;
break;
case 'h':
if (hosts != -1) {
warnx("please use only one of -u or -h");
- usage(argv[0]);
+ usage();
}
hosts = 1;
break;
@@ -107,13 +104,13 @@ main(argc, argv)
netgroup = optarg;
break;
default:
- usage(argv[0]);
+ usage();
break;
}
}
if (hosts == -1)
- usage(argv[0]);
+ usage();
if (strcmp(netgroup, "-")) {
if ((fp = fopen(netgroup, "r")) == NULL) {
OpenPOWER on IntegriCloud