diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2018-11-15 09:58:01 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2018-11-15 09:58:01 +0200 |
commit | 6e4ef4c272a23ffde227689bc4e65a0523f18b4d (patch) | |
tree | 9c47e8915e0a11ff5df86ee7849cbc54eeff3882 /src | |
parent | 82a4e4b019194d60080c1b9f34de841485f3b9e3 (diff) | |
download | grecs-6e4ef4c272a23ffde227689bc4e65a0523f18b4d.tar.gz grecs-6e4ef4c272a23ffde227689bc4e65a0523f18b4d.tar.bz2 |
Port mailutils commit 2c2e3c50d6
* include/wordsplit.h (WRDSO_ARGV): Remove.
* src/wordsplit.c (expcmd): Always split command line into arguments.
This fixes https://savannah.gnu.org/bugs/?54830
* tests/wsp.c: Implement internal commands, instead of
calling shell ones. This fixes https://savannah.gnu.org/bugs/?54829.
* tests/wordsplit.at: Rewrite command expansion tests.
Diffstat (limited to 'src')
-rw-r--r-- | src/wordsplit.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/wordsplit.c b/src/wordsplit.c index b4baeb3..bad59b1 100644 --- a/src/wordsplit.c +++ b/src/wordsplit.c @@ -1524,39 +1524,33 @@ expcmd (struct wordsplit *wsp, const char *str, size_t len, struct wordsplit_node **ptail, const char **pend, int flg) { int rc; size_t j; char *value; struct wordsplit_node *newnode; + struct wordsplit ws; str++; len--; if (find_closing_paren (str, 0, len, &j, "()")) { _wsplt_seterr (wsp, WRDSE_PAREN); return 1; } *pend = str + j; - if (wsp->ws_options & WRDSO_ARGV) + rc = _wsplt_subsplit (wsp, &ws, str, j, WRDSF_WS | WRDSF_QUOTE, 1); + if (rc) { - struct wordsplit ws; - - rc = _wsplt_subsplit (wsp, &ws, str, j, WRDSF_WS | WRDSF_QUOTE, 1); - if (rc) - { - _wsplt_seterr_sub (wsp, &ws); - wordsplit_free (&ws); - return 1; - } - rc = wsp->ws_command (&value, str, j, ws.ws_wordv, wsp->ws_closure); + _wsplt_seterr_sub (wsp, &ws); wordsplit_free (&ws); + return 1; } - else - rc = wsp->ws_command (&value, str, j, NULL, wsp->ws_closure); + rc = wsp->ws_command (&value, str, j, ws.ws_wordv, wsp->ws_closure); + wordsplit_free (&ws); if (rc == WRDSE_NOSPACE) return _wsplt_nomem (wsp); else if (rc) { if (rc == WRDSE_USERERR) |