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