From 6937c3f2bd8cf40ce8d2f0d3fea37f076e4ce709 Mon Sep 17 00:00:00 2001 From: Bjørn Mork Date: Sat, 4 Mar 2017 20:59:09 +0100 Subject: ripe-atlas-fw: imported version 4740 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bjørn Mork --- miscutils/perd.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'miscutils/perd.c') diff --git a/miscutils/perd.c b/miscutils/perd.c index 95707f9..c6a30b1 100644 --- a/miscutils/perd.c +++ b/miscutils/perd.c @@ -1167,9 +1167,9 @@ static void skip_nonspace(char *cp, char **ncpp) *ncpp= cp; } -static void find_eos(char *cp, char **ncpp) +static void find_eos(char *cp, char **ncpp, char quote_char) { - while (cp[0] != '\0' && cp[0] != '"') + while (cp[0] != '\0' && cp[0] != quote_char) cp++; *ncpp= cp; } @@ -1301,7 +1301,7 @@ static int atlas_run(char *cmdline) if (cp[0] == '"') { /* Special code for strings */ - find_eos(cp+1, &ncp); + find_eos(cp+1, &ncp, '"'); if (ncp[0] != '"') { crondlog( @@ -1316,6 +1316,24 @@ static int atlas_run(char *cmdline) cp[0]= '\0'; cp++; } + else if (cp[0] == '\'') + { + /* Also try single quotes */ + find_eos(cp+1, &ncp, '\''); + if (ncp[0] != '\'') + { + crondlog( + LVL8 "atlas_run: command line '%s', end of string not found", + cmdline); + r= -1; + reason="end of string not found"; + goto error; + } + argv[argc]= cp+1; + cp= ncp; + cp[0]= '\0'; + cp++; + } else { skip_nonspace(cp, &ncp); -- cgit v1.2.3