diff options
| author | Wojciech A. Koszek <wkoszek@FreeBSD.org> | 2007-05-12 22:37:52 +0000 |
|---|---|---|
| committer | Wojciech A. Koszek <wkoszek@FreeBSD.org> | 2007-05-12 22:37:52 +0000 |
| commit | ae7a150a686cbfaf36d60c4a7867eaf49f317227 (patch) | |
| tree | 7dc03d779c719986d7a33725e07f40530405b872 /usr.sbin/config | |
| parent | a8dec2ad79d3b67c0c0e6a3438a11f8737bfc21c (diff) | |
Notes
Diffstat (limited to 'usr.sbin/config')
| -rw-r--r-- | usr.sbin/config/main.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c index aede132ec852..c0c6b2a7b42f 100644 --- a/usr.sbin/config/main.c +++ b/usr.sbin/config/main.c @@ -52,6 +52,7 @@ static const char rcsid[] = #include <ctype.h> #include <err.h> #include <stdio.h> +#include <string.h> #include <sysexits.h> #include <unistd.h> #include <dirent.h> @@ -397,6 +398,7 @@ configfile_dynamic(struct sbuf *sb) struct device *d; struct opt *ol; char *lend; + unsigned int i; asprintf(&lend, "\\n\\\n"); assert(lend != NULL); @@ -413,7 +415,16 @@ configfile_dynamic(struct sbuf *sb) continue; sbuf_printf(sb, "options\t%s", ol->op_name); if (ol->op_value != NULL) { - sbuf_printf(sb, "=%s%s", ol->op_value, lend); + sbuf_putc(sb, '='); + for (i = 0; i < strlen(ol->op_value); i++) { + if (ol->op_value[i] == '"') + sbuf_printf(sb, "\\%c", + ol->op_value[i]); + else + sbuf_printf(sb, "%c", + ol->op_value[i]); + } + sbuf_printf(sb, "%s", lend); } else { sbuf_printf(sb, "%s", lend); } |
