File zip-2.3-iso8859_2.patch of Package zip

--- ebcdic.h
+++ 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
@@ -274,6 +293,25 @@
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ARRAY */
 
--- globals.c
+++ globals.c
@@ -30,6 +30,8 @@
 int scanimage = 1;      /* 1=scan through image files */
 #endif
 int method = BEST;      /* one of BEST, DEFLATE (only), or STORE (only) */
+int winify = 0;         /* 1=file names will be converted from IBM PC CP 850 to ISO8859-1 */
+int iso8859_2 = 0;      /* 1=ISO8859-2 will be used instead of ISO8859-1 */
 int dosify = 0;         /* 1=make new entries look like MSDOS */
 int verbose = 0;        /* 1=report oddities in zip file structure */
 int fix = 0;            /* 1=fix the zip file */
--- man/zip.1
+++ man/zip.1
@@ -14,7 +14,7 @@
 zip, zipcloak, zipnote, zipsplit \- package and compress (archive) files
 .SH SYNOPSIS
 .B zip
-.RB [ \-aABcdDeEfFghjklLmoqrRSTuvVwXyz!@$ ]
+.RB [ \-aABcdDeEfFghjkKlLmoOqrRSTuvVwXyz!@$ ]
 .RB [ \-b\ path ]
 .RB [ \-n\ suffixes ]
 .RB [ \-t\ mmddyyyy ]
@@ -514,7 +514,15 @@
 store only the MSDOS attribute (just the user write attribute from UNIX),
 and mark the entry as made under MSDOS (even though it was not);
 for compatibility with PKUNZIP under MSDOS which cannot handle certain
-names such as those with two dots.
+names such as those with two dots. Conversion from ISO8859-1 to
+IBM PC CP 852 is used. See also 
+.B \-O
+.TP
+.B \-K
+Attempt to convert the names and paths to conform to MS Windows. Behaviour
+similar to 
+.B \-k
+but long names are used.
 .TP
 .B \-l
 Translate the Unix end-of-line character LF into the
@@ -628,6 +636,11 @@
 .I foo.zip
 to the latest time of the entries in
 .IR foo.zip .
+.TP
+.B \-O
+File names will be converted from ISO8859-2 instead of from ISO8859-1. See 
+.B \-k
+for details.
 .TP
 .IP \fB\-P\fP\ \fIpassword\fP
 use \fIpassword\fP to encrypt zipfile entries (if any).  \fBTHIS IS
--- unix/unix.c
+++ unix/unix.c
@@ -246,8 +246,13 @@
 
   if (isdir == 42) return n;    /* avoid warning on unused variable */
 
-  if (dosify)
+  if ((dosify) && (!winify))
     msname(n);
+
+#ifdef IZ_ISO2OEM_ARRAY
+  if (dosify)
+    str_iso_to_oem(n, n);
+#endif
 
 #ifdef EBCDIC
   strtoasc(n, n);               /* here because msname() needs native coding */
--- util.c
+++ util.c
@@ -383,7 +383,10 @@
   char *dst;
 {
   char *dest_start = dst;
-  while (*dst++ = (char)iso2oem[(uch)(*src++)]);
+  if (!iso8859_2)
+    while (*src) { *dst++ = (*src & 0x80) ? iso2oem[*src++ & 0x7f] : *src++; }
+  else    
+    while (*src) { *dst++ = (*src & 0x80) ? iso2oem_2[*src++ & 0x7f] : *src++; }
   return dest_start;
 }
 #endif
@@ -394,7 +397,10 @@
   char *dst;
 {
   char *dest_start = dst;
-  while (*dst++ = (char)oem2iso[(uch)(*src++)]);
+  if (!iso8859_2)
+    while (*src) { *dst++ = (*src & 0x80) ? oem2iso[*src++ & 0x7f] : *src++; }
+  else
+    while (*src) { *dst++ = (*src & 0x80) ? oem2iso_2[*src++ & 0x7f] : *src++; }
   return dest_start;
 }
 #endif
--- zip.c
+++ zip.c
@@ -933,6 +933,8 @@
   dispose = 0;         /* 1=remove files after put in zip file */
   pathput = 1;         /* 1=store path with name */
   method = BEST;       /* one of BEST, DEFLATE (only), or STORE (only) */
+  winify = 0;          /* 1=file names will be converted from IBM PC CP 850 to ISO8859-1 */
+  iso8859_2 = 0;       /* 1=ISO8859-2 will be used instead of ISO8859-1 */
   dosify = 0;          /* 1=make new entries look like MSDOS */
   verbose = 0;         /* 1=report oddities in zip file structure */
   fix = 0;             /* 1=fix the zip file */
@@ -1190,6 +1192,8 @@
               junk_sfx = 1;  break;
             case 'k':   /* Make entries using DOS names (k for Katz) */
               dosify = 1;  break;
+            case 'K':   /* file names will be converted from IBM PC CP 850 to ISO8859-1 */
+              winify = dosify = 1;  break;
             case 'l':   /* Translate end-of-line */
               translate_eol++; break;
 #ifndef WINDLL
@@ -1208,6 +1212,8 @@
 #endif
             case 'o':   /* Set zip file time to time of latest file in it */
               latest = 1;  break;
+            case 'O':   /* ISO8859-2 will be used instead of ISO8859-1 */
+              iso8859_2 = 1;  break;
             case 'p':   /* Store path with name */
               break;            /* (do nothing as annoyance avoidance) */
             case 'P':   /* password for encryption */
--- zip.h
+++ zip.h
@@ -236,9 +236,11 @@
 #endif /* EBCDIC */
 #ifdef IZ_ISO2OEM_ARRAY         /* ISO 8859-1 (Win CP 1252) --> OEM CP 850 */
 extern ZCONST uch Far iso2oem[128];
+extern ZCONST uch Far iso2oem_2[128];
 #endif
 #ifdef IZ_OEM2ISO_ARRAY         /* OEM CP 850 --> ISO 8859-1 (Win CP 1252) */
 extern ZCONST uch Far oem2iso[128];
+extern ZCONST uch Far oem2iso_2[128];
 #endif
 extern char errbuf[FNMAX+81];   /* Handy place to build error messages */
 extern int recurse;             /* Recurse into directories encountered */
@@ -254,6 +256,8 @@
 #define DEFLATE 8               /* Deflation method*/
 extern int method;              /* Restriction on compression method */
 
+extern int winify;              /* file names will be converted from IBM PC CP 850 to ISO8859-1 */
+extern int iso8859_2;		/* ISO8859-2 will be used instead of ISO8859-1 */
 extern int dosify;              /* Make new entries look like MSDOS */
 extern char *special;           /* Don't compress special suffixes */
 extern int verbose;             /* Report oddities in zip file structure */
--- unix/Makefile
+++ unix/Makefile
@@ -46,7 +46,7 @@ VERSION = Version 2.32
 #   CFLAGS    flags for C compile
 #   LFLAGS1   flags after output file spec, before obj file list
 #   LFLAGS2   flags after obj file list (libraries, etc)
-CFLAGS_NOOPT = -I. -DUNIX $(LOCAL_ZIP)
+CFLAGS_NOOPT = -I. -DUNIX -DIZ_ISO2OEM_ARRAY $(LOCAL_ZIP)
 CFLAGS = -O2 $(CFLAGS_NOOPT)
 LFLAGS1 =
 LFLAGS2 = -s
openSUSE Build Service is sponsored by