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

int getspnam_r(const char* name,
	       struct spwd *res, char *buf, size_t buflen,
	       struct spwd **res_sig) {
  while (!getspent_r(res,buf,buflen,res_sig))
    if (!strcmp(name,res->sp_namp))
      goto ok;
  *res_sig=0;
ok:
  endspent();
  return *res_sig?0:-1;
}