diff options
author | Bjørn Mork <bjorn@mork.no> | 2017-03-04 20:59:09 +0100 |
---|---|---|
committer | Bjørn Mork <bjorn@mork.no> | 2017-03-04 21:04:49 +0100 |
commit | 6937c3f2bd8cf40ce8d2f0d3fea37f076e4ce709 (patch) | |
tree | d93c729f5f045412b7bd94e0e9e908695eebce2b /miscutils/perd.c | |
parent | 729eb50738777d6dbc27f81d854c824b32bebb05 (diff) |
ripe-atlas-fw: imported version 47404740
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Diffstat (limited to 'miscutils/perd.c')
-rw-r--r-- | miscutils/perd.c | 24 |
1 files changed, 21 insertions, 3 deletions
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); |