aboutsummaryrefslogtreecommitdiff
path: root/libexec/revnetgroup
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2002-02-07 23:57:01 +0000
committerWarner Losh <imp@FreeBSD.org>2002-02-07 23:57:01 +0000
commit266ebcd3916b719e0db6ef693a21d19d48b071fe (patch)
treeec514bcba5b68b3cc1a0c1e6821e5f92d0c6bf2d /libexec/revnetgroup
parent2b8a08af6bf26e11cd7ce362b5aad0519b32541c (diff)
downloadsrc-266ebcd3916b719e0db6ef693a21d19d48b071fe.tar.gz
src-266ebcd3916b719e0db6ef693a21d19d48b071fe.zip
Notes
Diffstat (limited to 'libexec/revnetgroup')
-rw-r--r--libexec/revnetgroup/hash.c29
-rw-r--r--libexec/revnetgroup/hash.h12
-rw-r--r--libexec/revnetgroup/parse_netgroup.c34
-rw-r--r--libexec/revnetgroup/revnetgroup.c6
4 files changed, 34 insertions, 47 deletions
diff --git a/libexec/revnetgroup/hash.c b/libexec/revnetgroup/hash.c
index c11244ac3b9c..118008023551 100644
--- a/libexec/revnetgroup/hash.c
+++ b/libexec/revnetgroup/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,8 @@ hash(keyarg, len)
* We mask off all but the lower 8 bits since our table array
* can only hold 256 elements.
*/
-u_int32_t hashkey(key)
- char *key;
+u_int32_t
+hashkey(char *key)
{
if (key == NULL)
@@ -112,9 +110,8 @@ u_int32_t hashkey(key)
}
/* Find an entry in the hash table (may be hanging off a linked list). */
-char *lookup(table, key)
- struct group_entry *table[];
- char *key;
+char *
+lookup(struct group_entry *table[], char *key)
{
struct group_entry *cur;
@@ -146,9 +143,8 @@ char *lookup(table, key)
*
* That's a lot of comment for such a small piece of code, isn't it.
*/
-void store (table, key, data)
- struct group_entry *table[];
- char *key, *data;
+void
+store(struct group_entry *table[], char *key, char *data)
{
struct group_entry *new;
u_int32_t i;
@@ -176,9 +172,8 @@ void store (table, key, data)
* an entry in the table, then we just have to do one thing, which is
* to update its grouplist.
*/
-void mstore (table, key, data, domain)
- struct member_entry *table[];
- char *key, *data, *domain;
+void
+mstore(struct member_entry *table[], char *key, char *data, char *domain)
{
struct member_entry *cur, *new;
struct grouplist *tmp;
diff --git a/libexec/revnetgroup/hash.h b/libexec/revnetgroup/hash.h
index 04a44d67a8fa..2485901ed68e 100644
--- a/libexec/revnetgroup/hash.h
+++ b/libexec/revnetgroup/hash.h
@@ -59,9 +59,9 @@ struct group_entry {
#define LINSIZ 1024 * 10
-extern void store __P(( struct group_entry ** , char *, char * ));
-extern void mstore __P(( struct member_entry ** , char *, char *, char * ));
-extern char *lookup __P(( struct group_entry **, char * ));
-extern void __endnetgrent __P(( void ));
-extern void __setnetgrent __P(( char * ));
-extern int __getnetgrent __P(( char **, char **, char ** ));
+extern void store(struct group_entry ** , char *, char *);
+extern void mstore(struct member_entry ** , char *, char *, char *);
+extern char *lookup(struct group_entry **, char *);
+extern void __endnetgrent(void);
+extern void __setnetgrent(char *);
+extern int __getnetgrent(char **, char **, char **);
diff --git a/libexec/revnetgroup/parse_netgroup.c b/libexec/revnetgroup/parse_netgroup.c
index 6b795c61d8a6..13301df09fb5 100644
--- a/libexec/revnetgroup/parse_netgroup.c
+++ b/libexec/revnetgroup/parse_netgroup.c
@@ -84,10 +84,8 @@ static struct {
(struct netgrp *)0,
(char *)0,
};
-static int parse_netgrp();
-static struct linelist *read_for_group();
-void __setnetgrent(), __endnetgrent();
-int __getnetgrent();
+static int parse_netgrp(char *group);
+static struct linelist *read_for_group(char *group);
extern struct group_entry *gtable[];
/*
@@ -97,8 +95,7 @@ extern struct group_entry *gtable[];
* most of the work.
*/
void
-__setnetgrent(group)
- char *group;
+__setnetgrent(char *group)
{
/* Sanity check */
@@ -123,8 +120,7 @@ __setnetgrent(group)
* Get the next netgroup off the list.
*/
int
-__getnetgrent(hostp, userp, domp)
- char **hostp, **userp, **domp;
+__getnetgrent(char **hostp, char **userp, char **domp)
{
if (nextgrp) {
*hostp = nextgrp->ng_str[NG_HOST];
@@ -140,10 +136,10 @@ __getnetgrent(hostp, userp, domp)
* __endnetgrent() - cleanup
*/
void
-__endnetgrent()
+__endnetgrent(void)
{
- register struct linelist *lp, *olp;
- register struct netgrp *gp, *ogp;
+ struct linelist *lp, *olp;
+ struct netgrp *gp, *ogp;
lp = linehead;
while (lp) {
@@ -177,13 +173,12 @@ __endnetgrent()
* Parse the netgroup file setting up the linked lists.
*/
static int
-parse_netgrp(group)
- char *group;
+parse_netgrp(char *group)
{
- register char *spos, *epos;
- register int len, strpos;
+ char *spos, *epos;
+ int len, strpos;
#ifdef DEBUG
- register int fields;
+ int fields;
#endif
char *pos, *gpos;
struct netgrp *grp;
@@ -288,11 +283,10 @@ parse_netgrp(group)
* is found. Return 1 if eof is encountered.
*/
static struct linelist *
-read_for_group(group)
- char *group;
+read_for_group(char *group)
{
- register char *pos, *spos, *linep = NULL, *olinep = NULL;
- register int len, olen;
+ char *pos, *spos, *linep = NULL, *olinep = NULL;
+ int len, olen;
int cont;
struct linelist *lp;
char line[LINSIZ + 1];
diff --git a/libexec/revnetgroup/revnetgroup.c b/libexec/revnetgroup/revnetgroup.c
index 347c517fcfb3..0d4f379d8eca 100644
--- a/libexec/revnetgroup/revnetgroup.c
+++ b/libexec/revnetgroup/revnetgroup.c
@@ -61,16 +61,14 @@ struct group_entry *gtable[TABLESIZE];
struct member_entry *mtable[TABLESIZE];
static void
-usage()
+usage(void)
{
fprintf (stderr,"usage: revnetgroup -u|-h [-f netgroup file]\n");
exit(1);
}
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
FILE *fp;
char readbuf[LINSIZ];