mirror of
https://sourceware.org/git/glibc.git
synced 2026-01-06 11:51:29 +03:00
Update.
1999-04-11 Tim Waugh <tim@cyberelk.demon.co.uk> * posix/wordexp.c (wordexp): Fix a leak when an invalid character is seen, as well as fixing semantics. Don't reset the word count to zero when an invalid character is seen, but leave it as it was (this makes a difference with WRDE_APPEND). * posix/wordexp-test.c: More test cases. * posix/wordexp.c (parse_param): In words like ${var#pattern}, always expand pattern when it is needed. Also, handle quoting in pattern properly.
This commit is contained in:
@@ -81,6 +81,7 @@ struct test_case_struct
|
||||
{ 0, NULL, "\"quoted\"", 0, 1, { "quoted", }, IFS },
|
||||
{ 0, "foo", "\"$var\"\"$var\"", 0, 1, { "foofoo", }, IFS },
|
||||
{ 0, NULL, "'singly-quoted'", 0, 1, { "singly-quoted", }, IFS },
|
||||
{ 0, NULL, "contin\\\nuation", 0, 1, { "continuation", }, IFS },
|
||||
|
||||
/* Simple command substitution */
|
||||
{ 0, NULL, "$(echo hello)", 0, 1, { "hello", }, IFS },
|
||||
@@ -118,10 +119,16 @@ struct test_case_struct
|
||||
{ 0, NULL, "${var:-'}'}", 0, 1, { "}", }, IFS },
|
||||
{ 0, NULL, "${var-}", 0, 0, { NULL }, IFS },
|
||||
|
||||
{ 0, "pizza", "${var#${var}}", 0, 0, { NULL }, IFS },
|
||||
{ 0, "pepperoni", "${var%$(echo oni)}", 0, 1, { "pepper" }, IFS },
|
||||
{ 0, "6pack", "${var#$((6))}", 0, 1, { "pack" }, IFS },
|
||||
{ 0, "b*witched", "${var##b*}", 0, 0, { NULL }, IFS },
|
||||
{ 0, "b*witched", "${var##\"b*\"}", 0, 1, { "witched" }, IFS },
|
||||
{ 0, "banana", "${var%na*}", 0, 1, { "bana", }, IFS },
|
||||
{ 0, "banana", "${var%%na*}", 0, 1, { "ba", }, IFS },
|
||||
{ 0, "borabora-island", "${var#*bora}", 0, 1, { "bora-island", }, IFS },
|
||||
{ 0, "borabora-island", "${var##*bora}", 0, 1, {"-island", }, IFS },
|
||||
{ 0, "borabora-island", "${var##*bora}", 0, 1, { "-island", }, IFS },
|
||||
{ 0, "coconut", "${var##\\*co}", 0, 1, { "coconut", }, IFS },
|
||||
{ 0, "100%", "${var%0%}", 0, 1, { "10" }, IFS },
|
||||
|
||||
/* Pathname expansion */
|
||||
|
||||
Reference in New Issue
Block a user