diff options
author | ghelmer <ghelmer@FreeBSD.org> | 2012-05-21 21:04:29 +0000 |
---|---|---|
committer | ghelmer <ghelmer@FreeBSD.org> | 2012-05-21 21:04:29 +0000 |
commit | 34a5029ece102bff8ead64df3a673aa566b9c6fe (patch) | |
tree | 3d75a335ec26757e309c30df167139cd09c186a7 | |
parent | 83179ad85bfcd69fe295f2ce56d2d838dd413d78 (diff) | |
download | FreeBSD-src-34a5029ece102bff8ead64df3a673aa566b9c6fe.zip FreeBSD-src-34a5029ece102bff8ead64df3a673aa566b9c6fe.tar.gz |
Apply style(9) to return and switch/case statements.
Reviewed by: delphij (prior version of the patch)
-rw-r--r-- | lib/libc/gen/getnetgrent.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/lib/libc/gen/getnetgrent.c b/lib/libc/gen/getnetgrent.c index ca75d9b..ea8ccae 100644 --- a/lib/libc/gen/getnetgrent.c +++ b/lib/libc/gen/getnetgrent.c @@ -292,12 +292,12 @@ _listmatch(const char *list, const char *group, int len) while(*ptr != ',' && *ptr != '\0' && !isspace((unsigned char)*ptr)) ptr++; if (strncmp(cptr, group, glen) == 0 && glen == (ptr - cptr)) - return(1); + return (1); while(*ptr == ',' || isspace((unsigned char)*ptr)) ptr++; } - return(0); + return (0); } static int @@ -311,32 +311,35 @@ _revnetgr_lookup(char* lookupdom, char* map, const char* str, for (rot = 0; ; rot++) { switch (rot) { - case(0): snprintf(key, MAXHOSTNAMELEN, "%s.%s", - str, dom?dom:lookupdom); - break; - case(1): snprintf(key, MAXHOSTNAMELEN, "%s.*", - str); - break; - case(2): snprintf(key, MAXHOSTNAMELEN, "*.%s", - dom?dom:lookupdom); - break; - case(3): snprintf(key, MAXHOSTNAMELEN, "*.*"); - break; - default: return(0); + case(0): + snprintf(key, MAXHOSTNAMELEN, "%s.%s", str, + dom ? dom : lookupdom); + break; + case(1): + snprintf(key, MAXHOSTNAMELEN, "%s.*", str); + break; + case(2): + snprintf(key, MAXHOSTNAMELEN, "*.%s", + dom ? dom : lookupdom); + break; + case(3): + snprintf(key, MAXHOSTNAMELEN, "*.*"); + break; + default: return (0); } y = yp_match(lookupdom, map, key, strlen(key), &result, &resultlen); if (y == 0) { rv = _listmatch(result, group, resultlen); free(result); - if (rv) return(1); + if (rv) return (1); } else if (y != YPERR_KEY) { /* * If we get an error other than 'no * such key in map' then something is * wrong and we should stop the search. */ - return(-1); + return (-1); } } } @@ -386,14 +389,14 @@ innetgr(const char *group, const char *host, const char *user, const char *dom) if (_use_only_yp && (host == NULL) != (user == NULL)) { int ret; if(yp_get_default_domain(&_netgr_yp_domain)) - return(0); + return (0); ret = _revnetgr_lookup(_netgr_yp_domain, host?"netgroup.byhost":"netgroup.byuser", host?host:user, dom, group); if (ret == 1) - return(1); + return (1); else if (ret == 0 && dom != NULL) - return(0); + return (0); } setnetgrent(group); |