diff options
author | Bjørn Mork <bjorn@mork.no> | 2017-03-04 21:05:37 +0100 |
---|---|---|
committer | Bjørn Mork <bjorn@mork.no> | 2017-03-04 21:05:37 +0100 |
commit | 8712f3f01a5acaa5426c03fc4510f18985b84b66 (patch) | |
tree | 6753dca376d4520648f31fa448cbab4561756d49 /miscutils | |
parent | 6937c3f2bd8cf40ce8d2f0d3fea37f076e4ce709 (diff) |
ripe-atlas-fw: imported version 47504750
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/ooqd.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/miscutils/ooqd.c b/miscutils/ooqd.c index 85114c9..44721e9 100644 --- a/miscutils/ooqd.c +++ b/miscutils/ooqd.c @@ -116,9 +116,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; } @@ -250,7 +250,7 @@ printf("got cp %p, line %p, '%s'\n", cp, line, cp); if (cp[0] == '"') { /* Special code for strings */ - find_eos(cp+1, &ncp); + find_eos(cp+1, &ncp, '"'); if (ncp[0] != '"') { report( @@ -263,6 +263,22 @@ printf("got cp %p, line %p, '%s'\n", cp, line, cp); cp[0]= '\0'; cp++; } + else if (cp[0] == '\'') + { + /* Also try single quotes */ + find_eos(cp+1, &ncp, '\''); + if (ncp[0] != '\'') + { + report( + "command line '%s', end of string not found", + line); + continue; /* Just skip it */ + } + argv[argc]= cp+1; + cp= ncp; + cp[0]= '\0'; + cp++; + } else { skip_nonspace(cp, &ncp); |