From: Charlie Root Date: Thu, 31 Mar 2005 09:15:14 +0000 (+0200) Subject: Remove quotes from tokens to handle paths with spaces correctly. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0a2a11fd6f27864da7420d122484156d92fffef9;p=thirdparty%2Fntp.git Remove quotes from tokens to handle paths with spaces correctly. bk: 424bbfa2HLHBwYA56ZzuxU6SrL9Flw --- diff --git a/ntpd/ntp_config.c b/ntpd/ntp_config.c index 29aca0ac42..82d1f7f96c 100644 --- a/ntpd/ntp_config.c +++ b/ntpd/ntp_config.c @@ -2058,8 +2058,29 @@ gettokens ( if (ISEOL(*cp)) break; } + + } + + /* Heiko: Remove leading and trailing quotes around tokens */ + { + int i,j = 0; + + + for (i = 0; i < ntok; i++) { + /* Now check if the first char is a quote and remove that */ + if ( tokenlist[ntok][0] == '"' ) + tokenlist[ntok]++; + + /* Now check the last char ... */ + j = strlen(tokenlist[ntok])-1; + if ( tokenlist[ntok][j] == '"' ) + tokenlist[ntok][j] = '\0'; + } + + } + if (ntok == MAXTOKENS) { --ntok; /* HMS: chomp it to lose the EOL? */