col: getwchar() errors shouldn't be hidden
The col truncates output when multibyte errors is detected, but the problem is not reported to stderr and return code is still same like for successful exit. This stupid behaviour is fixed by this patch. Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
06b04b23cd
commit
e9ce5ccc90
|
@ -11,3 +11,5 @@ TS_CMD_SWAPON=${TS_CMD_MOUNT:-"$TOPDIR/mount/swapon"}
|
|||
TS_CMD_SWAPOFF=${TS_CMD_MOUNT:-"$TOPDIR/mount/swapoff"}
|
||||
|
||||
TS_CMD_IPCS=${TS_CMD_IPCS:-"$TOPDIR/sys-utils/ipcs"}
|
||||
|
||||
TS_CMD_COL=${TS_CMD_COL:-"$TOPDIR/text-utils/col"}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
col: Invalid or incomplete multibyte or wide character
|
|
@ -2,6 +2,7 @@
|
|||
TS_OUTDIR="$TS_TOPDIR/output"
|
||||
TS_DIFFDIR="$TS_TOPDIR/diff"
|
||||
TS_EXPECTEDDIR="$TS_TOPDIR/expected"
|
||||
TS_INPUTDIR="$TS_TOPDIR/input"
|
||||
|
||||
function ts_skip {
|
||||
echo " IGNORE ($1)"
|
||||
|
@ -9,6 +10,7 @@ function ts_skip {
|
|||
}
|
||||
|
||||
function ts_init {
|
||||
export LANG="en_US.UTF-8":
|
||||
TS_NAME=$(basename $0)
|
||||
if [ ! -d $TS_OUTDIR ]; then
|
||||
mkdir -p $TS_OUTDIR
|
||||
|
@ -19,6 +21,7 @@ function ts_init {
|
|||
TS_OUTPUT="$TS_OUTDIR/$TS_NAME"
|
||||
TS_DIFF="$TS_DIFFDIR/$TS_NAME"
|
||||
TS_EXPECTED="$TS_EXPECTEDDIR/$TS_NAME"
|
||||
TS_INPUT="$TS_INPUTDIR/$TS_NAME"
|
||||
|
||||
rm -f $TS_OUTPUT
|
||||
|
||||
|
@ -35,7 +38,7 @@ function ts_finalize {
|
|||
res=1
|
||||
fi
|
||||
else
|
||||
res=0
|
||||
res=1
|
||||
fi
|
||||
else
|
||||
echo " IGNORE (expected output undefined)"
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Dateiname der Versandhülle
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
|
||||
. commands.sh
|
||||
. functions.sh
|
||||
|
||||
TS_COMPONENT="col"
|
||||
TS_DESC="multibyte"
|
||||
|
||||
ts_init
|
||||
|
||||
cat $TS_INPUT | $TS_CMD_COL > /dev/null 2> $TS_OUTPUT
|
||||
|
||||
|
||||
|
||||
|
||||
ts_finalize
|
||||
|
|
@ -128,6 +128,7 @@ int main(int argc, char **argv)
|
|||
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,16 @@ int main(int argc, char **argv)
|
|||
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 +341,7 @@ int main(int argc, char **argv)
|
|||
flush_blanks();
|
||||
if (ferror(stdout) || fclose(stdout))
|
||||
return 1;
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void flush_lines(int nflush)
|
||||
|
|
Loading…
Reference in New Issue