diff options
author | Ulrich Drepper <drepper@redhat.com> | 1999-04-12 09:07:36 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1999-04-12 09:07:36 +0000 |
commit | bac660f87b7559d89d25d3522563525d6c5e9ebf (patch) | |
tree | b04eb7a5d70421659c57dac8d516c66fcb02a4f8 /posix/wordexp-test.c | |
parent | a64e578b6fdb18c530d142a68a7e57eb04038b5d (diff) | |
download | glibc-bac660f87b7559d89d25d3522563525d6c5e9ebf.zip glibc-bac660f87b7559d89d25d3522563525d6c5e9ebf.tar.gz glibc-bac660f87b7559d89d25d3522563525d6c5e9ebf.tar.bz2 |
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.
Diffstat (limited to 'posix/wordexp-test.c')
-rw-r--r-- | posix/wordexp-test.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/posix/wordexp-test.c b/posix/wordexp-test.c index 8e709c7..21bca96 100644 --- a/posix/wordexp-test.c +++ b/posix/wordexp-test.c @@ -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 */ |