2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-30 05:47:45 +00:00

Add emit_quotes qualifier to pretty_print_option, so that we don't get extra quotes when emitting strings into configuration scripts

This commit is contained in:
Ted Lemon 1997-06-02 22:32:05 +00:00
parent b52a650cbc
commit a9a9b7f151

View File

@ -42,7 +42,7 @@
#ifndef lint
static char copyright[] =
"$Id: options.c,v 1.24 1997/05/09 08:07:09 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
"$Id: options.c,v 1.25 1997/06/02 22:32:05 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#define DHCP_OPTION_DATA
@ -398,11 +398,12 @@ 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, emit_commas)
unsigned char code;
char *pretty_print_option (code, data, len, emit_commas, emit_quotes)
unsigned int code;
unsigned char *data;
int len;
int emit_commas;
int emit_quotes;
{
static char optbuf [32768]; /* XXX */
int hunksize = 0;
@ -415,6 +416,10 @@ char *pretty_print_option (code, data, len, emit_commas)
struct in_addr foo;
char comma;
/* Code should be between 0 and 255. */
if (code > 255)
error ("pretty_print_option: bad code %d\n", code);
if (emit_commas)
comma = ',';
else
@ -503,10 +508,12 @@ char *pretty_print_option (code, data, len, emit_commas)
for (j = 0; j < numelem; j++) {
switch (fmtbuf [j]) {
case 't':
*op++ = '"';
if (emit_quotes)
*op++ = '"';
strcpy (op, dp);
op += strlen (dp);
*op++ = '"';
if (emit_quotes)
*op++ = '"';
*op = 0;
break;
case 'I':