]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Factorize some code
authorFrancois-Xavier Le Bail <[email protected]>
Thu, 8 Jul 2021 09:55:21 +0000 (11:55 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Thu, 8 Jul 2021 09:55:21 +0000 (11:55 +0200)
tcpdump.c

index 613179563693efabc63fd54f8e85870973d294c0..b7b6f99555eb9863a4d837f6c0c1109758785c81 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -456,13 +456,15 @@ show_dlts_and_exit(pcap_t *pc, const char *device)
         * monitor mode might be different from the ones available when
         * not in monitor mode).
         */
+       (void) fprintf(stdout, "Data link types for ");
        if (supports_monitor_mode)
-               (void) fprintf(stdout, "Data link types for %s %s (use option -y to set):\n",
+               (void) fprintf(stdout, "%s %s",
                    device,
                    Iflag ? "when in monitor mode" : "when not in monitor mode");
        else
-               (void) fprintf(stdout, "Data link types for %s (use option -y to set):\n",
+               (void) fprintf(stdout, "%s",
                    device);
+       (void) fprintf(stdout, " (use option -y to set):\n");
 
        for (i = 0; i < n_dlts; i++) {
                dlt_name = pcap_datalink_val_to_name(dlts[i]);