The following patch fixes a bug in print-bootp.c. It will print an
extra "\n\t      " when the last line contains 4 options.  It is also
simpler in general and eliminates the need for a first variable.

Also contains some formatting and whitespace cleanup.

Index: print-bootp.c
===================================================================
RCS file: /tcpdump/master/tcpdump/print-bootp.c,v
retrieving revision 1.81
diff -u -r1.81 print-bootp.c
--- print-bootp.c       13 Feb 2006 18:59:29 -0000      1.81
+++ print-bootp.c       9 Jan 2007 01:18:12 -0000
@@ -413,22 +413,20 @@
                }
 
                if (tag == TAG_PARM_REQUEST) {
-                       first = 1;
-                        idx = 0;
-                        printf("\n\t      ");
+                       idx = 0;
                        while (len-- > 0) {
                                uc = *bp++;
                                cp = tok2str(tag2str, "?Option %u", uc);
-                               printf("%s%s", (first || (!(idx %4))) ? "" : ", 
", cp + 1);
-
-                                if ((idx %4) == 3) {
-                                    printf("\n\t      ");
-                                }
-                               first = 0;
-                                idx ++;
+                               if (idx % 4 == 0)
+                                       printf("\n\t      ");
+                               else
+                                       printf(", ");
+                               printf("%s", cp + 1);
+                               idx++;
                        }
                        continue;
                }
+
                if (tag == TAG_EXTENDED_REQUEST) {
                        first = 1;
                        while (len > 1) {
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.

Reply via email to