aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2018-11-15 09:58:01 +0200
committerSergey Poznyakoff <gray@gnu.org>2018-11-15 09:58:01 +0200
commit6e4ef4c272a23ffde227689bc4e65a0523f18b4d (patch)
tree9c47e8915e0a11ff5df86ee7849cbc54eeff3882 /src
parent82a4e4b019194d60080c1b9f34de841485f3b9e3 (diff)
downloadgrecs-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.c20
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
@@ -1527,6 +1527,7 @@ expcmd (struct wordsplit *wsp, const char *str, size_t len,
size_t j;
char *value;
struct wordsplit_node *newnode;
+ struct wordsplit ws;
str++;
len--;
@@ -1538,22 +1539,15 @@ expcmd (struct wordsplit *wsp, const char *str, size_t len,
}
*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);

Return to:

Send suggestions and report system problems to the System administrator.