aboutsummaryrefslogtreecommitdiff
path: root/libexec/revnetgroup/revnetgroup.c
diff options
context:
space:
mode:
authorPhilippe Charnier <charnier@FreeBSD.org>1997-11-25 07:14:34 +0000
committerPhilippe Charnier <charnier@FreeBSD.org>1997-11-25 07:14:34 +0000
commit3029b69f0b84c0ffdcd746db6190540bbb3ee35a (patch)
tree20063d7bb16b71f872b623ae4b9d7a41078d4f14 /libexec/revnetgroup/revnetgroup.c
parent95802bf80331116e00615b58ac14cf6b30c79bc9 (diff)
downloadsrc-3029b69f0b84c0ffdcd746db6190540bbb3ee35a.tar.gz
src-3029b69f0b84c0ffdcd746db6190540bbb3ee35a.zip
Use warn(3). Hardcode progname instead of using argv[0]. Use Pa for file
name.
Notes
Notes: svn path=/head/; revision=31404
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 f098167cd728..3599acd18c6a 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) {