about summary refs log tree commit diff
path: root/posix/wordexp-test.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-09-15 21:24:37 +0000
committerUlrich Drepper <drepper@redhat.com>1998-09-15 21:24:37 +0000
commita8125d855218832508af812df585c5fac5093bc3 (patch)
treec5e474d75d6620f4e5df2c19a5d8e1aab1dd89c5 /posix/wordexp-test.c
parentaa2bc6a32d523af80d296aa9fe063b72ef99aa82 (diff)
downloadglibc-a8125d855218832508af812df585c5fac5093bc3.tar.gz
glibc-a8125d855218832508af812df585c5fac5093bc3.tar.xz
glibc-a8125d855218832508af812df585c5fac5093bc3.zip
Update
1998-09-16 00:47  Tim Waugh  <tim@cyberelk.demon.co.uk>

	* posix/wordexp-test.c: If expansion or substitution occurs
	anywhere in a word, the entire word is subject to field-splitting.

	* posix/wordexp.c (parse_glob): Look for end of word instead of
	end of field when deciding what to glob.
	(field_split_word): New function, now the only place where
	field-splitting is performed.
	(parse_dollars): New parameter - tell the caller if
	field-splitting should be performed on this word.

	* posix/wordexp-test.c (testit): Only call wordfree if wordexp
	succeeded (or failed with WRDE_NOSPACE).

1998-09-15 19:53 1998  Tim Waugh  <tim@cyberelk.demon.co.uk>

	* posix/wordexp.c (wordexp): Don't convert IFS characters to
	blanks.

	* posix/wordexp-test.c: Words not the result of expansion or
	substitution should remain unchanged.
Diffstat (limited to 'posix/wordexp-test.c')
-rw-r--r--posix/wordexp-test.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/posix/wordexp-test.c b/posix/wordexp-test.c
index be81c4babf..746b817c46 100644
--- a/posix/wordexp-test.c
+++ b/posix/wordexp-test.c
@@ -43,7 +43,7 @@ struct test_case_struct
     { 0, NULL, "one two", 0, 2, { "one", "two", }, IFS },
     { 0, NULL, "one two three", 0, 3, { "one", "two", "three", }, IFS },
     { 0, NULL, " \tfoo\t\tbar ", 0, 2, { "foo", "bar", }, IFS },
-    { 0, NULL, "red , white blue", 0, 4, { "red", " ", "white", "blue", }, " ," },
+    { 0, NULL, "red , white blue", 0, 4, { "red", ",", "white", "blue", }, " ," },
     { 0, NULL, "one two three", 0, 3, { "one", "two", "three", }, "" },
     { 0, NULL, "one \"two three\"", 0, 2, { "one", "two three", }, IFS },
     { 0, NULL, "one \"two three\"", 0, 2, { "one", "two three", }, "" },
@@ -60,10 +60,11 @@ struct test_case_struct
     { 0, NULL, "$(echo :abc:\\ )", 0, 2, { "", "abc", }, ": " },
     { 0, NULL, "$(echo :abc\\ )", 0, 2, { "", "abc", }, ": " },
     { 0, ":abc:", "$(echo $var)", 0, 2, { "", "abc", }, ":" },
-    { 0, NULL, ":abc:", 0, 1, { " abc ", }, ":" },
+    { 0, NULL, ":abc:", 0, 1, { ":abc:", }, ":" },
     { 0, NULL, "$(echo :abc:)def", 0, 3, { "", "abc", "def", }, ":" },
     { 0, NULL, "$(echo abc:de)f", 0, 2, { "abc", "def", }, ":" },
-    { 0, NULL, "$(echo abc:de)f:ghi", 0, 2, { "abc", "def ghi", }, ":" },
+    { 0, NULL, "$(echo abc:de)f:ghi", 0, 3, { "abc", "def", "ghi", }, ":" },
+    { 0, NULL, "abc:d$(echo ef:ghi)", 0, 3, { "abc", "def", "ghi", }, ":" },
     { 0, "abc:", "$var$(echo def:ghi)", 0, 3, { "abc", "def", "ghi", }, ":" },
     { 0, "abc:d", "$var$(echo ef:ghi)", 0, 3, { "abc", "def", "ghi", }, ":" },
     { 0, "def:ghi", "$(echo abc:)$var", 0, 3, { "abc", "def", "ghi", }, ":" },
@@ -308,7 +309,8 @@ testit (struct test_case_struct *tc)
   else
     printf ("OK\n");
 
-  wordfree (&we);
+  if (retval == 0 || retval == WRDE_NOSPACE)
+    wordfree (&we);
 
   return bzzzt;
 }