From f3754c9c3b920ba775345e310e201cd0787f2710 Mon Sep 17 00:00:00 2001 From: siemargl Date: Sat, 26 Nov 2016 16:00:49 +0000 Subject: [PATCH] base unicode version git-svn-id: svn://kolibrios.org@6764 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/fs/unzip60/kolibri/Makefile.gcc | 6 ++++-- .../fs/unzip60/kolibri/Makefile.gcc.static | 2 +- programs/fs/unzip60/kolibri/config.h | 6 +++--- programs/fs/unzip60/kolibri/kos32.c | 20 ++++++++++++------- programs/fs/unzip60/unzip.c | 4 ++++ 5 files changed, 25 insertions(+), 13 deletions(-) diff --git a/programs/fs/unzip60/kolibri/Makefile.gcc b/programs/fs/unzip60/kolibri/Makefile.gcc index 7b92c3a049..4132de84a3 100644 --- a/programs/fs/unzip60/kolibri/Makefile.gcc +++ b/programs/fs/unzip60/kolibri/Makefile.gcc @@ -20,6 +20,8 @@ SDK_DIR:= $(abspath ../../../contrib/sdk) NOASM=1 CC_CPU_OPT=-march=pentium #USEZLIB=1 +#DEBUG=1 + ### Optional section @@ -127,9 +129,9 @@ AS_WARN_OPT = $(CC_WARN_OPT) LD_WARN_OPT = # Debug version -CC_DEBUG_OPT = -g +CC_DEBUG_OPT = -g -DDEBUG AS_DEBUG_OPT = $(CC_DEBUG_OPT) -LD_DEBUG_OPT = $(CC_DEBUG_OPT) +LD_DEBUG_OPT = -g # Release version CC_RELEASE_OPT = diff --git a/programs/fs/unzip60/kolibri/Makefile.gcc.static b/programs/fs/unzip60/kolibri/Makefile.gcc.static index a477625e9a..435d415cfa 100644 --- a/programs/fs/unzip60/kolibri/Makefile.gcc.static +++ b/programs/fs/unzip60/kolibri/Makefile.gcc.static @@ -103,7 +103,7 @@ INCLUDES= -I $(SDK_DIR)/sources/newlib/libc/include -I $(SDK_DIR)/sources/zlib LIBPATH = -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib CC_ENVIR_OPT = -U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 -DKOS32 \ - $(INCLUDES) -DSTATIC_LIBC + $(INCLUDES) -DSTATIC_LIBC -DBUILD_LIBC ### Compiler-specific section diff --git a/programs/fs/unzip60/kolibri/config.h b/programs/fs/unzip60/kolibri/config.h index 694b167926..a1b4685140 100644 --- a/programs/fs/unzip60/kolibri/config.h +++ b/programs/fs/unzip60/kolibri/config.h @@ -13,9 +13,6 @@ Started by Siemargl @Nov 2016 #include #include -// moved to makefile, in kilibri leads to bug EMFILES -//#define DEBUG - #define DIR_END '/' #define NO_STRNICMP #define STRNICMP zstrnicmp @@ -27,6 +24,9 @@ Started by Siemargl @Nov 2016 #define getch() getchar() /* not correct, but may not be on a console */ #define HAVE_WORKING_GETCH +#define UNICODE_SUPPORT +#define UTF8_MAYBE_NATIVE +#define NO_NL_LANGINFO /* # ifdef DATE_FORMAT # undef DATE_FORMAT diff --git a/programs/fs/unzip60/kolibri/kos32.c b/programs/fs/unzip60/kolibri/kos32.c index 429de3c1aa..18a6cdf8b4 100644 --- a/programs/fs/unzip60/kolibri/kos32.c +++ b/programs/fs/unzip60/kolibri/kos32.c @@ -154,6 +154,8 @@ int mapname(__G__ renamed) else ++cp; /* point to start of last component of path */ +fprintf(stderr, "mapname start[%s]\n", cp); + /*--------------------------------------------------------------------------- Begin main loop through characters in filename. ---------------------------------------------------------------------------*/ @@ -180,7 +182,7 @@ int mapname(__G__ renamed) lastsemi = (char *)NULL; /* leave direct. semi-colons alone */ break; -#ifdef __CYGWIN__ /* Cygwin runs on Win32, apply FAT/NTFS filename rules */ +#ifdef KOS32 /* Cygwin runs on Win32, apply FAT/NTFS filename rules */ case ':': /* drive spec not stored, so no colon allowed */ case '\\': /* '\\' may come as normal filename char (not */ case '<': /* dir sep char!) from unix-like file system */ @@ -205,7 +207,7 @@ int mapname(__G__ renamed) break; /* later, if requested */ #endif -#ifdef MTS +#ifdef KOS32 case ' ': /* change spaces to underscore under */ *pp++ = '_'; /* MTS; leave as spaces under Unix */ break; @@ -217,11 +219,6 @@ int mapname(__G__ renamed) */ if ((isprint(workch) || (128 <= workch && workch <= 254))) *pp++ = (char)workch; -/*kos - if (uO.cflxflag || - (isprint(workch) || (128 <= workch && workch <= 254))) - *pp++ = (char)workch; -*/ } /* end switch */ } /* end while loop */ @@ -326,6 +323,9 @@ int mapname(__G__ renamed) checkdir(__G__ pathcomp, APPEND_NAME); /* returns 1 if truncated: care? */ checkdir(__G__ G.filename, GETPATH); +fprintf(stderr, "mapname end[%s]\n", pathcomp); + + return error; } /* end function mapname() */ @@ -467,6 +467,12 @@ int checkdir(__G__ pathcomp, flag) ---------------------------------------------------------------------------*/ if (FUNCTION == GETPATH) { + if(G.native_is_utf8) + { + pathcomp[0] = 3; // kolibri utf8 flag + strcpy(pathcomp + 1, G.buildpath); + } + else strcpy(pathcomp, G.buildpath); Trace((stderr, "getting and freeing path [%s]\n", FnFilter1(pathcomp))); diff --git a/programs/fs/unzip60/unzip.c b/programs/fs/unzip60/unzip.c index 8dbfc9520c..6392b51dad 100644 --- a/programs/fs/unzip60/unzip.c +++ b/programs/fs/unzip60/unzip.c @@ -790,6 +790,10 @@ int unzip(__G__ argc, argv) * UnZip maintainer, a successful switch to "en-US.UTF-8" * resulted in garbage display of all non-basic ASCII characters. */ +#ifdef KOS32 + /* manual override */ + G.native_is_utf8 = TRUE; +#endif } # endif /* UTF8_MAYBE_NATIVE */