summaryrefslogtreecommitdiff
path: root/libexec/revnetgroup
diff options
context:
space:
mode:
authorBill Paul <wpaul@FreeBSD.org>1996-05-12 17:17:45 +0000
committerBill Paul <wpaul@FreeBSD.org>1996-05-12 17:17:45 +0000
commitd7b71c676e8144df99554c15e86e2e6575171913 (patch)
tree1d34470d678d2b8ecf2ba42ddbdf82e311e56d50 /libexec/revnetgroup
parent58efe44318eaf846cb8dba6bb2a3cb34cdd2c9a6 (diff)
Notes
Diffstat (limited to 'libexec/revnetgroup')
-rw-r--r--libexec/revnetgroup/hash.c12
-rw-r--r--libexec/revnetgroup/hash.h3
-rw-r--r--libexec/revnetgroup/parse_netgroup.c6
-rw-r--r--libexec/revnetgroup/revnetgroup.c25
4 files changed, 34 insertions, 12 deletions
diff --git a/libexec/revnetgroup/hash.c b/libexec/revnetgroup/hash.c
index b8758439e9e4..1469fcf7aab4 100644
--- a/libexec/revnetgroup/hash.c
+++ b/libexec/revnetgroup/hash.c
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: hash.c,v 1.1.1.1 1995/10/26 16:25:29 wpaul Exp $
*/
#include <stdio.h>
@@ -38,6 +38,10 @@
#include <sys/types.h>
#include "hash.h"
+#ifndef lint
+static const char rcsid[] = "$Id$";
+#endif
+
/*
* This hash function is stolen directly from the
* Berkeley DB package. It already exists inside libc, but
@@ -97,7 +101,7 @@ hash(keyarg, len)
/*
* Generate a hash value for a given key (character string).
* We mask off all but the lower 8 bits since our table array
- * can only hole 256 elements.
+ * can only hold 256 elements.
*/
u_int32_t hashkey(key)
char *key;
@@ -136,7 +140,7 @@ char *lookup(table, key)
*
* One way to deal with this is to malloc(2) a second table and start
* doing indirection, but this is a pain in the butt and it's not worth
- * going to all that trouble for a dinky littke program like this. Instead,
+ * going to all that trouble for a dinky little program like this. Instead,
* we turn each table entry into a linked list and simply link keys
* with the same hash value together at the same index location within
* the table.
@@ -162,7 +166,7 @@ void store (table, key, data)
}
/*
- * Store an group member entry and/or update its grouplist. This is
+ * Store a group member entry and/or update its grouplist. This is
* a bit more complicated than the previous function since we have to
* maintain not only the hash table of group members, each group member
* structure also has a linked list of groups hung off it. If handed
diff --git a/libexec/revnetgroup/hash.h b/libexec/revnetgroup/hash.h
index 2212534ff3c9..4de29e659867 100644
--- a/libexec/revnetgroup/hash.h
+++ b/libexec/revnetgroup/hash.h
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: hash.h,v 1.1.1.1 1995/10/26 16:25:29 wpaul Exp $
*/
/* Groupname entry hung off a member_entry node. */
@@ -50,7 +50,6 @@ struct member_entry {
struct group_entry {
char *key;
char *data;
- struct grps *groups;
struct group_entry *next;
};
diff --git a/libexec/revnetgroup/parse_netgroup.c b/libexec/revnetgroup/parse_netgroup.c
index 99dfaeb37b61..bc048e12eaed 100644
--- a/libexec/revnetgroup/parse_netgroup.c
+++ b/libexec/revnetgroup/parse_netgroup.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "$Id$";
+static char sccsid[] = "$Id: parse_netgroup.c,v 1.1.1.1 1995/10/26 16:25:29 wpaul Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -51,6 +51,10 @@ static char sccsid[] = "$Id$";
#include <unistd.h>
#include "hash.h"
+#ifndef lint
+static const char rcsid[] = "$Id$";
+#endif
+
/*
* Static Variables and functions used by setnetgrent(), getnetgrent() and
* __endnetgrent().
diff --git a/libexec/revnetgroup/revnetgroup.c b/libexec/revnetgroup/revnetgroup.c
index 4a3ab5aac7c5..e92f3c063a72 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);