getservbyname.c 258 B

1234567891011
  1. #include <netdb.h>
  2. struct servent *getservbyname(const char *name, const char *prots)
  3. {
  4. static struct servent se;
  5. static char *buf[2];
  6. struct servent *res;
  7. if (getservbyname_r(name, prots, &se, (void *)buf, sizeof buf, &res))
  8. return 0;
  9. return &se;
  10. }