"@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\
The Regents of the University of California. All rights reserved.\n";
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.174 2002-02-05 10:07:40 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.179 2002-07-11 09:17:25 guy Exp $ (LBL)";
#endif
/*
int xflag; /* print packet in hex */
int Xflag; /* print packet in ascii as well as hex */
off_t Cflag = 0; /* rotate dump files after this many bytes */
+int Aflag = 0; /* print packet only in ascii observing LF, CR, TAB, SPACE */
char *espsecret = NULL; /* ESP secret key */
#endif
#ifdef DLT_PFLOG
{ pflog_if_print, DLT_PFLOG },
+#endif
+#ifdef DLT_FR
+ { fr_if_print, DLT_FR },
+#endif
+#ifdef DLT_FRELAY
+ { fr_if_print, DLT_FRELAY },
+#endif
+#ifdef DLT_SUNATM
+ { sunatm_if_print, DLT_SUNATM },
#endif
{ NULL, 0 },
};
#ifdef LIBSMI
smiInit("tcpdump");
#endif
-
+
opterr = 0;
while (
- (op = getopt(argc, argv, "ac:C:deE:fF:i:lm:nNOpqr:Rs:StT:uvw:xXY")) != -1)
+ (op = getopt(argc, argv, "aAc:C:deE:fF:i:lm:nNOpqr:Rs:StT:uvw:xXY")) != -1)
switch (op) {
case 'a':
++aflag;
break;
+ case 'A':
+ ++xflag;
+ ++Xflag;
+ ++Aflag;
+ break;
+
case 'c':
cnt = atoi(optarg);
if (cnt <= 0)
case 'C':
Cflag = atoi(optarg) * 1000000;
- if (Cflag < 0)
+ if (Cflag < 0)
error("invalid file size %s", optarg);
break;
program_name, optarg);
(void)fprintf(stderr, "(no libsmi support)\n");
#endif
-
+
case 'O':
Oflag = 0;
break;
case 'u':
++uflag;
break;
-
+
case 'v':
++vflag;
break;
break;
case 'X':
- ++xflag;
+ ++xflag;
++Xflag;
break;
if (pcap_loop(pd, cnt, printer, pcap_userdata) < 0) {
(void)fprintf(stderr, "%s: pcap_loop: %s\n",
program_name, pcap_geterr(pd));
+ cleanup(0);
+ pcap_close(pd);
exit(1);
}
if (RFileName == NULL)
putc('\n', stderr);
info(1);
}
- exit(0);
+ if (signo)
+ exit(0);
}
void
char *name;
info = (struct dump_info *)user;
-
+
/*
* XXX - this won't prevent capture files from getting
* larger than Cflag - the last packet written to the
(void)fprintf(stderr, "%s version %s\n", program_name, version);
(void)fprintf(stderr, "libpcap version %s\n", pcap_version);
(void)fprintf(stderr,
-"Usage: %s [-adeflnNOpqRStuvxX] [ -c count ] [ -C file_size ]\n", program_name);
+"Usage: %s [-aAdeflnNOpqRStuvxX] [ -c count ] [ -C file_size ]\n", program_name);
(void)fprintf(stderr,
"\t\t[ -F file ] [ -i interface ] [ -r file ] [ -s snaplen ]\n");
(void)fprintf(stderr,