|
|
04161d |
diff --git a/src/expand.c b/src/expand.c
|
|
|
04161d |
index 380e020..310b349 100644
|
|
|
04161d |
--- a/src/expand.c
|
|
|
04161d |
+++ b/src/expand.c
|
|
|
04161d |
@@ -129,15 +129,19 @@ expand (void)
|
|
|
04161d |
|
|
|
04161d |
do
|
|
|
04161d |
{
|
|
|
04161d |
- do {
|
|
|
04161d |
+ while (true) {
|
|
|
04161d |
mbf_getc (c, mbf);
|
|
|
04161d |
- if (mb_iseof (c))
|
|
|
04161d |
+ if ((mb_iseof (c)) && (fp = next_file (fp)))
|
|
|
04161d |
{
|
|
|
04161d |
- mbf_init (mbf, fp = next_file (fp));
|
|
|
04161d |
+ mbf_init (mbf, fp);
|
|
|
04161d |
continue;
|
|
|
04161d |
}
|
|
|
04161d |
+ else
|
|
|
04161d |
+ {
|
|
|
04161d |
+ break;
|
|
|
04161d |
+ }
|
|
|
04161d |
}
|
|
|
04161d |
- while (false);
|
|
|
04161d |
+
|
|
|
04161d |
|
|
|
04161d |
if (convert)
|
|
|
04161d |
{
|
|
|
04161d |
diff --git a/src/unexpand.c b/src/unexpand.c
|
|
|
04161d |
index 3bbbd66..863a90a 100644
|
|
|
04161d |
--- a/src/unexpand.c
|
|
|
04161d |
+++ b/src/unexpand.c
|
|
|
04161d |
@@ -164,15 +164,19 @@ unexpand (void)
|
|
|
04161d |
|
|
|
04161d |
do
|
|
|
04161d |
{
|
|
|
04161d |
- do {
|
|
|
04161d |
+ while (true) {
|
|
|
04161d |
mbf_getc (c, mbf);
|
|
|
04161d |
- if (mb_iseof (c))
|
|
|
04161d |
+ if ((mb_iseof (c)) && (fp = next_file (fp)))
|
|
|
04161d |
{
|
|
|
04161d |
- mbf_init (mbf, fp = next_file (fp));
|
|
|
04161d |
+ mbf_init (mbf, fp);
|
|
|
04161d |
continue;
|
|
|
04161d |
}
|
|
|
04161d |
+ else
|
|
|
04161d |
+ {
|
|
|
04161d |
+ break;
|
|
|
04161d |
+ }
|
|
|
04161d |
}
|
|
|
04161d |
- while (false);
|
|
|
04161d |
+
|
|
|
04161d |
|
|
|
04161d |
if (convert)
|
|
|
04161d |
{
|
|
|
04161d |
diff --git a/tests/expand/mb.sh b/tests/expand/mb.sh
|
|
|
04161d |
index 7971e18..031be7a 100755
|
|
|
04161d |
--- a/tests/expand/mb.sh
|
|
|
04161d |
+++ b/tests/expand/mb.sh
|
|
|
04161d |
@@ -44,6 +44,20 @@ EOF
|
|
|
04161d |
expand < in > out || fail=1
|
|
|
04161d |
compare exp out > /dev/null 2>&1 || fail=1
|
|
|
04161d |
|
|
|
04161d |
+#multiple files as an input
|
|
|
04161d |
+cat <<\EOF >> exp || framework_failure_
|
|
|
04161d |
+1234567812345678123456781
|
|
|
04161d |
+. . . .
|
|
|
04161d |
+a b c d
|
|
|
04161d |
+. . . .
|
|
|
04161d |
+ä ö ü ß
|
|
|
04161d |
+. . . .
|
|
|
04161d |
+ äöü . öüä. ä xx
|
|
|
04161d |
+EOF
|
|
|
04161d |
+
|
|
|
04161d |
+expand ./in ./in > out || fail=1
|
|
|
04161d |
+compare exp out > /dev/null 2>&1 || fail=1
|
|
|
04161d |
+
|
|
|
04161d |
#test characters with display widths != 1
|
|
|
04161d |
env printf '12345678
|
|
|
04161d |
e\t|ascii(1)
|
|
|
04161d |
diff --git a/tests/unexpand/mb.sh b/tests/unexpand/mb.sh
|
|
|
04161d |
index 60d4c1a..8d75652 100755
|
|
|
04161d |
--- a/tests/unexpand/mb.sh
|
|
|
04161d |
+++ b/tests/unexpand/mb.sh
|
|
|
04161d |
@@ -44,6 +44,22 @@ EOF
|
|
|
04161d |
unexpand -a < in > out || fail=1
|
|
|
04161d |
compare exp out > /dev/null 2>&1 || fail=1
|
|
|
04161d |
|
|
|
04161d |
+
|
|
|
04161d |
+#multiple files as an input
|
|
|
04161d |
+cat >> exp <<\EOF
|
|
|
04161d |
+1234567812345678123456781
|
|
|
04161d |
+. . . .
|
|
|
04161d |
+a b c d
|
|
|
04161d |
+. . . .
|
|
|
04161d |
+ä ö ü ß
|
|
|
04161d |
+. . . .
|
|
|
04161d |
+ äöü . öüä. ä xx
|
|
|
04161d |
+EOF
|
|
|
04161d |
+
|
|
|
04161d |
+
|
|
|
04161d |
+unexpand -a ./in ./in > out || fail=1
|
|
|
04161d |
+compare exp out > /dev/null 2>&1 || fail=1
|
|
|
04161d |
+
|
|
|
04161d |
#test characters with a display width larger than 1
|
|
|
04161d |
|
|
|
04161d |
env printf '12345678
|