--- dietlibc/t.c 2001/10/24 17:06:03 1.182 +++ dietlibc/t.c 2001/10/25 22:23:55 1.183 @@ -111,15 +111,28 @@ int traverse(const char* file, const str #endif int main(int argc,char *argv[]) { - struct servent* se; - if (se=getservbyname("pop-3","tcp")) { +#ifdef NEW + struct protoent se,*tmp; + char buf[1000]; + while (getprotoent_r(&se,buf,sizeof(buf),&tmp)==0) { int i; - printf("name %s\tport %d\tproto %s\n",se->s_name,se->s_port,se->s_proto); + printf("name %s\tproto %d\n",se.p_name,se.p_proto); for (i=0; i<16; ++i) { - if (!se->s_aliases[i]) break; - printf(" alias %s\n",se->s_aliases[i]); + if (!se.p_aliases[i]) break; + printf(" alias %s\n",se.p_aliases[i]); } } +#else + struct protoent* se; + while (se=getprotoent()) { + int i; + printf("name %s\tproto %d\n",se->p_name,se->p_proto); + for (i=0; i<16; ++i) { + if (!se->p_aliases[i]) break; + printf(" alias %s\n",se->p_aliases[i]); + } + } +#endif #if 0 fd_set f; struct timeval tv;