]>
Commit | Line | Data |
---|---|---|
e8da1929 SS |
1 | diff --git a/src/expand.c b/src/expand.c |
2 | index 380e020..310b349 100644 | |
3 | --- a/src/expand.c | |
4 | +++ b/src/expand.c | |
5 | @@ -129,15 +129,19 @@ expand (void) | |
6 | ||
7 | do | |
8 | { | |
9 | - do { | |
10 | + while (true) { | |
11 | mbf_getc (c, mbf); | |
12 | - if (mb_iseof (c)) | |
13 | + if ((mb_iseof (c)) && (fp = next_file (fp))) | |
14 | { | |
15 | - mbf_init (mbf, fp = next_file (fp)); | |
16 | + mbf_init (mbf, fp); | |
17 | continue; | |
18 | } | |
19 | + else | |
20 | + { | |
21 | + break; | |
22 | + } | |
23 | } | |
24 | - while (false); | |
25 | + | |
26 | ||
27 | if (convert) | |
28 | { | |
29 | diff --git a/src/unexpand.c b/src/unexpand.c | |
30 | index 3bbbd66..863a90a 100644 | |
31 | --- a/src/unexpand.c | |
32 | +++ b/src/unexpand.c | |
33 | @@ -164,15 +164,19 @@ unexpand (void) | |
34 | ||
35 | do | |
36 | { | |
37 | - do { | |
38 | + while (true) { | |
39 | mbf_getc (c, mbf); | |
40 | - if (mb_iseof (c)) | |
41 | + if ((mb_iseof (c)) && (fp = next_file (fp))) | |
42 | { | |
43 | - mbf_init (mbf, fp = next_file (fp)); | |
44 | + mbf_init (mbf, fp); | |
45 | continue; | |
46 | } | |
47 | + else | |
48 | + { | |
49 | + break; | |
50 | + } | |
51 | } | |
52 | - while (false); | |
53 | + | |
54 | ||
55 | if (convert) | |
56 | { | |
57 | diff --git a/tests/expand/mb.sh b/tests/expand/mb.sh | |
58 | index 7971e18..031be7a 100755 | |
59 | --- a/tests/expand/mb.sh | |
60 | +++ b/tests/expand/mb.sh | |
61 | @@ -44,6 +44,20 @@ EOF | |
62 | expand < in > out || fail=1 | |
63 | compare exp out > /dev/null 2>&1 || fail=1 | |
64 | ||
65 | +#multiple files as an input | |
66 | +cat <<\EOF >> exp || framework_failure_ | |
67 | +1234567812345678123456781 | |
68 | +. . . . | |
69 | +a b c d | |
70 | +. . . . | |
71 | +ä ö ü ß | |
72 | +. . . . | |
73 | + äöü . öüä. ä xx | |
74 | +EOF | |
75 | + | |
76 | +expand ./in ./in > out || fail=1 | |
77 | +compare exp out > /dev/null 2>&1 || fail=1 | |
78 | + | |
79 | #test characters with display widths != 1 | |
80 | env printf '12345678 | |
81 | e\t|ascii(1) | |
82 | diff --git a/tests/unexpand/mb.sh b/tests/unexpand/mb.sh | |
83 | index 60d4c1a..8d75652 100755 | |
84 | --- a/tests/unexpand/mb.sh | |
85 | +++ b/tests/unexpand/mb.sh | |
86 | @@ -44,6 +44,22 @@ EOF | |
87 | unexpand -a < in > out || fail=1 | |
88 | compare exp out > /dev/null 2>&1 || fail=1 | |
89 | ||
90 | + | |
91 | +#multiple files as an input | |
92 | +cat >> exp <<\EOF | |
93 | +1234567812345678123456781 | |
94 | +. . . . | |
95 | +a b c d | |
96 | +. . . . | |
97 | +ä ö ü ß | |
98 | +. . . . | |
99 | + äöü . öüä. ä xx | |
100 | +EOF | |
101 | + | |
102 | + | |
103 | +unexpand -a ./in ./in > out || fail=1 | |
104 | +compare exp out > /dev/null 2>&1 || fail=1 | |
105 | + | |
106 | #test characters with a display width larger than 1 | |
107 | ||
108 | env printf '12345678 |