From: Roy Marples Date: Sat, 26 Apr 2008 07:12:46 +0000 (+0000) Subject: Allow quotes to be used. X-Git-Tag: v4.0.2~447 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e803c75860062fa1f3bf72330830ae4020bdfded;p=thirdparty%2Fdhcpcd.git Allow quotes to be used. --- diff --git a/dhcpcd.c b/dhcpcd.c index f1f7f667..94677e2a 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -367,7 +367,7 @@ main(int argc, char **argv) int sig = 0; int retval = EXIT_FAILURE; char *line, *option, *p, *lp, *buffer = NULL; - char lt = '\\'; + char lt; size_t len = 0; FILE *f; char *cf = NULL; @@ -480,6 +480,7 @@ main(int argc, char **argv) line++; } /* Trim trailing whitespace */ + lt = '\\'; if (line && *line) { p = line + strlen(line) - 1; while (p != line && (*p == ' ' || *p == '\t')) { @@ -488,6 +489,14 @@ main(int argc, char **argv) *p-- = '\0'; } } + /* Remove quotes if present */ + if (line && *line == '"') { + p = line + strlen(line) - 1; + if (*p == '"') { + line++; + *p = '\0'; + } + } /* Process escapes */ lp = p = line; while (p && *p) {