]> The Tcpdump Group git mirrors - tcpdump/commitdiff
convert some stray printf()'s
authorDenis Ovsienko <[email protected]>
Wed, 2 Apr 2014 14:55:24 +0000 (18:55 +0400)
committerDenis Ovsienko <[email protected]>
Wed, 2 Apr 2014 14:55:50 +0000 (18:55 +0400)
print-ntp.c
print-olsr.c
print-pppoe.c
print-sl.c

index 367d9fe5148957ecb3bd86ca4826e3c3e83ee846..5dd0e240bf0024424d50390a3577f338bbc6c921 100644 (file)
@@ -215,21 +215,21 @@ ntp_print(netdissect_options *ndo,
        ND_PRINT((ndo, "NTPv%d", version));
 
        mode = bp->status & MODEMASK;
-        if (!ndo->ndo_vflag) {
-            printf (", %s, length %u",
-                    tok2str(ntp_mode_values, "Unknown mode", mode),
-                    length);
-            return;
-        }
+       if (!ndo->ndo_vflag) {
+               ND_PRINT((ndo, ", %s, length %u",
+                         tok2str(ntp_mode_values, "Unknown mode", mode),
+                         length));
+               return;
+       }
 
-        printf (", length %u\n\t%s",
-                length,
-                tok2str(ntp_mode_values, "Unknown mode", mode));
+       ND_PRINT((ndo, ", length %u\n\t%s",
+                 length,
+                 tok2str(ntp_mode_values, "Unknown mode", mode)));
 
        leapind = bp->status & LEAPMASK;
-        printf (", Leap indicator: %s (%u)",
-                tok2str(ntp_leapind_values, "Unknown", leapind),
-                leapind);
+       ND_PRINT((ndo, ", Leap indicator: %s (%u)",
+                 tok2str(ntp_leapind_values, "Unknown", leapind),
+                 leapind));
 
        ND_TCHECK(bp->stratum);
        ND_PRINT((ndo, ", Stratum %u (%s)",
@@ -367,7 +367,7 @@ p_ntp_time(netdissect_options *ndo,
 
            tm = localtime(&seconds);
            strftime(time_buf, sizeof (time_buf), "%Y/%m/%d %H:%M:%S", tm);
-           printf (" (%s)", time_buf);
+           ND_PRINT((ndo, " (%s)", time_buf));
        }
 #endif
 }
index 3073a8a85639f365e7cd9fca49df19d5d4e19b3e..e8c282c9bd1b671ba2aa048d2a78919bab38daaa 100644 (file)
@@ -503,12 +503,8 @@ olsr_print(netdissect_options *ndo,
                     ptr.hna = (struct olsr_hna4 *)msg_data;
 
                     /* print 4 prefixes per line */
-                    if (col == 0)
-                        printf ("\n\t    ");
-                    else
-                        printf (", ");
-
-                    ND_PRINT((ndo, "%s/%u",
+                    ND_PRINT((ndo, "%s%s/%u",
+                            col == 0 ? "\n\t    " : ", ",
                             ipaddr_string(ptr.hna->network),
                             mask2plen(EXTRACT_32BITS(ptr.hna->mask))));
 
index a59e141c6a5c74c82672b58b4237c010e173c990..d8edc49613dc189bd86a768c20920f35af978ae7 100644 (file)
@@ -97,7 +97,7 @@ pppoe_print(netdissect_options *ndo, register const u_char *bp, u_int length)
        const u_char *pppoe_packet, *pppoe_payload;
 
        if (length < PPPOE_HDRLEN) {
-               (void)printf("truncated-pppoe %u", length);
+               ND_PRINT((ndo, "truncated-pppoe %u", length));
                return (length);
        }
        length -= PPPOE_HDRLEN;
index 31a9c5ef73182411d31695f1165efb81e550a8e9..a12a2bd6f35f5d9ce6506b54397a9c7182daaa84 100644 (file)
@@ -84,7 +84,7 @@ sl_if_print(netdissect_options *ndo,
                break;
 #endif
        default:
-               printf ("ip v%d", IP_V(ip));
+               ND_PRINT((ndo, "ip v%d", IP_V(ip)));
        }
 
        return (SLIP_HDRLEN);