]>
Commit | Line | Data |
---|---|---|
5545a732 JR |
1 | - col truncates data |
2 | ||
3 | --- util-linux-2.13-pre6/text-utils/col.c.kzak 2002-03-09 00:05:12.000000000 +0100 | |
4 | +++ util-linux-2.13-pre6/text-utils/col.c 2006-02-21 22:25:48.000000000 +0100 | |
5 | @@ -128,6 +128,7 @@ | |
6 | int this_line; /* line l points to */ | |
7 | int nflushd_lines; /* number of lines that were flushed */ | |
8 | int adjust, opt, warned; | |
9 | + int ret = 0; | |
10 | ||
11 | setlocale(LC_ALL, ""); | |
12 | bindtextdomain(PACKAGE, LOCALEDIR); | |
13 | @@ -175,8 +176,16 @@ | |
14 | cur_line = max_line = nflushd_lines = this_line = 0; | |
15 | cur_set = last_set = CS_NORMAL; | |
16 | lines = l = alloc_line(); | |
17 | - | |
18 | - while ((ch = getwchar()) != WEOF) { | |
19 | + | |
20 | + while (feof(stdin)==0) { | |
21 | + errno = 0; | |
22 | + if ((ch = getwchar()) == WEOF) { | |
23 | + if (errno==EILSEQ) { | |
24 | + perror("col"); | |
25 | + ret = 1; | |
26 | + } | |
27 | + break; | |
28 | + } | |
29 | if (!iswgraph(ch)) { | |
30 | switch (ch) { | |
31 | case BS: /* can't go back further */ | |
32 | @@ -332,7 +341,7 @@ | |
33 | flush_blanks(); | |
34 | if (ferror(stdout) || fclose(stdout)) | |
35 | return 1; | |
36 | - return 0; | |
37 | + return ret; | |
38 | } | |
39 | ||
40 | void flush_lines(int nflush) |