diff options
author | Natrio | 2015-06-15 14:17:44 +0300 |
---|---|---|
committer | Natrio | 2015-06-15 14:17:44 +0300 |
commit | 584df57b04e692adf657ae781ac11d28a193c7de (patch) | |
tree | b7bbd21d26760965c62e13b874701845e5856cb4 | |
download | aur-584df57b04e692adf657ae781ac11d28a193c7de.tar.gz |
Initial import
-rw-r--r-- | .SRCINFO | 28 | ||||
-rw-r--r-- | PKGBUILD | 42 | ||||
-rw-r--r-- | crc32.patch | 45 | ||||
-rw-r--r-- | getZip64Data.patch | 133 | ||||
-rw-r--r-- | test_compr_eb.patch | 23 | ||||
-rw-r--r-- | unzip-6.0-alt-natspec.patch | 343 |
6 files changed, 614 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..48b997d1a5b9 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,28 @@ +pkgbase = unzip-natspec + pkgdesc = Unpacks .zip archives with non-latin filenames, using libnatspec patch from AltLinux. + pkgver = 6.0 + pkgrel = 5 + url = http://www.info-zip.org/ + arch = i686 + arch = x86_64 + arch = armv7h + arch = armv6h + license = custom + depends = bzip2 + depends = bash + depends = libnatspec + provides = unzip + conflicts = unzip + source = http://downloads.sourceforge.net/infozip/unzip60.tar.gz + source = unzip-6.0-alt-natspec.patch + source = test_compr_eb.patch + source = getZip64Data.patch + source = crc32.patch + sha256sums = 036d96991646d0449ed0aa952e4fbe21b476ce994abc276e49d30e686708bd37 + sha256sums = SKIP + sha256sums = SKIP + sha256sums = SKIP + sha256sums = SKIP + +pkgname = unzip-natspec + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..f27f05ca93a0 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,42 @@ +# Maintainer: Natrio <natrio list ru> +# Contributor: Thayer Williams <thayer archlinux org> +# Contributor: Douglas Soares de Andrade <douglas archlinux org> +# Contributor: Robson Peixoto + +pkgname=unzip-natspec +pkgver=6.0 +pkgrel=5 +pkgdesc="Unpacks .zip archives with non-latin filenames, using libnatspec patch from AltLinux." +arch=('i686' 'x86_64' 'armv7h' 'armv6h') +url="http://www.info-zip.org/" +license=('custom') +depends=('bzip2' 'bash' 'libnatspec') +conflicts=('unzip') +provides=('unzip') +source=('http://downloads.sourceforge.net/infozip/unzip60.tar.gz' + unzip-6.0-alt-natspec.patch + test_compr_eb.patch getZip64Data.patch crc32.patch ) +sha256sums=('036d96991646d0449ed0aa952e4fbe21b476ce994abc276e49d30e686708bd37' + SKIP SKIP SKIP SKIP ) + +build() { + cd ${srcdir}/${pkgname/-natspec/}${pkgver/./} + patch -p1 -i ${srcdir}/unzip-6.0-alt-natspec.patch || return 1 + patch -i ${srcdir}/test_compr_eb.patch || return 1 # FS#43391 + patch -i ${srcdir}/getZip64Data.patch || return 1 # FS#43300 + patch -i ${srcdir}/crc32.patch || return 1 # FS#43300 + export CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -DACORN_FTYPE_NFS \ + -DWILD_STOP_AT_DIR -DLARGE_FILE_SUPPORT -DUNICODE_SUPPORT \ + -DUNICODE_WCHAR -DUTF8_MAYBE_NATIVE -DNO_LCHMOD -DDATE_FORMAT=DF_YMD \ + -DUSE_BZIP2 -DNATIVE -DNOMEMCPY -DNO_SETLOCALE" + make -f unix/Makefile LOCAL_UNZIP="$CFLAGS" prefix=/usr \ + D_USE_BZ2=-DUSE_BZIP2 L_BZ2=-lbz2 unzips || return 1 +} + +package() { + cd ${srcdir}/${pkgname/-natspec/}${pkgver/./} + make -f unix/Makefile prefix=$pkgdir/usr INSTALL_PROGRAM="install" install || return 1 + install -Dm644 LICENSE $pkgdir/usr/share/licenses/unzip/LICENSE || return 1 + mkdir -p $pkgdir/usr/share || return 1 + mv $pkgdir/usr/man $pkgdir/usr/share/ || return 1 +} diff --git a/crc32.patch b/crc32.patch new file mode 100644 index 000000000000..43b29d78332b --- /dev/null +++ b/crc32.patch @@ -0,0 +1,45 @@ +--- unzip60/extract.c 2010-04-03 14:41:55 -0500 ++++ unzip60/extract.c 2014-12-03 15:33:35 -0600 +@@ -1,5 +1,5 @@ + /* +- Copyright (c) 1990-2009 Info-ZIP. All rights reserved. ++ Copyright (c) 1990-2014 Info-ZIP. All rights reserved. + + See the accompanying file LICENSE, version 2009-Jan-02 or later + (the contents of which are also included in unzip.h) for terms of use. +@@ -298,6 +298,8 @@ + #ifndef SFX + static ZCONST char Far InconsistEFlength[] = "bad extra-field entry:\n \ + EF block length (%u bytes) exceeds remaining EF data (%u bytes)\n"; ++ static ZCONST char Far TooSmallEFlength[] = "bad extra-field entry:\n \ ++ EF block length (%u bytes) invalid (< %d)\n"; + static ZCONST char Far InvalidComprDataEAs[] = + " invalid compressed data for EAs\n"; + # if (defined(WIN32) && defined(NTSD_EAS)) +@@ -2023,7 +2025,8 @@ + ebID = makeword(ef); + ebLen = (unsigned)makeword(ef+EB_LEN); + +- if (ebLen > (ef_len - EB_HEADSIZE)) { ++ if (ebLen > (ef_len - EB_HEADSIZE)) ++ { + /* Discovered some extra field inconsistency! */ + if (uO.qflag) + Info(slide, 1, ((char *)slide, "%-22s ", +@@ -2032,6 +2035,16 @@ + ebLen, (ef_len - EB_HEADSIZE))); + return PK_ERR; + } ++ else if (ebLen < EB_HEADSIZE) ++ { ++ /* Extra block length smaller than header length. */ ++ if (uO.qflag) ++ Info(slide, 1, ((char *)slide, "%-22s ", ++ FnFilter1(G.filename))); ++ Info(slide, 1, ((char *)slide, LoadFarString(TooSmallEFlength), ++ ebLen, EB_HEADSIZE)); ++ return PK_ERR; ++ } + + switch (ebID) { + case EF_OS2: diff --git a/getZip64Data.patch b/getZip64Data.patch new file mode 100644 index 000000000000..1684c7391aa5 --- /dev/null +++ b/getZip64Data.patch @@ -0,0 +1,133 @@ +--- process.c 2009-03-06 02:25:10.000000000 +0100 ++++ process.c 2014-12-05 22:42:39.000000000 +0100 +@@ -1,5 +1,5 @@ + /* +- Copyright (c) 1990-2009 Info-ZIP. All rights reserved. ++ Copyright (c) 1990-2014 Info-ZIP. All rights reserved. + + See the accompanying file LICENSE, version 2009-Jan-02 or later + (the contents of which are also included in unzip.h) for terms of use. +@@ -1888,48 +1888,82 @@ int getZip64Data(__G__ ef_buf, ef_len) + and a 4-byte version of disk start number. + Sets both local header and central header fields. Not terribly clever, + but it means that this procedure is only called in one place. ++ ++ 2014-12-05 SMS. ++ Added checks to ensure that enough data are available before calling ++ makeint64() or makelong(). Replaced various sizeof() values with ++ simple ("4" or "8") constants. (The Zip64 structures do not depend ++ on our variable sizes.) Error handling is crude, but we should now ++ stay within the buffer. + ---------------------------------------------------------------------------*/ + ++#define Z64FLGS 0xffff ++#define Z64FLGL 0xffffffff ++ + if (ef_len == 0 || ef_buf == NULL) + return PK_COOL; + + Trace((stderr,"\ngetZip64Data: scanning extra field of length %u\n", + ef_len)); + +- while (ef_len >= EB_HEADSIZE) { ++ while (ef_len >= EB_HEADSIZE) ++ { + eb_id = makeword(EB_ID + ef_buf); + eb_len = makeword(EB_LEN + ef_buf); + +- if (eb_len > (ef_len - EB_HEADSIZE)) { +- /* discovered some extra field inconsistency! */ ++ if (eb_len > (ef_len - EB_HEADSIZE)) ++ { ++ /* Extra block length exceeds remaining extra field length. */ + Trace((stderr, + "getZip64Data: block length %u > rest ef_size %u\n", eb_len, + ef_len - EB_HEADSIZE)); + break; + } +- if (eb_id == EF_PKSZ64) { +- ++ if (eb_id == EF_PKSZ64) ++ { + int offset = EB_HEADSIZE; + +- if (G.crec.ucsize == 0xffffffff || G.lrec.ucsize == 0xffffffff){ +- G.lrec.ucsize = G.crec.ucsize = makeint64(offset + ef_buf); +- offset += sizeof(G.crec.ucsize); ++ if ((G.crec.ucsize == Z64FLGL) || (G.lrec.ucsize == Z64FLGL)) ++ { ++ if (offset+ 8 > ef_len) ++ return PK_ERR; ++ ++ G.crec.ucsize = G.lrec.ucsize = makeint64(offset + ef_buf); ++ offset += 8; + } +- if (G.crec.csize == 0xffffffff || G.lrec.csize == 0xffffffff){ +- G.csize = G.lrec.csize = G.crec.csize = makeint64(offset + ef_buf); +- offset += sizeof(G.crec.csize); ++ ++ if ((G.crec.csize == Z64FLGL) || (G.lrec.csize == Z64FLGL)) ++ { ++ if (offset+ 8 > ef_len) ++ return PK_ERR; ++ ++ G.csize = G.crec.csize = G.lrec.csize = makeint64(offset + ef_buf); ++ offset += 8; + } +- if (G.crec.relative_offset_local_header == 0xffffffff){ ++ ++ if (G.crec.relative_offset_local_header == Z64FLGL) ++ { ++ if (offset+ 8 > ef_len) ++ return PK_ERR; ++ + G.crec.relative_offset_local_header = makeint64(offset + ef_buf); +- offset += sizeof(G.crec.relative_offset_local_header); ++ offset += 8; + } +- if (G.crec.disk_number_start == 0xffff){ ++ ++ if (G.crec.disk_number_start == Z64FLGS) ++ { ++ if (offset+ 4 > ef_len) ++ return PK_ERR; ++ + G.crec.disk_number_start = (zuvl_t)makelong(offset + ef_buf); +- offset += sizeof(G.crec.disk_number_start); ++ offset += 4; + } ++#if 0 ++ break; /* Expect only one EF_PKSZ64 block. */ ++#endif /* 0 */ + } + +- /* Skip this extra field block */ ++ /* Skip this extra field block. */ + ef_buf += (eb_len + EB_HEADSIZE); + ef_len -= (eb_len + EB_HEADSIZE); + } +--- fileio.c 2009-04-20 02:03:44.000000000 +0200 ++++ fileio.c 2014-12-05 22:44:16.000000000 +0100 +@@ -176,6 +176,8 @@ static ZCONST char Far FilenameTooLongTr + #endif + static ZCONST char Far ExtraFieldTooLong[] = + "warning: extra field too long (%d). Ignoring...\n"; ++static ZCONST char Far ExtraFieldCorrupt[] = ++ "warning: extra field (type: 0x%04x) corrupt. Continuing...\n"; + + #ifdef WINDLL + static ZCONST char Far DiskFullQuery[] = +@@ -2295,7 +2297,12 @@ int do_string(__G__ length, option) /* + if (readbuf(__G__ (char *)G.extra_field, length) == 0) + return PK_EOF; + /* Looks like here is where extra fields are read */ +- getZip64Data(__G__ G.extra_field, length); ++ if (getZip64Data(__G__ G.extra_field, length) != PK_COOL) ++ { ++ Info(slide, 0x401, ((char *)slide, ++ LoadFarString( ExtraFieldCorrupt), EF_PKSZ64)); ++ error = PK_WARN; ++ } + #ifdef UNICODE_SUPPORT + G.unipath_filename = NULL; + if (G.UzO.U_flag < 2) { diff --git a/test_compr_eb.patch b/test_compr_eb.patch new file mode 100644 index 000000000000..7e8c2976e4e0 --- /dev/null +++ b/test_compr_eb.patch @@ -0,0 +1,23 @@ +--- extract.c 2009-03-14 02:32:52.000000000 +0100 ++++ extract.c 2014-12-05 22:43:13.000000000 +0100 +@@ -2221,10 +2234,17 @@ static int test_compr_eb(__G__ eb, eb_si + if (compr_offset < 4) /* field is not compressed: */ + return PK_OK; /* do nothing and signal OK */ + ++ /* Return no/bad-data error status if any problem is found: ++ * 1. eb_size is too small to hold the uncompressed size ++ * (eb_ucsize). (Else extract eb_ucsize.) ++ * 2. eb_ucsize is zero (invalid). 2014-12-04 SMS. ++ * 3. eb_ucsize is positive, but eb_size is too small to hold ++ * the compressed data header. ++ */ + if ((eb_size < (EB_UCSIZE_P + 4)) || +- ((eb_ucsize = makelong(eb+(EB_HEADSIZE+EB_UCSIZE_P))) > 0L && +- eb_size <= (compr_offset + EB_CMPRHEADLEN))) +- return IZ_EF_TRUNC; /* no compressed data! */ ++ ((eb_ucsize = makelong( eb+ (EB_HEADSIZE+ EB_UCSIZE_P))) == 0L) || ++ ((eb_ucsize > 0L) && (eb_size <= (compr_offset + EB_CMPRHEADLEN)))) ++ return IZ_EF_TRUNC; /* no/bad compressed data! */ + + if ( + #ifdef INT_16BIT diff --git a/unzip-6.0-alt-natspec.patch b/unzip-6.0-alt-natspec.patch new file mode 100644 index 000000000000..16942d946c00 --- /dev/null +++ b/unzip-6.0-alt-natspec.patch @@ -0,0 +1,343 @@ +diff -pur unzip-5.52-orig/unix/Makefile unzip-5.52/unix/Makefile +--- unzip-5.52-orig/unix/Makefile 2007-07-30 11:40:15 +0400 ++++ unzip-5.52/unix/Makefile 2007-07-30 12:03:54 +0400 +@@ -52,7 +52,7 @@ + CF = $(CFLAGS) $(CF_NOOPT) + LFLAGS1 = + LF = -o unzip$E $(LFLAGS1) +-LF2 = -s ++LF2 = -l natspec + + # UnZipSFX flags + SL = -o unzipsfx$E $(LFLAGS1) +diff -pur unzip-5.52-orig/unix/unix.c unzip-5.52/unix/unix.c +--- unzip-5.52-orig/unix/unix.c 2007-07-30 11:40:15 +0400 ++++ unzip-5.52/unix/unix.c 2007-07-30 12:23:42 +0400 +@@ -30,6 +30,9 @@ + #define UNZIP_INTERNAL + #include "unzip.h" + ++#include <iconv.h> ++#include <natspec.h> ++ + #ifdef SCO_XENIX + # define SYSNDIR + #else /* SCO Unix, AIX, DNIX, TI SysV, Coherent 4.x, ... */ +@@ -1666,3 +1669,44 @@ static void qlfix(__G__ ef_ptr, ef_len) + } + } + #endif /* QLZIP */ ++ ++ ++char OEM_CP[MAX_CP_NAME] = ""; ++char ISO_CP[MAX_CP_NAME] = ""; ++ ++/* Getr the default value of OEM_CP based on the current locale. ++ * ISO_CP is left alone for now. */ ++void init_conversion_charsets() ++{ ++ /* Make a guess only if OEM_CP not already set. */ ++ if(*OEM_CP == '\0') { ++ const char * archive_charset = natspec_get_charset_by_locale(NATSPEC_DOSCS, ""); ++ strncpy(OEM_CP, archive_charset, sizeof(OEM_CP)); ++ } ++ ++ if(*ISO_CP == '\0') { ++ const char * archive_charset = natspec_get_charset_by_locale(NATSPEC_WINCS, ""); ++ strncpy(ISO_CP, archive_charset, sizeof(ISO_CP)); ++ } ++ ++} ++ ++/* Convert a string from OEM_CP to the current locale charset. */ ++inline void oem_intern(char *string) ++{ ++ char *buf = natspec_convert(string, 0, OEM_CP, 0); ++ /* Since Ext_ASCII_TO_Native used only for G.filename[FILNAMESIZE], ++ use FILNAMSIZ as string size */ ++ strncpy(string, buf, FILNAMSIZ); ++ free (buf); ++} ++ ++/* Convert a string from ISO_CP to the current locale charset. */ ++inline void iso_intern(char *string) ++{ ++ char *buf = natspec_convert(string, 0, ISO_CP, 0); ++ /* Since Ext_ASCII_TO_Native used only for G.filename[FILNAMESIZE], ++ use FILNAMSIZ as string size */ ++ strncpy(string, buf, FILNAMSIZ); ++ free (buf); ++} +diff -pur unzip-5.52-orig/unix/unxcfg.h unzip-5.52/unix/unxcfg.h +--- unzip-5.52-orig/unix/unxcfg.h 2005-01-05 03:54:22 +0300 ++++ unzip-5.52/unix/unxcfg.h 2007-07-30 12:06:17 +0400 +@@ -141,4 +141,30 @@ + /* wild_dir, dirname, wildname, matchname[], dirnamelen, have_dirname, */ + /* and notfirstcall are used by do_wild(). */ + ++ ++#define MAX_CP_NAME 25 ++ ++#ifdef SETLOCALE ++# undef SETLOCALE ++#endif ++#define SETLOCALE(category, locale) setlocale(category, locale) ++#include <locale.h> ++ ++#ifdef _ISO_INTERN ++# undef _ISO_INTERN ++#endif ++#define _ISO_INTERN(str1) iso_intern(str1) ++ ++#ifdef _OEM_INTERN ++# undef _OEM_INTERN ++#endif ++#ifndef IZ_OEM2ISO_ARRAY ++# define IZ_OEM2ISO_ARRAY ++#endif ++#define _OEM_INTERN(str1) oem_intern(str1) ++ ++void iso_intern(char *); ++void oem_intern(char *); ++void init_conversion_charsets(void); ++ + #endif /* !__unxcfg_h */ +diff -pur unzip-5.52-orig/unzip.c unzip-5.52/unzip.c +--- unzip-5.52-orig/unzip.c 2005-02-27 07:37:14 +0300 ++++ unzip-5.52/unzip.c 2007-07-30 11:40:28 +0400 +@@ -331,7 +331,9 @@ + -h print header line -t print totals for listed files or for all\n\ + -z print zipfile comment -T print file times in sortable decimal format\ + \n -C be case-insensitive %s\ +- -x exclude filenames that follow from listing\n"; ++ -x exclude filenames that follow from listing\n\ ++ -O CHARSET specify a character encoding for DOS, Windows and OS/2 archives\n\ ++ -I CHARSET specify a character encoding for UNIX and other archives\n"; + #ifdef MORE + static ZCONST char Far ZipInfoUsageLine4[] = + " -M page output through built-in \"more\"\n"; +@@ -570,8 +572,7 @@ + #else /* !VMS */ + # ifdef COPYRIGHT_CLEAN + static ZCONST char Far UnzipUsageLine1[] = "\ +-UnZip %d.%d%d%s of %s, by Info-ZIP. Maintained by C. Spieler. Send\n\ +-bug reports using http://www.info-zip.org/zip-bug.html; see README for details.\ ++UnZip %d.%d%d%s of %s, by ALT Linux Team. Original by Info-ZIP.\ + \n\n"; + # else + static ZCONST char Far UnzipUsageLine1[] = "\ +@@ -673,7 +674,9 @@ + -j junk paths (do not make directories) -aa treat ALL files as text\n\ + -U use escapes for all non-ASCII Unicode -UU ignore any Unicode fields\n\ + -C match filenames case-insensitively -L make (some) names \ +-lowercase\n %-42s -V retain VMS version numbers\n%s"; ++lowercase\n %-42s -V retain VMS version numbers\n%s\ ++ -O CHARSET specify a character encoding for DOS, Windows and OS/2 archives\n\ ++ -I CHARSET specify a character encoding for UNIX and other archives\n"; + #endif /* ?VMS */ + #else /* !UNICODE_SUPPORT */ + #ifdef VMS +@@ -692,7 +695,9 @@ + -o overwrite files WITHOUT prompting -a auto-convert any text files\n\ + -j junk paths (do not make directories) -aa treat ALL files as text\n\ + -C match filenames case-insensitively -L make (some) names \ +-lowercase\n %-42s -V retain VMS version numbers\n%s"; ++lowercase\n %-42s -V retain VMS version numbers\n%s\ ++ -O CHARSET specify a character encoding for DOS, Windows and OS/2 archives\n\ ++ -I CHARSET specify a character encoding for UNIX and other archives\n"; + #endif /* ?VMS */ + #endif /* ?UNICODE_SUPPORT */ + +@@ -668,6 +690,10 @@ int unzip(__G__ argc, argv) + + SETLOCALE(LC_CTYPE,""); + ++#ifdef UNIX ++ init_conversion_charsets(); ++#endif ++ + #if (defined(__IBMC__) && defined(__DEBUG_ALLOC__)) + extern void DebugMalloc(void); + +@@ -1089,6 +1115,11 @@ int uz_opts(__G__ pargc, pargv) + argc = *pargc; + argv = *pargv; + ++#ifdef UNIX ++ extern char OEM_CP[MAX_CP_NAME]; ++ extern char ISO_CP[MAX_CP_NAME]; ++#endif ++ + while (++argv, (--argc > 0 && *argv != NULL && **argv == '-')) { + s = *argv + 1; + while ((c = *s++) != 0) { /* "!= 0": prevent Turbo C warning */ +@@ -1252,6 +1283,35 @@ int uz_opts(__G__ pargc, pargv) + } + break; + #endif /* MACOS */ ++#ifdef UNIX ++ case ('I'): ++ if (negative) { ++ Info(slide, 0x401, ((char *)slide, ++ "error: encodings can't be negated")); ++ return(PK_PARAM); ++ } else { ++ if(*s) { /* Handle the -Icharset case */ ++ /* Assume that charsets can't start with a dash to spot arguments misuse */ ++ if(*s == '-') { ++ Info(slide, 0x401, ((char *)slide, ++ "error: a valid character encoding should follow the -I argument")); ++ return(PK_PARAM); ++ } ++ strncpy(ISO_CP, s, sizeof(ISO_CP)); ++ } else { /* -I charset */ ++ ++argv; ++ if(!(--argc > 0 && *argv != NULL && **argv != '-')) { ++ Info(slide, 0x401, ((char *)slide, ++ "error: a valid character encoding should follow the -I argument")); ++ return(PK_PARAM); ++ } ++ s = *argv; ++ strncpy(ISO_CP, s, sizeof(ISO_CP)); ++ } ++ while(*(++s)); /* No params straight after charset name */ ++ } ++ break; ++#endif /* ?UNIX */ + case ('j'): /* junk pathnames/directory structure */ + if (negative) + uO.jflag = FALSE, negative = 0; +@@ -1327,6 +1387,35 @@ int uz_opts(__G__ pargc, pargv) + } else + ++uO.overwrite_all; + break; ++#ifdef UNIX ++ case ('O'): ++ if (negative) { ++ Info(slide, 0x401, ((char *)slide, ++ "error: encodings can't be negated")); ++ return(PK_PARAM); ++ } else { ++ if(*s) { /* Handle the -Ocharset case */ ++ /* Assume that charsets can't start with a dash to spot arguments misuse */ ++ if(*s == '-') { ++ Info(slide, 0x401, ((char *)slide, ++ "error: a valid character encoding should follow the -I argument")); ++ return(PK_PARAM); ++ } ++ strncpy(OEM_CP, s, sizeof(OEM_CP)); ++ } else { /* -O charset */ ++ ++argv; ++ if(!(--argc > 0 && *argv != NULL && **argv != '-')) { ++ Info(slide, 0x401, ((char *)slide, ++ "error: a valid character encoding should follow the -O argument")); ++ return(PK_PARAM); ++ } ++ s = *argv; ++ strncpy(OEM_CP, s, sizeof(OEM_CP)); ++ } ++ while(*(++s)); /* No params straight after charset name */ ++ } ++ break; ++#endif /* ?UNIX */ + case ('p'): /* pipes: extract to stdout, no messages */ + if (negative) { + uO.cflag = FALSE; +diff -pur unzip-5.52-orig/unzpriv.h unzip-5.52/unzpriv.h +--- unzip-5.52-orig/unzpriv.h 2007-07-30 11:40:15 +0400 ++++ unzip-5.52/unzpriv.h 2007-07-30 11:40:28 +0400 +@@ -2564,7 +2566,7 @@ char *GetLoadPath OF((__GPRO)); + !(((islochdr) || (isuxatt)) && \ + ((hostver) == 25 || (hostver) == 26 || (hostver) == 40))) || \ + (hostnum) == FS_HPFS_ || \ +- ((hostnum) == FS_NTFS_ && (hostver) == 50)) { \ ++ ((hostnum) == FS_NTFS_/* && (hostver) == 50*/)) { \ + _OEM_INTERN((string)); \ + } else { \ + _ISO_INTERN((string)); \ +diff -pur unzip-5.52-orig/zipinfo.c unzip-5.52/zipinfo.c +--- unzip-5.52-orig/zipinfo.c 2005-01-27 04:02:16 +0300 ++++ unzip-5.52/zipinfo.c 2007-07-30 11:40:28 +0400 +@@ -447,6 +447,10 @@ int zi_opts(__G__ pargc, pargv) + int tflag_slm=TRUE, tflag_2v=FALSE; + int explicit_h=FALSE, explicit_t=FALSE; + ++#ifdef UNIX ++ extern char OEM_CP[MAX_CP_NAME]; ++ extern char ISO_CP[MAX_CP_NAME]; ++#endif + + #ifdef MACOS + uO.lflag = LFLAG; /* reset default on each call */ +@@ -491,6 +495,35 @@ int zi_opts(__G__ pargc, pargv) + uO.lflag = 0; + } + break; ++#ifdef UNIX ++ case ('I'): ++ if (negative) { ++ Info(slide, 0x401, ((char *)slide, ++ "error: encodings can't be negated")); ++ return(PK_PARAM); ++ } else { ++ if(*s) { /* Handle the -Icharset case */ ++ /* Assume that charsets can't start with a dash to spot arguments misuse */ ++ if(*s == '-') { ++ Info(slide, 0x401, ((char *)slide, ++ "error: a valid character encoding should follow the -I argument")); ++ return(PK_PARAM); ++ } ++ strncpy(ISO_CP, s, sizeof(ISO_CP)); ++ } else { /* -I charset */ ++ ++argv; ++ if(!(--argc > 0 && *argv != NULL && **argv != '-')) { ++ Info(slide, 0x401, ((char *)slide, ++ "error: a valid character encoding should follow the -I argument")); ++ return(PK_PARAM); ++ } ++ s = *argv; ++ strncpy(ISO_CP, s, sizeof(ISO_CP)); ++ } ++ while(*(++s)); /* No params straight after charset name */ ++ } ++ break; ++#endif /* ?UNIX */ + case 'l': /* longer form of "ls -l" type listing */ + if (negative) + uO.lflag = -2, negative = 0; +@@ -511,6 +544,35 @@ int zi_opts(__G__ pargc, pargv) + G.M_flag = TRUE; + break; + #endif ++#ifdef UNIX ++ case ('O'): ++ if (negative) { ++ Info(slide, 0x401, ((char *)slide, ++ "error: encodings can't be negated")); ++ return(PK_PARAM); ++ } else { ++ if(*s) { /* Handle the -Ocharset case */ ++ /* Assume that charsets can't start with a dash to spot arguments misuse */ ++ if(*s == '-') { ++ Info(slide, 0x401, ((char *)slide, ++ "error: a valid character encoding should follow the -I argument")); ++ return(PK_PARAM); ++ } ++ strncpy(OEM_CP, s, sizeof(OEM_CP)); ++ } else { /* -O charset */ ++ ++argv; ++ if(!(--argc > 0 && *argv != NULL && **argv != '-')) { ++ Info(slide, 0x401, ((char *)slide, ++ "error: a valid character encoding should follow the -O argument")); ++ return(PK_PARAM); ++ } ++ s = *argv; ++ strncpy(OEM_CP, s, sizeof(OEM_CP)); ++ } ++ while(*(++s)); /* No params straight after charset name */ ++ } ++ break; ++#endif /* ?UNIX */ + case 's': /* default: shorter "ls -l" type listing */ + if (negative) + uO.lflag = -2, negative = 0; |