summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancois-Xavier Le Bail <fx.lebail@yahoo.com>2014-07-10 14:47:11 +0200
committerFrancois-Xavier Le Bail <fx.lebail@yahoo.com>2014-07-10 14:47:11 +0200
commitf22c9ec50c5ab77d06e726cc358877b56dab13d3 (patch)
treef04d086d8086bd2493a5ddbefccd847b0513338a
parent572d63471c921ba47c0a64fdde867a4afc801ea0 (diff)
downloadtcpdump-f22c9ec50c5ab77d06e726cc358877b56dab13d3.tar.gz
add a short option '#', same as long option '--number' (print a packet number)
-rw-r--r--tcpdump.1.in5
-rw-r--r--tcpdump.c13
2 files changed, 10 insertions, 8 deletions
diff --git a/tcpdump.1.in b/tcpdump.1.in
index efc08653..b2cbe784 100644
--- a/tcpdump.1.in
+++ b/tcpdump.1.in
@@ -27,7 +27,7 @@ tcpdump \- dump traffic on a network
.na
.B tcpdump
[
-.B \-AbdDefhHIJKlLnNOpqRStuUvxX
+.B \-AbdDefhHIJKlLnNOpqRStuUvxX#
] [
.B \-B
.I buffer_size
@@ -534,6 +534,9 @@ E.g.,
if you give this flag then \fItcpdump\fP will print ``nic''
instead of ``nic.ddn.mil''.
.TP
+.B \-#
+.PD 0
+.TP
.B \-\-number
Print an optional packet number at the beginning of the line.
.TP
diff --git a/tcpdump.c b/tcpdump.c
index 7db319aa..25ff1802 100644
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -648,9 +648,8 @@ show_devices_and_exit (void)
* component of the entry for the long option, and have a case for that
* option in the switch statement.
*/
-#define OPTION_NUMBER 128
-#define OPTION_VERSION 129
-#define OPTION_TSTAMP_PRECISION 130
+#define OPTION_VERSION 128
+#define OPTION_TSTAMP_PRECISION 129
static const struct option longopts[] = {
#if defined(HAVE_PCAP_CREATE) || defined(WIN32)
@@ -686,7 +685,7 @@ static const struct option longopts[] = {
{ "debug-filter-parser", no_argument, NULL, 'Y' },
#endif
{ "relinquish-privileges", required_argument, NULL, 'Z' },
- { "number", no_argument, NULL, OPTION_NUMBER },
+ { "number", no_argument, NULL, '#' },
{ "version", no_argument, NULL, OPTION_VERSION },
{ NULL, 0, NULL, 0 }
};
@@ -945,7 +944,7 @@ main(int argc, char **argv)
#endif
while (
- (op = getopt_long(argc, argv, "aAb" B_FLAG "c:C:d" D_FLAG "eE:fF:G:hHi:" I_FLAG j_FLAG J_FLAG "KlLm:M:nNOpq" Q_FLAG "r:Rs:StT:u" U_FLAG "vV:w:W:xXy:Yz:Z:", longopts, NULL)) != -1)
+ (op = getopt_long(argc, argv, "aAb" B_FLAG "c:C:d" D_FLAG "eE:fF:G:hHi:" I_FLAG j_FLAG J_FLAG "KlLm:M:nNOpq" Q_FLAG "r:Rs:StT:u" U_FLAG "vV:w:W:xXy:Yz:Z:#", longopts, NULL)) != -1)
switch (op) {
case 'a':
@@ -1306,7 +1305,7 @@ main(int argc, char **argv)
username = strdup(optarg);
break;
- case OPTION_NUMBER:
+ case '#':
gndo->ndo_packet_number = 1;
break;
@@ -2365,7 +2364,7 @@ print_usage(void)
{
print_version();
(void)fprintf(stderr,
-"Usage: %s [-aAbd" D_FLAG "efhH" I_FLAG J_FLAG "KlLnNOpqRStu" U_FLAG "vxX]" B_FLAG_USAGE " [ -c count ]\n", program_name);
+"Usage: %s [-aAbd" D_FLAG "efhH" I_FLAG J_FLAG "KlLnNOpqRStu" U_FLAG "vxX#]" B_FLAG_USAGE " [ -c count ]\n", program_name);
(void)fprintf(stderr,
"\t\t[ -C file_size ] [ -E algo:secret ] [ -F file ] [ -G seconds ]\n");
(void)fprintf(stderr,