aboutsummaryrefslogtreecommitdiff
path: root/libexec/mknetid
diff options
context:
space:
mode:
Diffstat (limited to 'libexec/mknetid')
-rw-r--r--libexec/mknetid/hash.c23
-rw-r--r--libexec/mknetid/hash.h4
-rw-r--r--libexec/mknetid/mknetid.c12
-rw-r--r--libexec/mknetid/parse_group.c30
4 files changed, 25 insertions, 44 deletions
diff --git a/libexec/mknetid/hash.c b/libexec/mknetid/hash.c
index 8de336f3d5ab..6de06d804fdb 100644
--- a/libexec/mknetid/hash.c
+++ b/libexec/mknetid/hash.c
@@ -51,13 +51,11 @@ static const char rcsid[] =
* OZ's original sdbm hash
*/
u_int32_t
-hash(keyarg, len)
- const void *keyarg;
- register size_t len;
+hash(const void *keyarg, size_t len)
{
- register const u_char *key;
- register size_t loop;
- register u_int32_t h;
+ const u_char *key;
+ size_t loop;
+ u_int32_t h;
#define HASHC h = *key++ + 65599 * h
@@ -102,8 +100,7 @@ hash(keyarg, len)
* We mask off all but the lower 8 bits since our table array
* can only hole 256 elements.
*/
-u_int32_t hashkey(key)
- char *key;
+u_int32_t hashkey(char *key)
{
if (key == NULL)
@@ -112,9 +109,7 @@ u_int32_t hashkey(key)
}
/* Find an entry in the hash table (may be hanging off a linked list). */
-struct grouplist *lookup(table, key)
- struct member_entry *table[];
- char *key;
+struct grouplist *lookup(struct member_entry *table[], char *key)
{
struct member_entry *cur;
@@ -134,11 +129,7 @@ struct grouplist dummy = { 99999, NULL };
/*
* Store an group member entry and/or update its grouplist.
*/
-void mstore (table, key, gid, dup)
- struct member_entry *table[];
- char *key;
- int gid;
- int dup;
+void mstore (struct member_entry *table[], char *key, int gid, int dup)
{
struct member_entry *cur, *new;
struct grouplist *tmp;
diff --git a/libexec/mknetid/hash.h b/libexec/mknetid/hash.h
index 04bc784c5c11..7918ae2e95f0 100644
--- a/libexec/mknetid/hash.h
+++ b/libexec/mknetid/hash.h
@@ -49,6 +49,6 @@ struct member_entry {
#define TABLESIZE 1024
#define HASH_MASK 0x000003FF
-extern void mstore __P(( struct member_entry ** , char *, int, int ));
-extern struct grouplist *lookup __P(( struct member_entry **, char * ));
+extern void mstore(struct member_entry ** , char *, int, int);
+extern struct grouplist *lookup(struct member_entry **, char *);
diff --git a/libexec/mknetid/mknetid.c b/libexec/mknetid/mknetid.c
index 23414513ad08..dd08c5ae5674 100644
--- a/libexec/mknetid/mknetid.c
+++ b/libexec/mknetid/mknetid.c
@@ -82,12 +82,12 @@ struct member_entry *mtable[TABLESIZE];
*/
struct member_entry *dtable[TABLESIZE];
-extern struct group *_getgrent __P(( void ));
-extern int _setgrent __P(( void ));
-extern void _endgrent __P(( void ));
+extern struct group *_getgrent(void);
+extern int _setgrent(void);
+extern void _endgrent(void);
static void
-usage()
+usage(void)
{
fprintf (stderr, "%s\n%s\n",
"usage: mknetid [-q] [-g group_file] [-p passwd_file] [-h hosts_file]",
@@ -98,9 +98,7 @@ usage()
extern FILE *_gr_fp;
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
FILE *gfp, *pfp, *hfp, *nfp;
char readbuf[LINSIZ];
diff --git a/libexec/mknetid/parse_group.c b/libexec/mknetid/parse_group.c
index 327847426b8e..b34ee11fcb39 100644
--- a/libexec/mknetid/parse_group.c
+++ b/libexec/mknetid/parse_group.c
@@ -53,7 +53,8 @@ static const char rcsid[] =
FILE *_gr_fp;
static struct group _gr_group;
static int _gr_stayopen;
-static int grscan(), start_gr();
+static int grscan(int, int);
+static int start_gr(void);
#define MAXGRP 200
static char *members[MAXGRP];
@@ -61,27 +62,26 @@ static char *members[MAXGRP];
static char line[MAXLINELENGTH];
struct group *
-_getgrent()
+_getgrent(void)
{
if (!_gr_fp && !start_gr()) {
return NULL;
}
- if (!grscan(0, 0, NULL))
+ if (!grscan(0, 0))
return(NULL);
return(&_gr_group);
}
static int
-start_gr()
+start_gr(void)
{
return 1;
}
int
-_setgroupent(stayopen)
- int stayopen;
+_setgroupent(int stayopen)
{
if (!start_gr())
return(0);
@@ -90,13 +90,13 @@ _setgroupent(stayopen)
}
int
-_setgrent()
+_setgrent(void)
{
return(_setgroupent(0));
}
void
-_endgrent()
+_endgrent(void)
{
if (_gr_fp) {
(void)fclose(_gr_fp);
@@ -105,11 +105,9 @@ _endgrent()
}
static int
-grscan(search, gid, name)
- register int search, gid;
- register char *name;
+grscan(int search, int gid)
{
- register char *cp, **m;
+ char *cp, **m;
char *bp;
for (;;) {
if (!fgets(line, sizeof(line), _gr_fp))
@@ -127,18 +125,12 @@ grscan(search, gid, name)
break;
if (_gr_group.gr_name[0] == '+')
continue;
-
- if (search && name) {
- if(strcmp(_gr_group.gr_name, name)) {
- continue;
- }
- }
if ((_gr_group.gr_passwd = strsep(&bp, ":\n")) == NULL)
break;;
if (!(cp = strsep(&bp, ":\n")))
continue;
_gr_group.gr_gid = atoi(cp);
- if (search && name == NULL && _gr_group.gr_gid != gid)
+ if (search && _gr_group.gr_gid != gid)
continue;
cp = NULL;
if (bp == NULL) /* !! Must check for this! */