--- unzip-5.52/ebcdic.h +++ unzip-5.52/ebcdic.h @@ -254,6 +254,25 @@ 0xD0, 0xA4, 0x95, 0xA2, 0x93, 0xE4, 0x94, 0xF6, /* F0 - F7 */ 0x9B, 0x97, 0xA3, 0x96, 0x81, 0xEC, 0xE7, 0x98 /* F8 - FF */ }; + +ZCONST uch Far iso2oem_2[] = { + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, + 0x20, 0xA4, 0xF4, 0x9D, 0xCF, 0x95, 0x97, 0xF5, + 0xF9, 0xE6, 0xB8, 0x9B, 0x8D, 0x2D, 0xA6, 0xBD, + 0x20, 0xA5, 0xF2, 0x88, 0xEF, 0x96, 0x98, 0xF3, + 0xF7, 0xE7, 0xAD, 0x9C, 0xAB, 0xF1, 0xA7, 0xBE, + 0xE8, 0xB5, 0xB6, 0xC6, 0x8E, 0x91, 0x8F, 0x80, + 0xAC, 0x90, 0xA8, 0xD3, 0xB7, 0xD6, 0xD7, 0xD2, + 0xD1, 0xE3, 0xD5, 0xE0, 0xE2, 0x8A, 0x99, 0x9E, + 0xFC, 0xDE, 0xE9, 0xEB, 0x9A, 0xED, 0xDD, 0xE1, + 0xEA, 0xA0, 0x83, 0xC7, 0x84, 0x92, 0x86, 0x87, + 0x9F, 0x82, 0xA9, 0x89, 0xD8, 0xA1, 0x8C, 0xD4, + 0xD0, 0xE4, 0xE5, 0xA2, 0x93, 0x8B, 0x94, 0xF6, + 0xFD, 0x85, 0xA3, 0xFB, 0x81, 0xEC, 0xEE, 0xFA +}; #endif /* IZ_ISO2OEM_ARRAY */ #ifdef IZ_OEM2ISO_ARRAY @@ -275,8 +294,28 @@ 0xAD, 0xB1, 0x3D, 0xBE, 0xB6, 0xA7, 0xF7, 0xB8, /* F0 - F7 */ 0xB0, 0xA8, 0xB7, 0xB9, 0xB3, 0xB2, 0xA6, 0xA0 /* F8 - FF */ }; + +ZCONST uch Far oem2iso_2[] = { + 0xC7, 0xFC, 0xE9, 0xE2, 0xE4, 0xF9, 0xE6, 0xE7, + 0xB3, 0xEB, 0xD5, 0xF5, 0xEE, 0xAC, 0xC4, 0xC6, + 0xC9, 0xC5, 0xE5, 0xF4, 0xF6, 0xA5, 0xB5, 0xA6, + 0xB6, 0xD6, 0xDC, 0xAB, 0xBB, 0xA3, 0xD7, 0xE8, + 0xE1, 0xED, 0xF3, 0xFA, 0xA1, 0xB1, 0xAE, 0xBE, + 0xCA, 0xEA, 0xAA, 0xBC, 0xC8, 0xBA, 0x3C, 0x3E, + 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xC1, 0xC2, 0xCC, + 0xAA, 0xB9, 0xBA, 0xBB, 0xBC, 0xAF, 0xBF, 0xBF, + 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC3, 0xE3, + 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xA4, + 0xF0, 0xD0, 0xCF, 0xCB, 0xEF, 0xD2, 0xCD, 0xCE, + 0xEC, 0xD9, 0xDA, 0xDB, 0xDC, 0xDE, 0xD9, 0xDF, + 0xD3, 0xDF, 0xD4, 0xD1, 0xF1, 0xF2, 0xA9, 0xB9, + 0xC0, 0xDA, 0xE0, 0xDB, 0xFD, 0xDD, 0xFE, 0xB4, + 0xF0, 0xBD, 0xB2, 0xB7, 0xA2, 0xA7, 0xF7, 0xB8, + 0xF8, 0xA8, 0xFF, 0xFB, 0xD8, 0xF8, 0xFE, 0xFF +}; #endif /* IZ_OEM2ISO_ARRAY */ + #if defined(THEOS) || defined(THEOS_SUPPORT) # include "theos/charconv.h" #endif --- unzip-5.52/man/unzip.1 +++ unzip-5.52/man/unzip.1 @@ -25,7 +25,7 @@ unzip \- list, test and extract compressed files in a ZIP archive .PD .SH SYNOPSIS -\fBunzip\fP [\fB\-Z\fP] [\fB\-cflptTuvz\fP[\fBabjnoqsCKLMVWX$/:\fP]] +\fBunzip\fP [\fB\-Z\fP] [\fB\-cflptTuvz\fP[\fBabjnoqsCKLMOVX$/:\fP]] \fIfile\fP[\fI.zip\fP] [\fIfile(s)\fP\ .\|.\|.] [\fB\-x\fP\ \fIxfile(s)\fP\ .\|.\|.] [\fB\-d\fP\ \fIexdir\fP] .PD @@ -342,6 +342,9 @@ overwrite existing files without prompting. This is a dangerous option, so use it with care. (It is often used with \fB\-f\fP, however, and is the only way to overwrite directory EAs under OS/2.) +.TP +.B \-O ++file names will be converted to ISO8859-2 instead of to ISO8859-1 .IP \fB\-P\fP\ \fIpassword\fP use \fIpassword\fP to decrypt encrypted zipfile entries (if any). \fBTHIS IS INSECURE!\fP Many multi-user operating systems provide ways for any user to --- unzip-5.52/unzip.c +++ unzip-5.52/unzip.c @@ -1327,6 +1327,12 @@ } else ++uO.overwrite_all; break; + case ('O'): /* spaces in filenames: allow by default */ + if (negative) + uO.iso8859_2 = FALSE, negative = 0; + else + uO.iso8859_2 = TRUE; + break; case ('p'): /* pipes: extract to stdout, no messages */ if (negative) { uO.cflag = FALSE; --- unzip-5.52/unzip.h +++ unzip-5.52/unzip.h @@ -462,6 +462,7 @@ int K_flag; /* -K: keep setuid/setgid/tacky permissions */ #endif int lflag; /* -12slmv: listing format (zipinfo) */ + int iso8859_2; /* -O: ISO8859-2 is used instead ISO8859-1 */ int L_flag; /* -L: convert filenames from some OSes to lowercase */ int overwrite_none; /* -n: never overwrite files (no prompting) */ #ifdef AMIGA --- unzip-5.52/unzpriv.h +++ unzip-5.52/unzpriv.h @@ -2456,8 +2456,15 @@ # define IZ_ISO2OEM_ARRAY # endif # define _ISO_INTERN(str1) {register uch *p;\ - for (p=(uch *)(str1); *p; p++)\ - *p = native((*p & 0x80) ? iso2oem[*p & 0x7f] : *p);} + if (uO.iso8859_2 == FASLE) { \ + for (p=(uch *)(str1); *p; p++) \ + *p = native((*p & 0x80) ? iso2oem[*p & 0x7f] : *p); \ + } \ + else { \ + for (p=(uch *)(str1); *p; p++) \ + *p = native((*p & 0x80) ? iso2oem_2[*p & 0x7f] : *p); \ + }; \ + } # else # define _ISO_INTERN(str1) A_TO_N(str1) # endif @@ -2471,8 +2478,15 @@ # define IZ_OEM2ISO_ARRAY # endif # define _OEM_INTERN(str1) {register uch *p;\ - for (p=(uch *)(str1); *p; p++)\ - *p = native((*p & 0x80) ? oem2iso[*p & 0x7f] : *p);} + if (uO.iso8859_2 == FALSE) { \ + for (p=(uch *)(str1); *p; p++) \ + *p = native((*p & 0x80) ? oem2iso[*p & 0x7f] : *p); \ + } \ + else { \ + for (p=(uch *)(str1); *p; p++) \ + *p = native((*p & 0x80) ? oem2iso_2[*p & 0x7f] : *p); \ + } \ + } # endif #endif @@ -2497,7 +2511,9 @@ #if (!defined(INTERN_TO_ISO) && !defined(ASCII2ISO)) # ifdef CRTL_CP_IS_OEM /* know: "ASCII" is "OEM" */ -# define ASCII2ISO(c) (((c) & 0x80) ? oem2iso[(c) & 0x7f] : (c)) +# define ASCII2ISO(c) (((c) & 0x80) ? \ + ((uO.iso8859_2 == FALSE) ? oem2iso[(c) & 0x7f] : oem2iso_2[(c) & 0x7f]) : \ + (c)) # if (defined(NEED_STR2ISO) && !defined(CRYP_USES_OEM2ISO)) # define CRYP_USES_OEM2ISO # endif @@ -2513,7 +2529,9 @@ # define ASCII2OEM(c) (c) # else /* assume: "ASCII" is "ISO-ANSI" */ -# define ASCII2OEM(c) (((c) & 0x80) ? iso2oem[(c) & 0x7f] : (c)) +# define ASCII2OEM(c) (((c) & 0x80) ? \ + ((uO.iso8859_2 == FALSE) ? iso2oem[(c) & 0x7f] : iso2oem_2[(c) & 0x7f]) : \ + (c)) # if (defined(NEED_STR2OEM) && !defined(CRYP_USES_ISO2OEM)) # define CRYP_USES_ISO2OEM # endif @@ -2584,9 +2602,11 @@ #endif #ifdef IZ_ISO2OEM_ARRAY extern ZCONST uch Far iso2oem[]; + extern ZCONST uch Far iso2oem_2[]; #endif #ifdef IZ_OEM2ISO_ARRAY extern ZCONST uch Far oem2iso[]; + extern ZCONST uch Far oem2iso_2[]; #endif extern ZCONST char Far VersionDate[];