]> The Tcpdump Group git mirrors - tcpdump/blobdiff - tcpdump.c
Remove unnecessary test.
[tcpdump] / tcpdump.c
index 10b6239d5793d3c39c14f31c9aca007bce244a7e..ee9304d55f8cc8aeeef0bc5d348945fe4ac52797 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -115,7 +115,8 @@ static void ndo_default_print(netdissect_options *, const u_char *, u_int);
 static void dump_packet_and_trunc(u_char *, const struct pcap_pkthdr *, const u_char *);
 static void dump_packet(u_char *, const struct pcap_pkthdr *, const u_char *);
 static void droproot(const char *, const char *);
-static void ndo_error(netdissect_options *ndo, const char *fmt, ...);
+static void ndo_error(netdissect_options *ndo, const char *fmt, ...)
+     __attribute__ ((noreturn, format (printf, 2, 3)));
 static void ndo_warning(netdissect_options *ndo, const char *fmt, ...);
 
 #ifdef SIGINFO
@@ -313,6 +314,12 @@ static struct ndo_printer ndo_printers[] = {
 #endif
 #ifdef DLT_PPI
        { ppi_if_print,         DLT_PPI },
+#endif
+#ifdef DLT_NETANALYZER
+       { netanalyzer_if_print, DLT_NETANALYZER },
+#endif
+#ifdef DLT_NETANALYZER_TRANSPARENT
+       { netanalyzer_transparent_if_print, DLT_NETANALYZER_TRANSPARENT },
 #endif
        { NULL,                 0 },
 };
@@ -651,9 +658,8 @@ main(int argc, char **argv)
        smiInit("tcpdump");
 #endif
 
-       opterr = 0;
        while (
-           (op = getopt(argc, argv, "aAb" B_FLAG "c:C:d" D_FLAG "eE:fF:G:hi:" I_FLAG j_FLAG J_FLAG "KlLm:M:nNOpqr:Rs:StT:u" U_FLAG "vw:W:xXy:Yz:Z:")) != -1)
+           (op = getopt(argc, argv, "aAb" B_FLAG "c:C:d" D_FLAG "eE:fF:G:hHi:" I_FLAG j_FLAG J_FLAG "KlLm:M:nNOpqr:Rs:StT:u" U_FLAG "vw:W:xXy:Yz:Z:")) != -1)
                switch (op) {
 
                case 'a':
@@ -747,7 +753,11 @@ main(int argc, char **argv)
                        break;
 
                case 'h':
-                       ++hflag;
+                       usage();
+                       break;
+
+               case 'H':
+                       ++Hflag;
                        break;
 
                case 'i':
@@ -1894,7 +1904,7 @@ usage(void)
 #endif /* WIN32 */
 #endif /* HAVE_PCAP_LIB_VERSION */
        (void)fprintf(stderr,
-"Usage: %s [-aAbd" D_FLAG "efh" 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,