Resolves: #1418505 - fold: preserve new-lines in mutlibyte text
This commit is contained in:
parent
5e77c9c1c9
commit
f1a024cc09
83
coreutils-i18n-fold-newline.patch
Normal file
83
coreutils-i18n-fold-newline.patch
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
From ff424639fe863cbd6963add1a79b97290c1606c6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: rpm-build <rpm-build>
|
||||||
|
Date: Fri, 3 Feb 2017 12:26:53 +0100
|
||||||
|
Subject: [PATCH] fold.c: preserve new-lines in mutlibyte text
|
||||||
|
|
||||||
|
---
|
||||||
|
src/fold.c | 55 +++++++++++++++++++++++++++----------------------------
|
||||||
|
1 file changed, 27 insertions(+), 28 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/fold.c b/src/fold.c
|
||||||
|
index d23edd5..8c232a7 100644
|
||||||
|
--- a/src/fold.c
|
||||||
|
+++ b/src/fold.c
|
||||||
|
@@ -342,39 +342,38 @@ fold_multibyte_text (FILE *istream, size_t width, int *saved_errno)
|
||||||
|
}
|
||||||
|
|
||||||
|
rescan:
|
||||||
|
- if (operating_mode == byte_mode) /* byte mode */
|
||||||
|
+ if (convfail)
|
||||||
|
+ increment = 1;
|
||||||
|
+ else if (wc == L'\n')
|
||||||
|
+ {
|
||||||
|
+ /* preserve newline */
|
||||||
|
+ fwrite (line_out, sizeof(char), offset_out, stdout);
|
||||||
|
+ START_NEW_LINE;
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ else if (operating_mode == byte_mode) /* byte mode */
|
||||||
|
increment = mblength;
|
||||||
|
else if (operating_mode == character_mode) /* character mode */
|
||||||
|
increment = 1;
|
||||||
|
- else /* column mode */
|
||||||
|
+ else /* column mode */
|
||||||
|
{
|
||||||
|
- if (convfail)
|
||||||
|
- increment = 1;
|
||||||
|
- else
|
||||||
|
+ switch (wc)
|
||||||
|
{
|
||||||
|
- switch (wc)
|
||||||
|
- {
|
||||||
|
- case L'\n':
|
||||||
|
- fwrite (line_out, sizeof(char), offset_out, stdout);
|
||||||
|
- START_NEW_LINE;
|
||||||
|
- continue;
|
||||||
|
-
|
||||||
|
- case L'\b':
|
||||||
|
- increment = (column > 0) ? -1 : 0;
|
||||||
|
- break;
|
||||||
|
-
|
||||||
|
- case L'\r':
|
||||||
|
- increment = -1 * column;
|
||||||
|
- break;
|
||||||
|
-
|
||||||
|
- case L'\t':
|
||||||
|
- increment = 8 - column % 8;
|
||||||
|
- break;
|
||||||
|
-
|
||||||
|
- default:
|
||||||
|
- increment = wcwidth (wc);
|
||||||
|
- increment = (increment < 0) ? 0 : increment;
|
||||||
|
- }
|
||||||
|
+ case L'\b':
|
||||||
|
+ increment = (column > 0) ? -1 : 0;
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ case L'\r':
|
||||||
|
+ increment = -1 * column;
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ case L'\t':
|
||||||
|
+ increment = 8 - column % 8;
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ default:
|
||||||
|
+ increment = wcwidth (wc);
|
||||||
|
+ increment = (increment < 0) ? 0 : increment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
@ -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.26
|
Version: 8.26
|
||||||
Release: 5%{?dist}
|
Release: 6%{?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/
|
||||||
@ -52,6 +52,8 @@ Patch805: coreutils-i18n-fix2-expand-unexpand.patch
|
|||||||
Patch806: coreutils-i18n-un-expand-BOM.patch
|
Patch806: coreutils-i18n-un-expand-BOM.patch
|
||||||
# make 'sort -h' work for arbitrary column even when using UTF-8 locales
|
# make 'sort -h' work for arbitrary column even when using UTF-8 locales
|
||||||
Patch807: coreutils-i18n-sort-human.patch
|
Patch807: coreutils-i18n-sort-human.patch
|
||||||
|
# fold: preserve new-lines in mutlibyte text (#1418505)
|
||||||
|
Patch808: coreutils-i18n-fold-newline.patch
|
||||||
|
|
||||||
#getgrouplist() patch from Ulrich Drepper.
|
#getgrouplist() patch from Ulrich Drepper.
|
||||||
Patch908: coreutils-getgrouplist.patch
|
Patch908: coreutils-getgrouplist.patch
|
||||||
@ -299,6 +301,9 @@ fi
|
|||||||
%license COPYING
|
%license COPYING
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Feb 03 2017 Kamil Dudka <kdudka@redhat.com> - 8.26-6
|
||||||
|
- fold: preserve new-lines in mutlibyte text (#1418505)
|
||||||
|
|
||||||
* Mon Jan 23 2017 Kamil Dudka <kdudka@redhat.com> - 8.26-5
|
* Mon Jan 23 2017 Kamil Dudka <kdudka@redhat.com> - 8.26-5
|
||||||
- date: fix TZ= regression (patch by Pádraig Brady)
|
- date: fix TZ= regression (patch by Pádraig Brady)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user