- display hex values correctly even for non-UTF8 locales, thanks to Egmont

Koblinger
- fix BuildRoot
This commit is contained in:
Jindrich Novy 2006-09-05 12:52:12 +00:00
parent cef46d8523
commit 6b7b5c7453
2 changed files with 35 additions and 2 deletions

26
mc-utf8-8bit-hex.patch Normal file
View File

@ -0,0 +1,26 @@
--- mc-2006-08-12-18/edit/editdraw.c.8bit-hex 2006-09-05 14:35:21.000000000 +0200
+++ mc-2006-08-12-18/edit/editdraw.c 2006-09-05 14:35:21.000000000 +0200
@@ -70,12 +70,22 @@
*/
if (edit->curs1 < edit->last_byte) {
mc_wchar_t cur_byte = edit_get_byte (edit, edit->curs1);
+ mc_wchar_t cur_byte2 = cur_byte;
#ifndef UTF8
g_snprintf (byte_str, sizeof (byte_str), "%c %3d 0x%02X",
is_printable (cur_byte) ? cur_byte : '.',
#else /* UTF8 */
+ /* In 8-bit locales show the byte itself instead of its Unicode value */
+ if (MB_CUR_MAX == 1) {
+ unsigned char cur_8bit_byte;
+ mbstate_t mbs;
+ memset (&mbs, 0, sizeof (mbs));
+ if (wcrtomb(&cur_8bit_byte, cur_byte, &mbs) == 1) {
+ cur_byte = cur_8bit_byte;
+ }
+ }
g_snprintf (byte_str, sizeof(byte_str), "%lc %3d 0x%02X",
- iswprint(cur_byte) ? cur_byte : '.',
+ iswprint(cur_byte2) ? cur_byte2 : '.',
#endif /* UTF8 */
(int) cur_byte,
(unsigned) cur_byte);

11
mc.spec
View File

@ -3,13 +3,13 @@
Summary: User-friendly text console file manager and visual shell
Name: mc
Version: 4.6.1a
Release: 26%{?dist}
Release: 27%{?dist}
Epoch: 1
License: GPL
Group: System Environment/Shells
Source0: http://www.ibiblio.org/pub/Linux/utils/file/managers/mc/snapshots/mc-%{date}.tar.gz
URL: http://www.ibiblio.org/mc/
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: glib2-devel e2fsprogs-devel slang-devel
Requires: dev >= 0:3.3-3
@ -28,6 +28,7 @@ Patch12: mc-exit.patch
Patch13: mc-fishfix.patch
Patch14: mc-assembly.patch
Patch15: mc-spec.patch
Patch16: mc-utf8-8bit-hex.patch
%description
Midnight Commander is a visual shell much like a file manager, only
@ -54,6 +55,7 @@ specific files.
%patch13 -p1 -b .fishfix
%patch14 -p1 -b .assembly
%patch15 -p1 -b .spec
%patch16 -p1 -b .8bit-hex
# convert files in /lib to UTF-8
pushd lib
@ -198,6 +200,11 @@ rm -rf $RPM_BUILD_ROOT
%dir %{_sysconfdir}/mc
%changelog
* Tue Sep 5 2006 Jindrich Novy <jnovy@redhat.com> 4.6.1a-27.fc6
- display hex values correctly even for non-UTF8 locales, thanks
to Egmont Koblinger
- fix BuildRoot
* Sat Sep 2 2006 Jindrich Novy <jnovy@redhat.com> 4.6.1a-26.fc6
- correctly highlight Requires(pre,post,preun,postun) in spec