mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-23 16:01:42 +00:00
o __P removal
o use Ansi-style function definitions
This commit is contained in:
parent
1e599eee20
commit
71233f4fa4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=90779
@ -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;
|
||||
|
@ -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 *);
|
||||
|
||||
|
@ -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];
|
||||
|
@ -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! */
|
||||
|
@ -482,7 +482,7 @@ nglogx(const char *fmt, ...)
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char hostname[MAXHOSTNAMELEN], *exec, rhook[NG_HOOKLEN + 1];
|
||||
unsigned char response[1024];
|
||||
|
Loading…
Reference in New Issue
Block a user