diff options
| author | Ruslan Ermilov <ru@FreeBSD.org> | 1999-07-02 13:25:49 +0000 |
|---|---|---|
| committer | Ruslan Ermilov <ru@FreeBSD.org> | 1999-07-02 13:25:49 +0000 |
| commit | 0b7a57dd489eea5ac02e2621b7f8c22f1eb17bac (patch) | |
| tree | 834ce8a2f91dbf5e608b5225a81e29dd84b5c320 /usr.bin/fstat | |
| parent | 1361b1fd7609554bf606498b97d45b11e8486d70 (diff) | |
Notes
Diffstat (limited to 'usr.bin/fstat')
| -rw-r--r-- | usr.bin/fstat/Makefile | 3 | ||||
| -rw-r--r-- | usr.bin/fstat/fstat.c | 37 |
2 files changed, 14 insertions, 26 deletions
diff --git a/usr.bin/fstat/Makefile b/usr.bin/fstat/Makefile index 32d0aefdad88..6ff6ab1224c4 100644 --- a/usr.bin/fstat/Makefile +++ b/usr.bin/fstat/Makefile @@ -1,7 +1,8 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 -# $Id$ +# $Id: Makefile,v 1.2 1997/08/22 14:22:31 jmg Exp $ PROG= fstat +CFLAGS+=-Wall CFLAGS+=-I${.CURDIR}/../../sys DPADD= ${LIBKVM} LDADD= -lkvm diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c index eef56982f0d9..424f1379daad 100644 --- a/usr.bin/fstat/fstat.c +++ b/usr.bin/fstat/fstat.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)fstat.c 8.3 (Berkeley) 5/2/95"; #endif static const char rcsid[] = - "$Id: fstat.c,v 1.15 1998/05/16 21:35:37 markm Exp $"; + "$Id: fstat.c,v 1.16 1998/07/06 21:01:16 bde Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -90,6 +90,7 @@ static const char rcsid[] = #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <netdb.h> #define TEXT -1 #define CDIR -2 @@ -535,6 +536,9 @@ nfs_filestat(vp, fsp) case VFIFO: mode |= S_IFIFO; break; + case VNON: + case VBAD: + return 0; }; fsp->mode = mode; @@ -733,32 +737,15 @@ void getinetproto(number) int number; { - char *cp; + static int isopen; + register struct protoent *pe; - switch(number) { - case IPPROTO_IP: - cp = "ip"; break; - case IPPROTO_ICMP: - cp ="icmp"; break; - 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: + if (!isopen) + setprotoent(++isopen); + if ((pe = getprotobynumber(number)) != NULL) + printf(" %s", pe->p_name); + else printf(" %d", number); - return; - } - printf(" %s", cp); } int |
