From 6b7b5c7453240ea205d2aa9390b90d855ce3c83a Mon Sep 17 00:00:00 2001 From: Jindrich Novy Date: Tue, 5 Sep 2006 12:52:12 +0000 Subject: [PATCH] - display hex values correctly even for non-UTF8 locales, thanks to Egmont Koblinger - fix BuildRoot --- mc-utf8-8bit-hex.patch | 26 ++++++++++++++++++++++++++ mc.spec | 11 +++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 mc-utf8-8bit-hex.patch diff --git a/mc-utf8-8bit-hex.patch b/mc-utf8-8bit-hex.patch new file mode 100644 index 0000000..b634999 --- /dev/null +++ b/mc-utf8-8bit-hex.patch @@ -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); diff --git a/mc.spec b/mc.spec index 92ccce8..e88733d 100644 --- a/mc.spec +++ b/mc.spec @@ -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 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 4.6.1a-26.fc6 - correctly highlight Requires(pre,post,preun,postun) in spec