+ f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf);
+ if (!f) return EAI_SERVICE;
+ while (fgets(line, sizeof line, f)) {
+ if (strncmp(line, serv, servlen))
+ continue;
+ if (sscanf(line+servlen, "%lu/%3s", &port, protname) < 2)
+ continue;
+ if (strcmp(protname, proto==IPPROTO_UDP ? "udp" : "tcp"))
+ continue;
+ break;
+ }
+ __fclose_ca(f);
+ if (feof(f)) return EAI_SERVICE;