summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/libugly/getprotobynumber_r.c
blob: 2ca439fc68ecbcfc5f5aad89afa7ddac66c9f6ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <string.h>
#include <netdb.h>

extern int getprotobynumber_r(int proto,
			   struct protoent *res, char *buf, size_t buflen,
			   struct protoent **res_sig) {
  while (!getprotoent_r(res,buf,buflen,res_sig))
    if (proto==res->p_proto) goto found;
  *res_sig=0;
found:
  endprotoent();
  return *res_sig?0:-1;
}