]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Use note() to do raw dumps, not fprintf
authorTed Lemon <source@isc.org>
Mon, 13 May 1996 00:06:44 +0000 (00:06 +0000)
committerTed Lemon <source@isc.org>
Mon, 13 May 1996 00:06:44 +0000 (00:06 +0000)
common/print.c
print.c

index 0af176c3c81f99a48fb4519c9b401576e8ba1ec0..a9ebb4ac1171efde84ab18e958194a0caaae53a2 100644 (file)
@@ -142,14 +142,20 @@ void dump_raw (buf, len)
        int len;
 {
        int i;
+       char lbuf [80];
+       int lbix = 0;
 
        for (i = 0; i < len; i++) {
-               if ((i & 15) == 0)
-                       fprintf (stderr, "\n%03x:", i);
-               else if ((i & 7) == 0)
-                       fprintf (stderr, " ");
-               fprintf (stderr, " %02x", buf [i]);
+               if ((i & 15) == 0) {
+                       if (lbix)
+                               note (lbuf);
+                       sprintf (lbuf, "%03x:", i);
+                       lbix = 4;
+               } else if ((i & 7) == 0)
+                       lbuf [lbix++] = ' ';
+               sprintf (&lbuf [lbix], " %02x", buf [i]);
+               lbix += 3;
        }
-       fprintf (stderr, "\n");
+       note (lbuf);
 }
 
diff --git a/print.c b/print.c
index 0af176c3c81f99a48fb4519c9b401576e8ba1ec0..a9ebb4ac1171efde84ab18e958194a0caaae53a2 100644 (file)
--- a/print.c
+++ b/print.c
@@ -142,14 +142,20 @@ void dump_raw (buf, len)
        int len;
 {
        int i;
+       char lbuf [80];
+       int lbix = 0;
 
        for (i = 0; i < len; i++) {
-               if ((i & 15) == 0)
-                       fprintf (stderr, "\n%03x:", i);
-               else if ((i & 7) == 0)
-                       fprintf (stderr, " ");
-               fprintf (stderr, " %02x", buf [i]);
+               if ((i & 15) == 0) {
+                       if (lbix)
+                               note (lbuf);
+                       sprintf (lbuf, "%03x:", i);
+                       lbix = 4;
+               } else if ((i & 7) == 0)
+                       lbuf [lbix++] = ' ';
+               sprintf (&lbuf [lbix], " %02x", buf [i]);
+               lbix += 3;
        }
-       fprintf (stderr, "\n");
+       note (lbuf);
 }