summaryrefslogtreecommitdiffstats
path: root/app-arch/unzip/files/unzip-ds-rcc.patch
diff options
context:
space:
mode:
Diffstat (limited to 'app-arch/unzip/files/unzip-ds-rcc.patch')
-rw-r--r--app-arch/unzip/files/unzip-ds-rcc.patch105
1 files changed, 105 insertions, 0 deletions
diff --git a/app-arch/unzip/files/unzip-ds-rcc.patch b/app-arch/unzip/files/unzip-ds-rcc.patch
new file mode 100644
index 0000000..6b70685
--- /dev/null
+++ b/app-arch/unzip/files/unzip-ds-rcc.patch
@@ -0,0 +1,105 @@
+diff -dPNur unzip-5.51/dsrecode.h unzip-5.51-new/dsrecode.h
+--- unzip-5.51/dsrecode.h 1970-01-01 01:00:00.000000000 +0100
++++ unzip-5.51-new/dsrecode.h 2005-07-19 05:03:50.000000000 +0200
+@@ -0,0 +1,62 @@
++#include <librcc.h>
++
++static rcc_class_default_charset default_oem[] = {
++ { "ru", "IBM866" },
++ { NULL, NULL }
++};
++
++static rcc_class_default_charset default_iso[] = {
++ { "ru", "CP1251" },
++ { NULL, NULL }
++};
++
++#define OEM_CLASS 0
++#define ISO_CLASS 1
++#define OUT_CLASS 2
++static rcc_class classes[] = {
++ { "oem", RCC_CLASS_STANDARD, NULL, default_oem, "OEM_INTERN", 0 },
++ { "iso", RCC_CLASS_STANDARD, NULL, default_iso, "ISO_INTERN", 0 },
++ { "out", RCC_CLASS_STANDARD, "LC_CTYPE", NULL, "Output", 0 },
++ { NULL }
++};
++
++int initialized = 0;
++
++static void rccUnzipFree() {
++ if (initialized) {
++ rccFree();
++ initialized = 0;
++ }
++}
++
++static int rccUnzipInit() {
++ if (initialized) return 0;
++ rccInit();
++ rccInitDefaultContext(NULL, 0, 0, classes, 0);
++ rccInitDb4(NULL, NULL, 0);
++ atexit(rccUnzipFree);
++ initialized = 1;
++ return 0;
++}
++
++
++
++void _DS_OEM_INTERN(char *string) {
++ char *str;
++ rccUnzipInit();
++ str = rccRecode(NULL, OEM_CLASS, OUT_CLASS, string);
++ if (str) {
++ strncpy(string,str,FILNAMSIZ);
++ free(str);
++ }
++}
++
++void _DS_ISO_INTERN(char *string) {
++ char *str;
++ rccUnzipInit();
++ str = rccRecode(NULL, ISO_CLASS, OUT_CLASS, string);
++ if (str) {
++ strncpy(string,str,FILNAMSIZ);
++ free(str);
++ }
++}
+diff -dPNur unzip-5.51/fileio.c unzip-5.51-new/fileio.c
+--- unzip-5.51/fileio.c 2004-05-23 03:01:20.000000000 +0200
++++ unzip-5.51-new/fileio.c 2005-04-19 17:19:25.000000000 +0200
+@@ -78,7 +78,7 @@
+ # endif
+ #endif
+ #include "ebcdic.h" /* definition/initialization of ebcdic[] */
+-
++#include "dsrecode.h"
+
+ /*
+ Note: Under Windows, the maximum size of the buffer that can be used
+diff -dPNur unzip-5.51/unix/Makefile unzip-5.51-new/unix/Makefile
+--- unzip-5.51/unix/Makefile 2004-03-01 18:37:24.000000000 +0100
++++ unzip-5.51-new/unix/Makefile 2005-07-19 04:03:11.000000000 +0200
+@@ -43,7 +43,7 @@
+
+ # UnZip flags
+ CC = cc# try using "gcc" target rather than changing this (CC and LD
+-LD = $(CC)# must match, else "unresolved symbol: ___main" is possible)
++LD = $(CC) -lrcc# must match, else "unresolved symbol: ___main" is possible)
+ AS = as
+ LOC = $(LOCAL_UNZIP)
+ AF = $(LOC)
+diff -dPNur unzip-5.51/unzpriv.h unzip-5.51-new/unzpriv.h
+--- unzip-5.51/unzpriv.h 2004-03-01 19:09:04.000000000 +0100
++++ unzip-5.51-new/unzpriv.h 2005-04-19 17:19:25.000000000 +0200
+@@ -2521,9 +2521,9 @@
+ ((hostver) == 25 || (hostver) == 26 || (hostver) == 40))) || \
+ (hostnum) == FS_HPFS_ || \
+ ((hostnum) == FS_NTFS_ && (hostver) == 50)) { \
+- _OEM_INTERN((string)); \
++ _DS_OEM_INTERN((string)); \
+ } else { \
+- _ISO_INTERN((string)); \
++ _DS_ISO_INTERN((string)); \
+ }
+ #endif
+