diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-07-06 03:08:14 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-07-06 03:08:14 +0000 |
commit | 6ca7cf11c3733481eea93a690b8c670e6fc99aad (patch) | |
tree | 7fd7628c2848addb9f6d626c595e32ae5d05d33d /lib/libc/gen | |
parent | cb321a9dda9898770a75119bdf92f933d530b045 (diff) |
KNF
Diffstat (limited to 'lib/libc/gen')
-rw-r--r-- | lib/libc/gen/getgrent.c | 61 | ||||
-rw-r--r-- | lib/libc/gen/getnetgrent.c | 30 |
2 files changed, 47 insertions, 44 deletions
diff --git a/lib/libc/gen/getgrent.c b/lib/libc/gen/getgrent.c index e977e7a8d52..a4f43435258 100644 --- a/lib/libc/gen/getgrent.c +++ b/lib/libc/gen/getgrent.c @@ -33,7 +33,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: getgrent.c,v 1.16 2002/05/24 21:22:37 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: getgrent.c,v 1.17 2002/07/06 03:08:13 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -86,8 +86,9 @@ static int __ypcurrentlen; struct group * getgrent() { - struct group *p_gr = (struct group*)_THREAD_PRIVATE(gr,_gr_group,NULL); - struct group_storage *gs = (struct group_storage *)_THREAD_PRIVATE(gr_storage,gr_storage,NULL); + struct group *p_gr = (struct group*)_THREAD_PRIVATE(gr, _gr_group, NULL); + struct group_storage *gs = (struct group_storage *)_THREAD_PRIVATE(gr_storage, + gr_storage, NULL); _THREAD_PRIVATE_MUTEX_LOCK(gr); if ((!_gr_fp && !start_gr()) || !grscan(0, 0, NULL, p_gr, gs)) @@ -121,7 +122,8 @@ getgrnam(name) const char *name; { struct group *p_gr = (struct group*)_THREAD_PRIVATE(gr,_gr_group,NULL); - struct group_storage *gs = (struct group_storage *)_THREAD_PRIVATE(gr_storage,gr_storage,NULL); + struct group_storage *gs = (struct group_storage *)_THREAD_PRIVATE(gr_storage, + gr_storage, NULL); return getgrnam_gs(name, p_gr, gs); } @@ -173,8 +175,9 @@ struct group * getgrgid(gid) gid_t gid; { - struct group *p_gr = (struct group*)_THREAD_PRIVATE(gr,_gr_group,NULL); - struct group_storage *gs = (struct group_storage *)_THREAD_PRIVATE(gr_storage,gr_storage,NULL); + struct group *p_gr = (struct group*)_THREAD_PRIVATE(gr, _gr_group, NULL); + struct group_storage *gs = (struct group_storage *)_THREAD_PRIVATE(gr_storage, + gr_storage, NULL); return getgrgid_gs(gid, p_gr, gs); } @@ -209,7 +212,7 @@ start_gr() rewind(_gr_fp); #ifdef YP __ypmode = YPMODE_NONE; - if(__ypcurrent) + if (__ypcurrent) free(__ypcurrent); __ypcurrent = NULL; #endif @@ -250,7 +253,7 @@ endgrent_basic() _gr_fp = NULL; #ifdef YP __ypmode = YPMODE_NONE; - if(__ypcurrent) + if (__ypcurrent) free(__ypcurrent); __ypcurrent = NULL; #endif @@ -292,26 +295,26 @@ grscan(search, gid, name, p_gr, gs) for (;;) { #ifdef YP - if(__ypmode != YPMODE_NONE) { + if (__ypmode != YPMODE_NONE) { - if(!__ypdomain) { - if(yp_get_default_domain(&__ypdomain)) { + if (!__ypdomain) { + if (yp_get_default_domain(&__ypdomain)) { __ypmode = YPMODE_NONE; - if(grname != (char *)NULL) { + if (grname != (char *)NULL) { free(grname); grname = (char *)NULL; } continue; } } - switch(__ypmode) { + switch (__ypmode) { case YPMODE_FULL: - if(__ypcurrent) { + if (__ypcurrent) { r = yp_next(__ypdomain, "group.byname", - __ypcurrent, __ypcurrentlen, - &key, &keylen, &data, &datalen); + __ypcurrent, __ypcurrentlen, + &key, &keylen, &data, &datalen); free(__ypcurrent); - if(r != 0) { + if (r != 0) { __ypcurrent = NULL; __ypmode = YPMODE_NONE; free(data); @@ -323,9 +326,9 @@ grscan(search, gid, name, p_gr, gs) free(data); } else { r = yp_first(__ypdomain, "group.byname", - &__ypcurrent, &__ypcurrentlen, - &data, &datalen); - if(r != 0) { + &__ypcurrent, &__ypcurrentlen, + &data, &datalen); + if (r != 0) { __ypmode = YPMODE_NONE; free(data); continue; @@ -335,14 +338,14 @@ grscan(search, gid, name, p_gr, gs) } break; case YPMODE_NAME: - if(grname != (char *)NULL) { + if (grname != (char *)NULL) { r = yp_match(__ypdomain, "group.byname", - grname, strlen(grname), - &data, &datalen); + grname, strlen(grname), + &data, &datalen); __ypmode = YPMODE_NONE; free(grname); grname = (char *)NULL; - if(r != 0) { + if (r != 0) { free(data); continue; } @@ -372,17 +375,17 @@ grscan(search, gid, name, p_gr, gs) } #ifdef YP if (line[0] == '+') { - switch(line[1]) { + switch (line[1]) { case ':': case '\0': case '\n': - if(_yp_check(NULL)) { + if (_yp_check(NULL)) { if (!search) { __ypmode = YPMODE_FULL; continue; } - if(!__ypdomain && - yp_get_default_domain(&__ypdomain)) + if (!__ypdomain && + yp_get_default_domain(&__ypdomain)) continue; if (name) { r = yp_match(__ypdomain, @@ -422,7 +425,7 @@ grscan(search, gid, name, p_gr, gs) } break; default: - if(_yp_check(NULL)) { + if (_yp_check(NULL)) { register char *tptr; tptr = strsep(&bp, ":\n"); diff --git a/lib/libc/gen/getnetgrent.c b/lib/libc/gen/getnetgrent.c index 235cba4d130..aec19041911 100644 --- a/lib/libc/gen/getnetgrent.c +++ b/lib/libc/gen/getnetgrent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getnetgrent.c,v 1.12 2002/02/17 19:42:22 millert Exp $ */ +/* $OpenBSD: getnetgrent.c,v 1.13 2002/07/06 03:07:41 deraadt Exp $ */ /* * Copyright (c) 1994 Christos Zoulas @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: getnetgrent.c,v 1.12 2002/02/17 19:42:22 millert Exp $"; +static char *rcsid = "$OpenBSD: getnetgrent.c,v 1.13 2002/07/06 03:07:41 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -262,8 +262,8 @@ lookup(ypdom, name, line, bywhat) int bywhat; { #ifdef YP - int i; - char *map = NULL; + int i; + char *map = NULL; #endif if (_ng_db) { @@ -324,7 +324,7 @@ lookup(ypdom, name, line, bywhat) * _ng_parse(): Parse a line and return: _NG_ERROR: Syntax Error _NG_NONE: * line was empty or a comment _NG_GROUP: line had a netgroup definition, * returned in ng _NG_NAME: line had a netgroup name, returned in name - * + * * Public since used by netgroup_mkdb */ int @@ -349,8 +349,8 @@ _ng_parse(p, name, ng) } return _NG_GROUP; } else { - char *np; - int i; + char *np; + int i; for (np = *p; **p && !_NG_ISSPACE(**p); (*p)++) continue; @@ -435,16 +435,16 @@ in_check(host, user, domain, ng) const char *domain; struct netgroup *ng; { - if ((host != NULL) && (ng->ng_host != NULL) - && strcmp(ng->ng_host, host) != 0) + if ((host != NULL) && (ng->ng_host != NULL) && + strcmp(ng->ng_host, host) != 0) return 0; - if ((user != NULL) && (ng->ng_user != NULL) - && strcmp(ng->ng_user, user) != 0) + if ((user != NULL) && (ng->ng_user != NULL) && + strcmp(ng->ng_user, user) != 0) return 0; - if ((domain != NULL) && (ng->ng_domain != NULL) - && strcmp(ng->ng_domain, domain) != 0) + if ((domain != NULL) && (ng->ng_domain != NULL) && + strcmp(ng->ng_domain, domain) != 0) return 0; return 1; @@ -592,11 +592,11 @@ in_lookup(ypdom, group, key, domain, map) /* Domain specified; look in "group.domain" and "*.domain" */ if ((line = in_lookup1(ypdom, key, domain, map)) == NULL) line = in_lookup1(ypdom, NULL, domain, map); - } else + } else line = NULL; if (line == NULL) { - /* + /* * domain not specified or domain lookup failed; look in * "group.*" and "*.*" */ |