From dd004da290c46c50b50ee5c919ad6eab35694921 Mon Sep 17 00:00:00 2001 From: brian Date: Wed, 14 Mar 2001 20:51:26 +0000 Subject: MAXHOSTNAMELEN includes space for a NUL. Don't roll our own version of trimdomain(), use the one in libutil. Not objected to by: freebsd-audit --- usr.bin/netstat/main.c | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'usr.bin/netstat/main.c') diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index 9c128aa..5c23f3c 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -702,33 +702,3 @@ usage() " netstat [-M core] [-N system] [-p protocol]"); exit(1); } - -void -trimdomain(cp) - char *cp; -{ - static char domain[MAXHOSTNAMELEN + 1]; - static int first = 1; - char *s; - - if (first) { - first = 0; - if (gethostname(domain, MAXHOSTNAMELEN) == 0 && - (s = strchr(domain, '.'))) - (void) strcpy(domain, s + 1); - else - domain[0] = 0; - } - - if (domain[0]) { - while ((cp = strchr(cp, '.'))) { - if (!strcasecmp(cp + 1, domain)) { - *cp = 0; /* hit it */ - break; - } else { - cp++; - } - } - } -} - -- cgit v1.1