summaryrefslogtreecommitdiff
path: root/libc/pwd_grp/__sgetspent_r.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-10-10 07:34:27 +0000
committerEric Andersen <andersen@codepoet.org>2003-10-10 07:34:27 +0000
commit56104838733c81ba410ac41f767ac72267049489 (patch)
tree54057d78cdae893235b86787a735629396d857a5 /libc/pwd_grp/__sgetspent_r.c
parent61011662018fa98c4610c1ae826e417678cd5c80 (diff)
Implement getgrgid_r and getgrnam_r. Rework group handling code to be fully
reentrant, since there was still a shared static value. indent stuff,
Diffstat (limited to 'libc/pwd_grp/__sgetspent_r.c')
-rw-r--r--libc/pwd_grp/__sgetspent_r.c58
1 files changed, 30 insertions, 28 deletions
diff --git a/libc/pwd_grp/__sgetspent_r.c b/libc/pwd_grp/__sgetspent_r.c
index d11cfe62e..fbd40fc62 100644
--- a/libc/pwd_grp/__sgetspent_r.c
+++ b/libc/pwd_grp/__sgetspent_r.c
@@ -1,5 +1,7 @@
+/* vi: set sw=4 ts=4: */
/*
* __sgetspent_r.c - Based on __getpwent_r.c
+ * Copyright (C) 2001-2003 Erik Andersen <andersee@debian.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -46,7 +48,7 @@ int __sgetspent_r(const char * string, struct spwd * spwd, char * line_buff, siz
}
if (*line_buff == '#' || *line_buff == ' ' || *line_buff == '\n' ||
- *line_buff == '\t')
+ *line_buff == '\t')
return EINVAL;
field_begin = strchr(line_buff, '\n');
@@ -57,33 +59,33 @@ int __sgetspent_r(const char * string, struct spwd * spwd, char * line_buff, siz
field_begin = line_buff;
for (i = 0; i < 9; i++) {
switch (i) {
- case 0:
- spwd->sp_namp = field_begin;
- break;
- case 1:
- spwd->sp_pwdp = field_begin;
- break;
- case 2:
- lstchg_ptr = field_begin;
- break;
- case 3:
- min_ptr = field_begin;
- break;
- case 4:
- max_ptr = field_begin;
- break;
- case 5:
- warn_ptr = field_begin;
- break;
- case 6:
- inact_ptr = field_begin;
- break;
- case 7:
- expire_ptr = field_begin;
- break;
- case 8:
- flag_ptr = field_begin;
- break;
+ case 0:
+ spwd->sp_namp = field_begin;
+ break;
+ case 1:
+ spwd->sp_pwdp = field_begin;
+ break;
+ case 2:
+ lstchg_ptr = field_begin;
+ break;
+ case 3:
+ min_ptr = field_begin;
+ break;
+ case 4:
+ max_ptr = field_begin;
+ break;
+ case 5:
+ warn_ptr = field_begin;
+ break;
+ case 6:
+ inact_ptr = field_begin;
+ break;
+ case 7:
+ expire_ptr = field_begin;
+ break;
+ case 8:
+ flag_ptr = field_begin;
+ break;
}
if (i < 8) {
field_begin = strchr(field_begin, ':');