38 lines
953 B
Diff
38 lines
953 B
Diff
--- util-linux-2.12p/text-utils/col.c.EILSEQ 2002-03-09 00:05:12.000000000 +0100
|
|
+++ util-linux-2.12p/text-utils/col.c 2006-01-02 18:00:06.000000000 +0100
|
|
@@ -128,6 +128,7 @@
|
|
int this_line; /* line l points to */
|
|
int nflushd_lines; /* number of lines that were flushed */
|
|
int adjust, opt, warned;
|
|
+ int ret = 0;
|
|
|
|
setlocale(LC_ALL, "");
|
|
bindtextdomain(PACKAGE, LOCALEDIR);
|
|
@@ -175,8 +176,15 @@
|
|
cur_line = max_line = nflushd_lines = this_line = 0;
|
|
cur_set = last_set = CS_NORMAL;
|
|
lines = l = alloc_line();
|
|
-
|
|
- while ((ch = getwchar()) != WEOF) {
|
|
+
|
|
+ while (feof(stdin)==0) {
|
|
+ errno = 0;
|
|
+ if ((ch = getwchar()) == WEOF) {
|
|
+ if (errno==EILSEQ)
|
|
+ perror("col");
|
|
+ ret = 1;
|
|
+ break;
|
|
+ }
|
|
if (!iswgraph(ch)) {
|
|
switch (ch) {
|
|
case BS: /* can't go back further */
|
|
@@ -332,7 +340,7 @@
|
|
flush_blanks();
|
|
if (ferror(stdout) || fclose(stdout))
|
|
return 1;
|
|
- return 0;
|
|
+ return ret;
|
|
}
|
|
|
|
void flush_lines(int nflush)
|