]> 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]>
Fri, 6 Oct 2023 07:59:26 +0000 (09:59 +0200)
(cherry picked from commit 3f7d71ef1e4ed84e4aba0b125c1aebb37f611884)

tcpdump.c

index b04eb4a9631d43d6a5247851ca341b587ca75b41..eb25850c7ca9997f64628a2f7f33846df4caad37 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -470,13 +470,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]);