]> The Tcpdump Group git mirrors - tcpdump/blobdiff - tcpdump.c
Print both the name and the description of a link-layer type (the name
[tcpdump] / tcpdump.c
index 12160045906301a52362c2312a687a232ccb2876..0969b7b938678654194225beeca956558fdc46af 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -30,7 +30,7 @@ static const char copyright[] _U_ =
     "@(#) 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[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.216.2.3 2003-11-18 08:53:40 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.216.2.4 2003-11-18 23:12:11 guy Exp $ (LBL)";
 #endif
 
 /*
@@ -256,7 +256,8 @@ show_dlts_and_exit(pcap_t *pd)
        while (--n_dlts >= 0) {
                dlt_name = pcap_datalink_val_to_name(dlts[n_dlts]);
                if (dlt_name != NULL) {
-                       (void) fprintf(stderr, "  %s", dlt_name);
+                       (void) fprintf(stderr, "  %s (%s)", dlt_name,
+                           pcap_datalink_val_to_description(dlts[n_dlts]));
 
                        /*
                         * OK, does tcpdump handle that type?
@@ -634,10 +635,14 @@ main(int argc, char **argv)
                        error("%s", ebuf);
                dlt = pcap_datalink(pd);
                dlt_name = pcap_datalink_val_to_name(dlt);
-               if (dlt_name == NULL)
-                       dlt_name = "???";
-                printf("reading from file %s, link-type %u (%s)\n",
-                      RFileName, dlt, dlt_name);
+               if (dlt_name == NULL) {
+                       printf("reading from file %s, link-type %u\n",
+                           RFileName, dlt);
+               } else {
+                       printf("reading from file %s, link-type %s (%s)\n",
+                           RFileName, dlt_name,
+                           pcap_datalink_val_to_description(dlt));
+               }
                localnet = 0;
                netmask = 0;
                if (fflag != 0)
@@ -783,10 +788,14 @@ main(int argc, char **argv)
                        (void)fprintf(stderr, "%s: ", program_name);
                dlt = pcap_datalink(pd);
                dlt_name = pcap_datalink_val_to_name(dlt);
-               if (dlt_name == NULL)
-                       dlt_name = "???";
-               (void)fprintf(stderr, "listening on %s, link-type %u (%s), capture size %u bytes\n",
-                   device, dlt, dlt_name, snaplen);
+               if (dlt_name == NULL) {
+                       (void)fprintf(stderr, "listening on %s, link-type %u, capture size %u bytes\n",
+                           device, dlt, snaplen);
+               } else {
+                       (void)fprintf(stderr, "listening on %s, link-type %s (%s), capture size %u bytes\n",
+                           device, dlt_name,
+                           pcap_datalink_val_to_description(dlt), snaplen);
+               }
                (void)fflush(stderr);
        }
 #endif /* WIN32 */