multibyte fixes in cut and expand (by M.Briza, #821260)

This commit is contained in:
Ondřej Vašík 2012-11-05 16:01:01 +01:00
commit f856ee515a

View file

@ -376,7 +376,7 @@ diff -urNp coreutils-8.12-orig/src/cut.c coreutils-8.12/src/cut.c
+ break;
+ }
+
+ if (wc == WEOF)
+ if (len<=0 && wc == WEOF)
+ break;
+
+ /* If the first field extends to the end of line (it is not
@ -733,7 +733,7 @@ diff -urNp coreutils-8.12-orig/src/expand.c coreutils-8.12/src/expand.c
+ if (convert)
+ {
+ ++column;
+ if (convert_entire_line == 0)
+ if (convert_entire_line == 0 && !isblank(*bufpos))
+ convert = 0;
+ }
+ putchar (*bufpos);
@ -793,7 +793,7 @@ diff -urNp coreutils-8.12-orig/src/expand.c coreutils-8.12/src/expand.c
+
+ width = wcwidth (wc);
+ column += (width > 0) ? width : 0;
+ if (convert_entire_line == 0)
+ if (convert_entire_line == 0 && !iswblank(wc))
+ convert = 0;
+ }
+ }