Deleted Added
full compact
sctp.c (224271) sctp.c (229403)
1/*-
2 * Copyright (c) 2001-2007, by Weongyo Jeong. All rights reserved.
3 * Copyright (c) 2011, by Michael Tuexen. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * a) Redistributions of source code must retain the above copyright notice,

--- 22 unchanged lines hidden (view full) ---

31
32#if 0
33#ifndef lint
34static char sccsid[] = "@(#)sctp.c 0.1 (Berkeley) 4/18/2007";
35#endif /* not lint */
36#endif
37
38#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2001-2007, by Weongyo Jeong. All rights reserved.
3 * Copyright (c) 2011, by Michael Tuexen. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * a) Redistributions of source code must retain the above copyright notice,

--- 22 unchanged lines hidden (view full) ---

31
32#if 0
33#ifndef lint
34static char sccsid[] = "@(#)sctp.c 0.1 (Berkeley) 4/18/2007";
35#endif /* not lint */
36#endif
37
38#include <sys/cdefs.h>
39__FBSDID("$FreeBSD: head/usr.bin/netstat/sctp.c 224271 2011-07-22 16:42:12Z tuexen $");
39__FBSDID("$FreeBSD: head/usr.bin/netstat/sctp.c 229403 2012-01-03 18:51:58Z ed $");
40
41#include <sys/param.h>
42#include <sys/queue.h>
43#include <sys/types.h>
44#include <sys/socket.h>
45#include <sys/socketvar.h>
46#include <sys/sysctl.h>
47#include <sys/protosw.h>

--- 109 unchanged lines hidden (view full) ---

157 static char line[50];
158 struct hostent *hp;
159 static char domain[MAXHOSTNAMELEN];
160 static int first = 1;
161
162 if (first && !numeric_addr) {
163 first = 0;
164 if (gethostname(domain, MAXHOSTNAMELEN) == 0 &&
40
41#include <sys/param.h>
42#include <sys/queue.h>
43#include <sys/types.h>
44#include <sys/socket.h>
45#include <sys/socketvar.h>
46#include <sys/sysctl.h>
47#include <sys/protosw.h>

--- 109 unchanged lines hidden (view full) ---

157 static char line[50];
158 struct hostent *hp;
159 static char domain[MAXHOSTNAMELEN];
160 static int first = 1;
161
162 if (first && !numeric_addr) {
163 first = 0;
164 if (gethostname(domain, MAXHOSTNAMELEN) == 0 &&
165 (cp = index(domain, '.')))
165 (cp = strchr(domain, '.')))
166 (void) strcpy(domain, cp + 1);
167 else
168 domain[0] = 0;
169 }
170 cp = 0;
171 if (!numeric_addr && !IN6_IS_ADDR_UNSPECIFIED(in6p)) {
172 hp = gethostbyaddr((char *)in6p, sizeof(*in6p), AF_INET6);
173 if (hp) {
166 (void) strcpy(domain, cp + 1);
167 else
168 domain[0] = 0;
169 }
170 cp = 0;
171 if (!numeric_addr && !IN6_IS_ADDR_UNSPECIFIED(in6p)) {
172 hp = gethostbyaddr((char *)in6p, sizeof(*in6p), AF_INET6);
173 if (hp) {
174 if ((cp = index(hp->h_name, '.')) &&
174 if ((cp = strchr(hp->h_name, '.')) &&
175 !strcmp(cp + 1, domain))
176 *cp = 0;
177 cp = hp->h_name;
178 }
179 }
180 if (IN6_IS_ADDR_UNSPECIFIED(in6p))
181 strcpy(line, "*");
182 else if (cp)

--- 21 unchanged lines hidden (view full) ---

204 case AF_INET6:
205 sprintf(line, "%.*s.", Wflag ? 39 : 16, inet6name(&address->sin6.sin6_addr));
206 break;
207#endif
208 default:
209 sprintf(line, "%.*s.", Wflag ? 39 : 16, "");
210 break;
211 }
175 !strcmp(cp + 1, domain))
176 *cp = 0;
177 cp = hp->h_name;
178 }
179 }
180 if (IN6_IS_ADDR_UNSPECIFIED(in6p))
181 strcpy(line, "*");
182 else if (cp)

--- 21 unchanged lines hidden (view full) ---

204 case AF_INET6:
205 sprintf(line, "%.*s.", Wflag ? 39 : 16, inet6name(&address->sin6.sin6_addr));
206 break;
207#endif
208 default:
209 sprintf(line, "%.*s.", Wflag ? 39 : 16, "");
210 break;
211 }
212 cp = index(line, '\0');
212 cp = strchr(line, '\0');
213 if (!num_port && port)
214 sp = getservbyport((int)port, "sctp");
215 if (sp || port == 0)
216 sprintf(cp, "%.15s ", sp ? sp->s_name : "*");
217 else
218 sprintf(cp, "%d ", ntohs((u_short)port));
219 width = Wflag ? 45 : 22;
220 printf("%-*.*s ", width, width, line);

--- 561 unchanged lines hidden ---
213 if (!num_port && port)
214 sp = getservbyport((int)port, "sctp");
215 if (sp || port == 0)
216 sprintf(cp, "%.15s ", sp ? sp->s_name : "*");
217 else
218 sprintf(cp, "%d ", ntohs((u_short)port));
219 width = Wflag ? 45 : 22;
220 printf("%-*.*s ", width, width, line);

--- 561 unchanged lines hidden ---