+ 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) || !isspace(line[servlen]))
+ continue;
+ port = strtoul(line+servlen, &end, 10);
+ if (strncmp(end, proto==IPPROTO_UDP ? "/udp" : "/tcp", 4))
+ continue;
+ break;
+ }
+ __fclose_ca(f);
+ if (feof(f)) return EAI_SERVICE;