o __P removal

o use Ansi-style function definitions
This commit is contained in:
Warner Losh 2002-02-17 19:09:20 +00:00
parent 1e599eee20
commit 71233f4fa4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=90779
5 changed files with 26 additions and 45 deletions

View file

@ -51,13 +51,11 @@ static const char rcsid[] =
* OZ's original sdbm hash * OZ's original sdbm hash
*/ */
u_int32_t u_int32_t
hash(keyarg, len) hash(const void *keyarg, size_t len)
const void *keyarg;
register size_t len;
{ {
register const u_char *key; const u_char *key;
register size_t loop; size_t loop;
register u_int32_t h; u_int32_t h;
#define HASHC h = *key++ + 65599 * 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 * We mask off all but the lower 8 bits since our table array
* can only hole 256 elements. * can only hole 256 elements.
*/ */
u_int32_t hashkey(key) u_int32_t hashkey(char *key)
char *key;
{ {
if (key == NULL) 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). */ /* Find an entry in the hash table (may be hanging off a linked list). */
struct grouplist *lookup(table, key) struct grouplist *lookup(struct member_entry *table[], char *key)
struct member_entry *table[];
char *key;
{ {
struct member_entry *cur; struct member_entry *cur;
@ -134,11 +129,7 @@ struct grouplist dummy = { 99999, NULL };
/* /*
* Store an group member entry and/or update its grouplist. * Store an group member entry and/or update its grouplist.
*/ */
void mstore (table, key, gid, dup) void mstore (struct member_entry *table[], char *key, int gid, int dup)
struct member_entry *table[];
char *key;
int gid;
int dup;
{ {
struct member_entry *cur, *new; struct member_entry *cur, *new;
struct grouplist *tmp; struct grouplist *tmp;

View file

@ -49,6 +49,6 @@ struct member_entry {
#define TABLESIZE 1024 #define TABLESIZE 1024
#define HASH_MASK 0x000003FF #define HASH_MASK 0x000003FF
extern void mstore __P(( struct member_entry ** , char *, int, int )); extern void mstore(struct member_entry ** , char *, int, int);
extern struct grouplist *lookup __P(( struct member_entry **, char * )); extern struct grouplist *lookup(struct member_entry **, char *);

View file

@ -82,12 +82,12 @@ struct member_entry *mtable[TABLESIZE];
*/ */
struct member_entry *dtable[TABLESIZE]; struct member_entry *dtable[TABLESIZE];
extern struct group *_getgrent __P(( void )); extern struct group *_getgrent(void);
extern int _setgrent __P(( void )); extern int _setgrent(void);
extern void _endgrent __P(( void )); extern void _endgrent(void);
static void static void
usage() usage(void)
{ {
fprintf (stderr, "%s\n%s\n", fprintf (stderr, "%s\n%s\n",
"usage: mknetid [-q] [-g group_file] [-p passwd_file] [-h hosts_file]", "usage: mknetid [-q] [-g group_file] [-p passwd_file] [-h hosts_file]",
@ -98,9 +98,7 @@ usage()
extern FILE *_gr_fp; extern FILE *_gr_fp;
int int
main(argc, argv) main(int argc, char *argv[])
int argc;
char *argv[];
{ {
FILE *gfp, *pfp, *hfp, *nfp; FILE *gfp, *pfp, *hfp, *nfp;
char readbuf[LINSIZ]; char readbuf[LINSIZ];

View file

@ -53,7 +53,8 @@ static const char rcsid[] =
FILE *_gr_fp; FILE *_gr_fp;
static struct group _gr_group; static struct group _gr_group;
static int _gr_stayopen; static int _gr_stayopen;
static int grscan(), start_gr(); static int grscan(int, int);
static int start_gr(void);
#define MAXGRP 200 #define MAXGRP 200
static char *members[MAXGRP]; static char *members[MAXGRP];
@ -61,27 +62,26 @@ static char *members[MAXGRP];
static char line[MAXLINELENGTH]; static char line[MAXLINELENGTH];
struct group * struct group *
_getgrent() _getgrent(void)
{ {
if (!_gr_fp && !start_gr()) { if (!_gr_fp && !start_gr()) {
return NULL; return NULL;
} }
if (!grscan(0, 0, NULL)) if (!grscan(0, 0))
return(NULL); return(NULL);
return(&_gr_group); return(&_gr_group);
} }
static int static int
start_gr() start_gr(void)
{ {
return 1; return 1;
} }
int int
_setgroupent(stayopen) _setgroupent(int stayopen)
int stayopen;
{ {
if (!start_gr()) if (!start_gr())
return(0); return(0);
@ -90,13 +90,13 @@ _setgroupent(stayopen)
} }
int int
_setgrent() _setgrent(void)
{ {
return(_setgroupent(0)); return(_setgroupent(0));
} }
void void
_endgrent() _endgrent(void)
{ {
if (_gr_fp) { if (_gr_fp) {
(void)fclose(_gr_fp); (void)fclose(_gr_fp);
@ -105,11 +105,9 @@ _endgrent()
} }
static int static int
grscan(search, gid, name) grscan(int search, int gid)
register int search, gid;
register char *name;
{ {
register char *cp, **m; char *cp, **m;
char *bp; char *bp;
for (;;) { for (;;) {
if (!fgets(line, sizeof(line), _gr_fp)) if (!fgets(line, sizeof(line), _gr_fp))
@ -127,18 +125,12 @@ grscan(search, gid, name)
break; break;
if (_gr_group.gr_name[0] == '+') if (_gr_group.gr_name[0] == '+')
continue; continue;
if (search && name) {
if(strcmp(_gr_group.gr_name, name)) {
continue;
}
}
if ((_gr_group.gr_passwd = strsep(&bp, ":\n")) == NULL) if ((_gr_group.gr_passwd = strsep(&bp, ":\n")) == NULL)
break;; break;;
if (!(cp = strsep(&bp, ":\n"))) if (!(cp = strsep(&bp, ":\n")))
continue; continue;
_gr_group.gr_gid = atoi(cp); _gr_group.gr_gid = atoi(cp);
if (search && name == NULL && _gr_group.gr_gid != gid) if (search && _gr_group.gr_gid != gid)
continue; continue;
cp = NULL; cp = NULL;
if (bp == NULL) /* !! Must check for this! */ if (bp == NULL) /* !! Must check for this! */

View file

@ -482,7 +482,7 @@ nglogx(const char *fmt, ...)
} }
int int
main(int argc, char **argv) main(int argc, char *argv[])
{ {
char hostname[MAXHOSTNAMELEN], *exec, rhook[NG_HOOKLEN + 1]; char hostname[MAXHOSTNAMELEN], *exec, rhook[NG_HOOKLEN + 1];
unsigned char response[1024]; unsigned char response[1024];