Return to fstat.c CVS log | Up to [local] / src / usr.bin / fstat |
version 1.23, 1999/07/01 21:41:58 | version 1.24, 1999/07/02 19:23:50 | ||
---|---|---|---|
|
|
||
#include <stdlib.h> | #include <stdlib.h> | ||
#include <string.h> | #include <string.h> | ||
#include <unistd.h> | #include <unistd.h> | ||
#include <netdb.h> | |||
#include <err.h> | #include <err.h> | ||
#include "fstat.h" | #include "fstat.h" | ||
|
|
||
getinetproto(number) | getinetproto(number) | ||
int number; | int number; | ||
{ | { | ||
char *cp; | static int isopen; | ||
register struct protoent *pe; | |||
switch(number) { | if (!isopen) | ||
case IPPROTO_IP: | setprotoent(++isopen); | ||
cp = "ip"; break; | if ((pe = getprotobynumber(number)) != NULL) | ||
case IPPROTO_ICMP: | printf(" %s", pe->p_name); | ||
cp ="icmp"; break; | else | ||
case IPPROTO_GGP: | |||
cp ="ggp"; break; | |||
case IPPROTO_TCP: | |||
cp ="tcp"; break; | |||
case IPPROTO_EGP: | |||
cp ="egp"; break; | |||
case IPPROTO_PUP: | |||
cp ="pup"; break; | |||
case IPPROTO_UDP: | |||
cp ="udp"; break; | |||
case IPPROTO_IDP: | |||
cp ="idp"; break; | |||
case IPPROTO_RAW: | |||
cp ="raw"; break; | |||
default: | |||
printf(" %d", number); | printf(" %d", number); | ||
return; | |||
} | |||
printf(" %s", cp); | |||
} | } | ||
int | int |