1
0
Files
irix-657m-src/eoe/cmd/ns/tests/getprotobynumber_r.c
2022-09-29 17:59:04 +03:00

26 lines
508 B
C

#include <stdio.h>
#include <netdb.h>
main(int argc, char **argv)
{
struct protoent p;
int i;
char buf[4096];
for (argc--, argv++; argc > 0; argc--, argv++) {
if (! getprotobynumber_r(strtol(*argv, 0, 10), &p, buf,
sizeof(buf))) {
fprintf(stderr, "getprotobynumber_r failed for [%s]\n",
*argv);
} else {
printf("name = %s, number = %d\n",
p.p_name, p.p_proto);
for (i = 0; p.p_aliases[i]; i++) {
printf("\talias[%d]: %s\n", i,
p.p_aliases[i]);
}
}
}
}