summaryrefslogtreecommitdiffstats
path: root/libexec/revnetgroup/revnetgroup.c
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1996-05-12 17:17:45 +0000
committerwpaul <wpaul@FreeBSD.org>1996-05-12 17:17:45 +0000
commit716641bdae47d54927443ba5501780528d499c88 (patch)
tree1d34470d678d2b8ecf2ba42ddbdf82e311e56d50 /libexec/revnetgroup/revnetgroup.c
parent69278b0c5dc7ccde95c4e6d05783bf61464c8942 (diff)
downloadFreeBSD-src-716641bdae47d54927443ba5501780528d499c88.zip
FreeBSD-src-716641bdae47d54927443ba5501780528d499c88.tar.gz
Small touchups:
- Fix typos in comments in hash.c. - Remove unneeded and unused member from grouplist struct in hash.h. (Curiously, the compiler never complained about this even though the member was of type 'struct grps' which is not defined anywhere in this program.) - char ch -> int ch in revnetgroup.c. - char *argv[0]; -> char *argv[]; also in revnetgroup.c. - Force the user to specify at least one of the -u or -h flags and complain if they specify both.
Diffstat (limited to 'libexec/revnetgroup/revnetgroup.c')
-rw-r--r--libexec/revnetgroup/revnetgroup.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/libexec/revnetgroup/revnetgroup.c b/libexec/revnetgroup/revnetgroup.c
index 4a3ab5a..e92f3c0 100644
--- a/libexec/revnetgroup/revnetgroup.c
+++ b/libexec/revnetgroup/revnetgroup.c
@@ -35,7 +35,7 @@
* Center for Telecommunications Research
* Columbia University, New York City
*
- * $Id$
+ * $Id: revnetgroup.c,v 1.1.1.1 1995/10/26 16:25:29 wpaul Exp $
*/
#include <stdio.h>
@@ -43,6 +43,10 @@
#include <string.h>
#include "hash.h"
+#ifndef lint
+static const char rcsid[] = "$Id$";
+#endif
+
#define LINSIZ 1024
/* Default location of netgroup file. */
@@ -71,17 +75,17 @@ char *prog;
extern char *optarg;
main(argc, argv)
-int argc;
-char *argv[0];
+ int argc;
+ char *argv[];
{
FILE *fp;
char readbuf[LINSIZ];
struct group_entry *gcur;
struct member_entry *mcur;
char *host, *user, *domain;
- char ch;
+ int ch;
char *key = NULL, *data = NULL;
- int hosts, i;
+ int hosts = -1, i;
if (argc < 2)
usage(argv[0]);
@@ -89,9 +93,17 @@ char *argv[0];
while ((ch = getopt(argc, argv, "uhf:")) != EOF) {
switch(ch) {
case 'u':
+ if (hosts != -1) {
+ warnx("please use only one of -u or -h");
+ usage(argv[0]);
+ }
hosts = 0;
break;
case 'h':
+ if (hosts != -1) {
+ warnx("please use only one of -u or -h");
+ usage(argv[0]);
+ }
hosts = 1;
break;
case 'f':
@@ -103,6 +115,9 @@ char *argv[0];
}
}
+ if (hosts == -1)
+ usage(argv[0]);
+
if (strcmp(netgroup, "-")) {
if ((fp = fopen(netgroup, "r")) == NULL) {
perror(netgroup);
OpenPOWER on IntegriCloud