fix multibyte issue in unexpand(by R.Kollar, #821262)
This commit is contained in:
parent
970e32111e
commit
1801957473
@ -3401,7 +3401,7 @@ diff -urNp coreutils-8.21-orig/src/unexpand.c coreutils-8.21/src/unexpand.c
|
|||||||
/* The official name of this program (e.g., no 'g' prefix). */
|
/* The official name of this program (e.g., no 'g' prefix). */
|
||||||
#define PROGRAM_NAME "unexpand"
|
#define PROGRAM_NAME "unexpand"
|
||||||
|
|
||||||
@@ -103,6 +120,208 @@ static struct option const longopts[] =
|
@@ -103,6 +120,210 @@ static struct option const longopts[] =
|
||||||
{NULL, 0, NULL, 0}
|
{NULL, 0, NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -3421,6 +3421,7 @@ diff -urNp coreutils-8.21-orig/src/unexpand.c coreutils-8.21/src/unexpand.c
|
|||||||
+ wint_t wc; /* A gotten wide character. */
|
+ wint_t wc; /* A gotten wide character. */
|
||||||
+ size_t mblength; /* The byte size of a multibyte character
|
+ size_t mblength; /* The byte size of a multibyte character
|
||||||
+ which shows as same character as WC. */
|
+ which shows as same character as WC. */
|
||||||
|
+ bool prev_tab = false;
|
||||||
+
|
+
|
||||||
+ /* Index in `tab_list' of next tabstop: */
|
+ /* Index in `tab_list' of next tabstop: */
|
||||||
+ int tab_index = 0; /* For calculating width of pending tabs. */
|
+ int tab_index = 0; /* For calculating width of pending tabs. */
|
||||||
@ -3499,7 +3500,7 @@ diff -urNp coreutils-8.21-orig/src/unexpand.c coreutils-8.21/src/unexpand.c
|
|||||||
+flush_pend_mb:
|
+flush_pend_mb:
|
||||||
+ /* Flush pending spaces. Print as many tabs as possible,
|
+ /* Flush pending spaces. Print as many tabs as possible,
|
||||||
+ then print the rest as spaces. */
|
+ then print the rest as spaces. */
|
||||||
+ if (pending == 1)
|
+ if (pending == 1 && column != 1 && !prev_tab)
|
||||||
+ {
|
+ {
|
||||||
+ putchar (' ');
|
+ putchar (' ');
|
||||||
+ pending = 0;
|
+ pending = 0;
|
||||||
@ -3600,6 +3601,7 @@ diff -urNp coreutils-8.21-orig/src/unexpand.c coreutils-8.21/src/unexpand.c
|
|||||||
+ fwrite (bufpos, sizeof(char), mblength, stdout);
|
+ fwrite (bufpos, sizeof(char), mblength, stdout);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
+ prev_tab = wc == L'\t';
|
||||||
+ buflen -= mblength;
|
+ buflen -= mblength;
|
||||||
+ bufpos += mblength;
|
+ bufpos += mblength;
|
||||||
+ }
|
+ }
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Summary: A set of basic GNU tools commonly used in shell scripts
|
Summary: A set of basic GNU tools commonly used in shell scripts
|
||||||
Name: coreutils
|
Name: coreutils
|
||||||
Version: 8.21
|
Version: 8.21
|
||||||
Release: 3%{?dist}
|
Release: 4%{?dist}
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
Url: http://www.gnu.org/software/coreutils/
|
Url: http://www.gnu.org/software/coreutils/
|
||||||
@ -376,6 +376,9 @@ fi
|
|||||||
%{_sbindir}/chroot
|
%{_sbindir}/chroot
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Feb 20 2013 Ondrej Vasik <ovasik@redhat.com> 8.21-4
|
||||||
|
- fix multibyte issue in unexpand(by R.Kollar, #821262)
|
||||||
|
|
||||||
* Mon Feb 18 2013 Mark Wielaard <mjw@redhat.com> 8.21-3
|
* Mon Feb 18 2013 Mark Wielaard <mjw@redhat.com> 8.21-3
|
||||||
- fix coreutils-i18n.patch to terminate mbdelim string (#911929)
|
- fix coreutils-i18n.patch to terminate mbdelim string (#911929)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user