A better version of rev 1.4.

Submitted by:	sheldonh
This commit is contained in:
David E. O'Brien 2000-08-27 01:38:10 +00:00
parent 7ffc2c4632
commit faad741d89
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=32016

View File

@ -1,23 +1,29 @@
--- tcpshow.c.orig Sat Aug 26 16:31:34 2000
+++ tcpshow.c Sat Aug 26 16:33:15 2000
@@ -359,15 +359,7 @@
+++ tcpshow.c Sat Aug 26 18:36:52 2000
@@ -357,17 +357,19 @@
typedef unsigned short uint2;
typedef unsigned int uint4;
typedef unsigned char uchar;
-#if !defined(NOETHERNAMES)
-// mr980118 ether_ntohost() and related functions aren't prototyped in the
-// standard include directory.
-extern struct ether_addr *ether_aton(char *);
-extern int ether_ntohost(char *, struct ether_addr *);
-#endif
-
-
+
+
#if !defined(NOETHERNAMES)
// mr980118 ether_ntohost() and related functions aren't prototyped in the
// standard include directory.
+#ifndef __FreeBSD__
extern struct ether_addr *ether_aton(char *);
extern int ether_ntohost(char *, struct ether_addr *);
#endif
+#endif
-void main(int, char **);
+int main(int, char **);
static boolean noBflag = FALSE;
@@ -1125,7 +1117,9 @@
@@ -1125,7 +1127,9 @@
static char *icmpType (uint1 type) {
char *descr;
@ -27,7 +33,7 @@
switch (type) {
case ECHO_REPLY: descr = "echo-reply"; break;
@@ -1143,7 +1137,7 @@
@@ -1143,7 +1147,7 @@
case INFO_REPLY: descr = "information-reply"; break;
case MASK_REQ: descr = "address-mask-request"; break;
case MASK_REPLY: descr = "address-mask-reply"; break;
@ -36,7 +42,7 @@
}
return descr;
@@ -1248,7 +1242,7 @@
@@ -1248,7 +1252,7 @@
/* */
/****==========------------------------------------------------==========****/
@ -45,7 +51,7 @@
/* Command line options. */
while (--argc > 0 && **++argv == '-')
@@ -1290,6 +1284,7 @@
@@ -1290,6 +1294,7 @@
for ( ; ; ) if (!setjmp(jmpBuf)) showPkt(pkt);
exit(0);
@ -53,7 +59,7 @@
}
@@ -1336,7 +1331,7 @@
@@ -1336,7 +1341,7 @@
name = number;
}
/* The crappy manpage doesn't say the port must be in net byte order. */
@ -62,7 +68,7 @@
name = service->s_name;
elif (!wantNumber)
name = unknown;
@@ -1580,13 +1575,14 @@
@@ -1580,13 +1585,14 @@
if (ppFlag) {
(void)sscanf(p, "%s", time);
etherType = ETHER_PROTO_IP; /* tcpdump doesn't supply link type */
@ -78,7 +84,7 @@
return getPkt();
}
@@ -1598,7 +1594,7 @@
@@ -1598,7 +1604,7 @@
(void)strcpy(eTo, etherAddr(eTo, 0));
(void)strcpy(eToName, etherName(eTo, TRUE));
@ -87,7 +93,7 @@
if (terseFlag) {
printf("TIME:\t%s%s\n", time, deltaTime(&prevTime, time));
printf(
@@ -1614,6 +1610,7 @@
@@ -1614,6 +1620,7 @@
if (!noEtherNames) printf(" (%s)", etherName(eTo, FALSE));
printf("\n\tEncapsulated Protocol:\t\t%s\n", etherProto(eType, 0));
}
@ -95,7 +101,7 @@
return getPkt();
@@ -1778,7 +1775,7 @@
@@ -1778,7 +1785,7 @@
static void showPkt (reg char *p) {
char *warnMsg = "<*** No decode support for encapsulated protocol ***>";
@ -104,7 +110,7 @@
prSep();
printf("Packet %d\n", ++nPktsShown);
@@ -1807,6 +1804,31 @@
@@ -1807,6 +1814,31 @@
p = showIcmp(p);
p = showData(p);
break;
@ -136,7 +142,7 @@
default:
printf("\t%s\n", warnMsg);
nextPkt(); /* Doesn't return */
@@ -1826,7 +1848,7 @@
@@ -1826,7 +1858,7 @@
}
/* Note that if getPkt() returns here, then the line read isn't the */
/* start of a new packet, i.e. there's spurious data. */
@ -145,7 +151,7 @@
if (sFlag) printf("\t<*** Spurious data at end: \"%s\" ***>\n", p);
nextPkt();
}
@@ -1996,10 +2018,10 @@
@@ -1996,10 +2028,10 @@
if (terseFlag) {
printf(
@ -159,7 +165,7 @@
printf(
"\thlen=%d (data=%u) UAPRSF=%s%s%s%s%s%s",
hLen, dataLen,
@@ -2016,9 +2038,9 @@
@@ -2016,9 +2048,9 @@
if (!noPortNames) printf(" (%s)", portName(sPort, "tcp", FALSE));
printf("\n\tDestination Port:\t\t%d", dPort);
if (!noPortNames) printf(" (%s)", portName(dPort, "tcp", FALSE));