]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
pretty_print_options now optionally seperates array elements with comma, and now...
authorTed Lemon <source@isc.org>
Sat, 22 Feb 1997 08:32:05 +0000 (08:32 +0000)
committerTed Lemon <source@isc.org>
Sat, 22 Feb 1997 08:32:05 +0000 (08:32 +0000)
common/options.c
common/print.c
options.c
print.c

index 2f0210ea1c6a5a0c24871838e727c427a58e208c..6d18ad5ef6c24013412b5a5aface51d19c2d05a0 100644 (file)
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: options.c,v 1.21 1997/02/19 10:52:14 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: options.c,v 1.22 1997/02/22 08:32:04 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #define DHCP_OPTION_DATA
@@ -398,10 +398,11 @@ int store_options (buffer, buflen, options, priority_list, priority_len,
 
 /* Format the specified option so that a human can easily read it. */
 
-char *pretty_print_option (code, data, len)
+char *pretty_print_option (code, data, len, emit_commas)
        unsigned char code;
        unsigned char *data;
        int len;
+       int emit_commas;
 {
        static char optbuf [32768]; /* XXX */
        int hunksize = 0;
@@ -489,7 +490,11 @@ char *pretty_print_option (code, data, len)
                for (j = 0; j < numelem; j++) {
                        switch (fmtbuf [j]) {
                              case 't':
+                               *op++ = '"';
                                strcpy (op, dp);
+                               op += strlen (dp);
+                               *op++ = '"';
+                               *op = 0;
                                break;
                              case 'I':
                                foo.s_addr = htonl (getULong (dp));
@@ -530,7 +535,8 @@ char *pretty_print_option (code, data, len)
                                *op++ = ' ';
                }
                if (i + 1 < numhunk) {
-                       *op++ = ',';
+                       if (emit_commas)
+                               *op++ = ',';
                        *op++ = ' ';
                }
                
index 90b5532a5ba7a68225300938d12cf8a56b67519a..e43b58c0b443209c55b7c79f946f3cf698ff9942 100644 (file)
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: print.c,v 1.11 1996/08/27 09:53:30 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: print.c,v 1.12 1997/02/22 08:32:05 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -132,7 +132,7 @@ void dump_packet (tp)
                                        dhcp_options [i].name,
                                        pretty_print_option
                                        (i, tp -> options [i].data,
-                                        tp -> options [i].len));
+                                        tp -> options [i].len, 1));
                }
        }
        debug ("");
@@ -183,4 +183,3 @@ void hash_dump (table)
                }
        }
 }
-
index 2f0210ea1c6a5a0c24871838e727c427a58e208c..6d18ad5ef6c24013412b5a5aface51d19c2d05a0 100644 (file)
--- a/options.c
+++ b/options.c
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: options.c,v 1.21 1997/02/19 10:52:14 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: options.c,v 1.22 1997/02/22 08:32:04 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #define DHCP_OPTION_DATA
@@ -398,10 +398,11 @@ int store_options (buffer, buflen, options, priority_list, priority_len,
 
 /* Format the specified option so that a human can easily read it. */
 
-char *pretty_print_option (code, data, len)
+char *pretty_print_option (code, data, len, emit_commas)
        unsigned char code;
        unsigned char *data;
        int len;
+       int emit_commas;
 {
        static char optbuf [32768]; /* XXX */
        int hunksize = 0;
@@ -489,7 +490,11 @@ char *pretty_print_option (code, data, len)
                for (j = 0; j < numelem; j++) {
                        switch (fmtbuf [j]) {
                              case 't':
+                               *op++ = '"';
                                strcpy (op, dp);
+                               op += strlen (dp);
+                               *op++ = '"';
+                               *op = 0;
                                break;
                              case 'I':
                                foo.s_addr = htonl (getULong (dp));
@@ -530,7 +535,8 @@ char *pretty_print_option (code, data, len)
                                *op++ = ' ';
                }
                if (i + 1 < numhunk) {
-                       *op++ = ',';
+                       if (emit_commas)
+                               *op++ = ',';
                        *op++ = ' ';
                }
                
diff --git a/print.c b/print.c
index 90b5532a5ba7a68225300938d12cf8a56b67519a..e43b58c0b443209c55b7c79f946f3cf698ff9942 100644 (file)
--- a/print.c
+++ b/print.c
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: print.c,v 1.11 1996/08/27 09:53:30 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: print.c,v 1.12 1997/02/22 08:32:05 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -132,7 +132,7 @@ void dump_packet (tp)
                                        dhcp_options [i].name,
                                        pretty_print_option
                                        (i, tp -> options [i].data,
-                                        tp -> options [i].len));
+                                        tp -> options [i].len, 1));
                }
        }
        debug ("");
@@ -183,4 +183,3 @@ void hash_dump (table)
                }
        }
 }
-