summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/libcruft/getgrnam_r.c
blob: 00642c18ab68f6df4c8f9362ffb200a634e6b99a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <string.h>
#include <grp.h>

int getgrnam_r(const char* name,
	       struct group *res, char *buf, size_t buflen,
	       struct group **res_sig) {
  while (!getgrent_r(res,buf,buflen,res_sig))
    if (!strcmp(name,res->gr_name))
      goto ok;
  *res_sig=0;
ok:
  endgrent();
  return *res_sig?0:-1;
}