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,
1527 size_t j; 1527 size_t j;
1528 char *value; 1528 char *value;
1529 struct wordsplit_node *newnode; 1529 struct wordsplit_node *newnode;
1530 struct wordsplit ws;
1530 1531
1531 str++; 1532 str++;
1532 len--; 1533 len--;
@@ -1538,22 +1539,15 @@ expcmd (struct wordsplit *wsp, const char *str, size_t len,
1538 } 1539 }
1539 1540
1540 *pend = str + j; 1541 *pend = str + j;
1541 if (wsp->ws_options & WRDSO_ARGV) 1542 rc = _wsplt_subsplit (wsp, &ws, str, j, WRDSF_WS | WRDSF_QUOTE, 1);
1543 if (rc)
1542 { 1544 {
1543 struct wordsplit ws; 1545 _wsplt_seterr_sub (wsp, &ws);
1544
1545 rc = _wsplt_subsplit (wsp, &ws, str, j, WRDSF_WS | WRDSF_QUOTE, 1);
1546 if (rc)
1547 {
1548 _wsplt_seterr_sub (wsp, &ws);
1549 wordsplit_free (&ws);
1550 return 1;
1551 }
1552 rc = wsp->ws_command (&value, str, j, ws.ws_wordv, wsp->ws_closure);
1553 wordsplit_free (&ws); 1546 wordsplit_free (&ws);
1547 return 1;
1554 } 1548 }
1555 else 1549 rc = wsp->ws_command (&value, str, j, ws.ws_wordv, wsp->ws_closure);
1556 rc = wsp->ws_command (&value, str, j, NULL, wsp->ws_closure); 1550 wordsplit_free (&ws);
1557 1551
1558 if (rc == WRDSE_NOSPACE) 1552 if (rc == WRDSE_NOSPACE)
1559 return _wsplt_nomem (wsp); 1553 return _wsplt_nomem (wsp);

Return to:

Send suggestions and report system problems to the System administrator.