Deleted Added
full compact
main.c (153809) main.c (160787)
1/*
2 * Copyright (c) 1983, 1988, 1993
3 * Regents of the University of California. 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
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

39
40#if 0
41#ifndef lint
42static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 3/1/94";
43#endif /* not lint */
44#endif
45
46#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1983, 1988, 1993
3 * Regents of the University of California. 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
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

39
40#if 0
41#ifndef lint
42static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 3/1/94";
43#endif /* not lint */
44#endif
45
46#include <sys/cdefs.h>
47__FBSDID("$FreeBSD: head/usr.bin/netstat/main.c 153809 2005-12-28 20:36:55Z kbyanc $");
47__FBSDID("$FreeBSD: head/usr.bin/netstat/main.c 160787 2006-07-28 16:09:19Z yar $");
48
49#include <sys/param.h>
50#include <sys/file.h>
51#include <sys/protosw.h>
52#include <sys/socket.h>
53
54#include <netinet/in.h>
55
56#include <netgraph/ng_socket.h>
57
58#include <ctype.h>
59#include <err.h>
60#include <errno.h>
61#include <kvm.h>
62#include <limits.h>
63#include <netdb.h>
64#include <nlist.h>
65#include <paths.h>
48
49#include <sys/param.h>
50#include <sys/file.h>
51#include <sys/protosw.h>
52#include <sys/socket.h>
53
54#include <netinet/in.h>
55
56#include <netgraph/ng_socket.h>
57
58#include <ctype.h>
59#include <err.h>
60#include <errno.h>
61#include <kvm.h>
62#include <limits.h>
63#include <netdb.h>
64#include <nlist.h>
65#include <paths.h>
66#include <stdint.h>
66#include <stdio.h>
67#include <stdlib.h>
68#include <string.h>
69#include <unistd.h>
70#include "netstat.h"
71
72static struct nlist nl[] = {
73#define N_IFNET 0

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

268#ifdef IPSEC
269 pfkeyprotox,
270#endif
271#ifdef IPX
272 ipxprotox,
273#endif
274 atalkprotox, NULL };
275
67#include <stdio.h>
68#include <stdlib.h>
69#include <string.h>
70#include <unistd.h>
71#include "netstat.h"
72
73static struct nlist nl[] = {
74#define N_IFNET 0

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

269#ifdef IPSEC
270 pfkeyprotox,
271#endif
272#ifdef IPX
273 ipxprotox,
274#endif
275 atalkprotox, NULL };
276
276const char *pluralies(int);
277static void printproto(struct protox *, const char *);
278static void usage(void);
279static struct protox *name2protox(char *);
280static struct protox *knownname(char *);
281
282static kvm_t *kvmd;
283static char *nlistf = NULL, *memf = NULL;
284

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

652 if (kvm_read(kvmd, addr, buf, size) != size) {
653 warnx("%s", kvm_geterr(kvmd));
654 return (-1);
655 }
656 return (0);
657}
658
659const char *
277static void printproto(struct protox *, const char *);
278static void usage(void);
279static struct protox *name2protox(char *);
280static struct protox *knownname(char *);
281
282static kvm_t *kvmd;
283static char *nlistf = NULL, *memf = NULL;
284

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

652 if (kvm_read(kvmd, addr, buf, size) != size) {
653 warnx("%s", kvm_geterr(kvmd));
654 return (-1);
655 }
656 return (0);
657}
658
659const char *
660plural(int n)
660plural(uintmax_t n)
661{
662 return (n != 1 ? "s" : "");
663}
664
665const char *
661{
662 return (n != 1 ? "s" : "");
663}
664
665const char *
666plurales(int n)
666plurales(uintmax_t n)
667{
668 return (n != 1 ? "es" : "");
669}
670
671const char *
667{
668 return (n != 1 ? "es" : "");
669}
670
671const char *
672pluralies(int n)
672pluralies(uintmax_t n)
673{
674 return (n != 1 ? "ies" : "y");
675}
676
677/*
678 * Find the protox for the given "well-known" name.
679 */
680static struct protox *

--- 61 unchanged lines hidden ---
673{
674 return (n != 1 ? "ies" : "y");
675}
676
677/*
678 * Find the protox for the given "well-known" name.
679 */
680static struct protox *

--- 61 unchanged lines hidden ---