4 static unsigned atou(char **s
)
7 for (x
=0; **s
-'0'<10U; ++*s
) x
=10*x
+(**s
-'0');
11 int __getgrent_a(FILE *f
, struct group
*gr
, char **line
, size_t *size
, char ***mem
, size_t *nmem
, struct group
**res
)
18 pthread_setcancelstate(PTHREAD_CANCEL_DISABLE
, &cs
);
20 if ((l
=getline(line
, size
, f
)) < 0) {
21 rv
= ferror(f
) ? errno
: 0;
31 if (!(s
= strchr(s
, ':'))) continue;
33 *s
++ = 0; gr
->gr_passwd
= s
;
34 if (!(s
= strchr(s
, ':'))) continue;
36 *s
++ = 0; gr
->gr_gid
= atou(&s
);
37 if (*s
!= ':') continue;
43 for (*nmem
=!!*s
; *s
; s
++)
46 *mem
= calloc(sizeof(char *), *nmem
+1);
56 for (s
=mems
, i
=0; *s
; s
++)
57 if (*s
==',') *s
++ = 0, mem
[0][++i
] = s
;
64 pthread_setcancelstate(cs
, 0);