components/unzip/patches/6719511-i18.patch
author Jiri Sasek <jurasek@opensolaris.org>
Wed, 20 Apr 2011 01:53:37 +0200
changeset 188 64b262c9d53f
permissions -rw-r--r--
7036934 Move unzip to userland. 6862438 Incorporate unzip 6.0 into Solaris 10, for 256k encryption 7008244 zipinfo -h failed to report the total number of files when zip file contain more than 65535 files
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
188
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
     1
diff -ur unzip60-orig/fileio.c unzip60/fileio.c
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
     2
--- unzip60-orig/fileio.c	2009-04-20 02:03:44.000000000 +0200
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
     3
+++ unzip60/fileio.c	2011-02-25 11:57:38.242056429 +0100
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
     4
@@ -2126,9 +2126,16 @@
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
     5
                 /* translate the text coded in the entry's host-dependent
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
     6
                    "extended ASCII" charset into the compiler's (system's)
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
     7
                    internal text code page */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
     8
+#ifdef UNIX
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
     9
+                Ext_ASCII_TO_Native((char *)G.outbuf, G.pInfo->hostnum,
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    10
+                                    G.pInfo->hostver, G.pInfo->HasUxAtt,
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    11
+                                    FALSE, OUTBUFSIZ);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    12
+#else /* !UNIX */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    13
                 Ext_ASCII_TO_Native((char *)G.outbuf, G.pInfo->hostnum,
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    14
                                     G.pInfo->hostver, G.pInfo->HasUxAtt,
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    15
                                     FALSE);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    16
+#endif /* UNIX */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    17
+
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    18
 #ifdef WINDLL
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    19
                 /* translate to ANSI (RTL internal codepage may be OEM) */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    20
                 INTERN_TO_ISO((char *)G.outbuf, (char *)G.outbuf);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    21
@@ -2240,8 +2247,13 @@
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    22
 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    23
         /* translate the Zip entry filename coded in host-dependent "extended
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    24
            ASCII" into the compiler's (system's) internal text code page */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    25
+#ifdef UNIX
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    26
+        Ext_ASCII_TO_Native(G.filename, G.pInfo->hostnum, G.pInfo->hostver,
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    27
+                            G.pInfo->HasUxAtt, (option == DS_FN_L), FILNAMSIZ);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    28
+#else /* !UNIX */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    29
         Ext_ASCII_TO_Native(G.filename, G.pInfo->hostnum, G.pInfo->hostver,
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    30
                             G.pInfo->HasUxAtt, (option == DS_FN_L));
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    31
+#endif /* UNIX */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    32
 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    33
         if (G.pInfo->lcflag)      /* replace with lowercase filename */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    34
             STRLOWER(G.filename, G.filename);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    35
Only in unzip60: fileio.c.orig
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    36
diff -ur unzip60-orig/unix/unix.c unzip60/unix/unix.c
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    37
--- unzip60-orig/unix/unix.c	2009-01-24 00:31:26.000000000 +0100
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    38
+++ unzip60/unix/unix.c	2011-02-25 11:57:38.259028876 +0100
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    39
@@ -30,6 +30,10 @@
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    40
 #define UNZIP_INTERNAL
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    41
 #include "unzip.h"
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    42
 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    43
+#include <iconv.h>
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    44
+#include <langinfo.h>
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    45
+#include <strings.h>
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    46
+
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    47
 #ifdef SCO_XENIX
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    48
 #  define SYSNDIR
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    49
 #else  /* SCO Unix, AIX, DNIX, TI SysV, Coherent 4.x, ... */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    50
@@ -1874,3 +1878,128 @@
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    51
     }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    52
 }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    53
 #endif /* QLZIP */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    54
+
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    55
+
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    56
+typedef struct {
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    57
+    char *local_charset;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    58
+    char *archive_charset;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    59
+} CHARSET_MAP;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    60
+
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    61
+/* A mapping of local <-> archive charsets used by default to convert filenames
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    62
+ * of DOS/Windows Zip archives. Currently very basic. */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    63
+const static CHARSET_MAP dos_charset_map[] = {
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    64
+    { "ANSI_X3.4-1968", "CP850" },
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    65
+    { "ISO-8859-1", "CP850" },
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    66
+    { "CP1252", "CP850" },
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    67
+    { "KOI8-R", "CP866" },
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    68
+    { "KOI8-U", "CP866" },
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    69
+    { "ISO-8859-5", "CP866" }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    70
+};
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    71
+
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    72
+typedef struct {
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    73
+    char *locale;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    74
+    char *archive_charset;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    75
+} UTF8_CHARSET_MAP;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    76
+
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    77
+/* In case local charset is UTF-8, lookup archive_charset
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    78
+   by locale.  Currently very basic. */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    79
+#define	UTF8_CHARSET_MAP_DEFAULT	"CP866"
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    80
+const static UTF8_CHARSET_MAP utf8_charset_map[] = {
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    81
+    { "ja_JP", "CP932" },
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    82
+    { "zh_CN", "GBK" },
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    83
+    { "zh_TW", "BIG5" },
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    84
+    { "ko_KR", "CP949" },
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    85
+};
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    86
+
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    87
+char OEM_CP[MAX_CP_NAME] = "";
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    88
+char ISO_CP[MAX_CP_NAME] = "";
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    89
+
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    90
+/* Try to guess the default value of OEM_CP based on the current locale.
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    91
+ * ISO_CP is left alone for now. */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    92
+void init_conversion_charsets(const char *loc)
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    93
+{
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    94
+    const char *local_charset;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    95
+    int i;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    96
+
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    97
+    /* Make a guess only if OEM_CP not already set. */ 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    98
+    if(*OEM_CP == '\0')
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
    99
+    {
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   100
+	local_charset = nl_langinfo(CODESET);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   101
+	if (!strcasecmp(local_charset, "UTF-8") || !strcasecmp(local_charset,
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   102
+"UTF8") )
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   103
+	{
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   104
+	    strcpy(OEM_CP, UTF8_CHARSET_MAP_DEFAULT);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   105
+	    for(i = 0; i < sizeof(utf8_charset_map)/sizeof(UTF8_CHARSET_MAP);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   106
+		i++)
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   107
+	    {
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   108
+		if (!strncmp(loc, utf8_charset_map[i].locale, 5))
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   109
+		{
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   110
+		    strncpy(OEM_CP, utf8_charset_map[i].archive_charset,
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   111
+			sizeof(OEM_CP) - 1);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   112
+		    OEM_CP[sizeof(OEM_CP) - 1] = '\0';
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   113
+		    break;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   114
+		}
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   115
+	    }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   116
+	}
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   117
+	else
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   118
+	{
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   119
+	    for(i = 0; i < sizeof(dos_charset_map)/sizeof(CHARSET_MAP); i++)
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   120
+            {
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   121
+		if (!strcasecmp(local_charset, 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   122
+		    dos_charset_map[i].local_charset))
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   123
+		{
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   124
+		    strncpy(OEM_CP, dos_charset_map[i].archive_charset,
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   125
+			sizeof(OEM_CP) - 1);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   126
+		    OEM_CP[sizeof(OEM_CP) - 1] = '\0';
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   127
+		    break;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   128
+		}
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   129
+	    }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   130
+	}
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   131
+    }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   132
+}
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   133
+
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   134
+/* Convert a string from one encoding to the current locale using iconv().
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   135
+ * Be as non-intrusive as possible. If error is encountered during covertion
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   136
+ * just leave the string intact. */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   137
+static void charset_to_intern(char *string, size_t sbuflen, char *from_charset)
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   138
+{
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   139
+    iconv_t cd;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   140
+    char *s,*d, *buf;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   141
+    size_t slen, dlen;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   142
+    const char *local_charset;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   143
+
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   144
+    if(*from_charset == '\0')
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   145
+    	return;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   146
+
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   147
+    local_charset = nl_langinfo(CODESET);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   148
+
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   149
+    if((cd = iconv_open(local_charset, from_charset)) == (iconv_t)-1)
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   150
+        return;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   151
+
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   152
+    slen = strlen(string);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   153
+    s = string;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   154
+    dlen = sbuflen - 1;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   155
+    d = buf = malloc(sbuflen);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   156
+    if(!d)
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   157
+    	goto cleanup;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   158
+    if(iconv(cd, (const char **)&s, &slen, &d, &dlen) != (size_t)-1) {
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   159
+	*d = '\0';
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   160
+	strcpy(string, buf);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   161
+    }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   162
+    
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   163
+    free(buf);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   164
+    cleanup:
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   165
+    iconv_close(cd);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   166
+}
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   167
+
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   168
+/* Convert a string from OEM_CP to the current locale charset. */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   169
+void oem_intern(char *string, size_t sbuflen)
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   170
+{
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   171
+    charset_to_intern(string, sbuflen, OEM_CP);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   172
+}
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   173
+
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   174
+/* Convert a string from ISO_CP to the current locale charset. */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   175
+void iso_intern(char *string, size_t sbuflen)
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   176
+{
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   177
+    charset_to_intern(string, sbuflen, ISO_CP);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   178
+}
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   179
Only in unzip60/unix: unix.c.orig
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   180
diff -ur unzip60-orig/unix/unxcfg.h unzip60/unix/unxcfg.h
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   181
--- unzip60-orig/unix/unxcfg.h	2009-04-16 20:36:12.000000000 +0200
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   182
+++ unzip60/unix/unxcfg.h	2011-02-25 11:57:38.262941301 +0100
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   183
@@ -52,6 +52,7 @@
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   184
 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   185
 #include <sys/types.h>          /* off_t, time_t, dev_t, ... */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   186
 #include <sys/stat.h>
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   187
+#include <unistd.h>
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   188
 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   189
 #ifdef NO_OFF_T
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   190
   typedef long zoff_t;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   191
@@ -227,4 +228,30 @@
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   192
 /* wild_dir, dirname, wildname, matchname[], dirnamelen, have_dirname, */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   193
 /*    and notfirstcall are used by do_wild().                          */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   194
 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   195
+
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   196
+#define MAX_CP_NAME 25 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   197
+   
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   198
+#ifdef SETLOCALE
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   199
+#  undef SETLOCALE
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   200
+#endif
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   201
+#define SETLOCALE(category, locale) setlocale(category, locale)
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   202
+#include <locale.h>
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   203
+   
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   204
+#ifdef _ISO_INTERN
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   205
+#  undef _ISO_INTERN
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   206
+#endif
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   207
+#define _ISO_INTERN(str1, ssize) iso_intern(str1, ssize)
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   208
+
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   209
+#ifdef _OEM_INTERN
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   210
+#  undef _OEM_INTERN
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   211
+#endif
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   212
+#ifndef IZ_OEM2ISO_ARRAY
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   213
+#  define IZ_OEM2ISO_ARRAY
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   214
+#endif
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   215
+#define _OEM_INTERN(str1, ssize) oem_intern(str1, ssize)
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   216
+
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   217
+void iso_intern(char *, size_t);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   218
+void oem_intern(char *, size_t);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   219
+void init_conversion_charsets(const char *);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   220
+   
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   221
 #endif /* !__unxcfg_h */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   222
Only in unzip60/unix: unxcfg.h.orig
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   223
diff -ur unzip60-orig/unzip.c unzip60/unzip.c
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   224
--- unzip60-orig/unzip.c	2009-04-16 20:26:52.000000000 +0200
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   225
+++ unzip60/unzip.c	2011-02-26 00:03:41.011389301 +0100
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   226
@@ -327,11 +327,21 @@
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   227
   -2  just filenames but allow -h/-t/-z  -l  long Unix \"ls -l\" format\n\
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   228
                                          -v  verbose, multi-page format\n";
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   229
 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   230
+#ifdef UNIX
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   231
+static ZCONST char Far ZipInfoUsageLine3[] = "miscellaneous options:\n\
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   232
+  -h  print header line       -t  print totals for listed files or for all\n\
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   233
+  -z  print zipfile comment   -T  print file times in sortable decimal format\
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   234
+\n  -C  be case-insensitive   %s\
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   235
+  -x  exclude filenames that follow from listing\n\
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   236
+  -O CHARSET  specify a character encoding for DOS, Windows and OS/2 archives\n\
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   237
+  -I CHARSET  specify a character encoding for UNIX and other archives\n";
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   238
+#else /* !UNIX */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   239
 static ZCONST char Far ZipInfoUsageLine3[] = "miscellaneous options:\n\
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   240
   -h  print header line       -t  print totals for listed files or for all\n\
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   241
   -z  print zipfile comment   -T  print file times in sortable decimal format\
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   242
 \n  -C  be case-insensitive   %s\
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   243
   -x  exclude filenames that follow from listing\n";
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   244
+#endif /* UNIX */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   245
 #ifdef MORE
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   246
    static ZCONST char Far ZipInfoUsageLine4[] =
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   247
      "  -M  page output through built-in \"more\"\n";
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   248
@@ -666,6 +676,18 @@
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   249
   -C  match filenames case-insensitively     -L  make (some) names \
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   250
 lowercase\n %-42s  -V  retain VMS version numbers\n%s";
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   251
 #else /* !VMS */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   252
+#ifdef UNIX
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   253
+static ZCONST char Far UnzipUsageLine4[] = "\
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   254
+modifiers:\n\
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   255
+  -n  never overwrite existing files         -q  quiet mode (-qq => quieter)\n\
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   256
+  -o  overwrite files WITHOUT prompting      -a  auto-convert any text files\n\
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   257
+  -j  junk paths (do not make directories)   -aa treat ALL files as text\n\
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   258
+  -U  use escapes for all non-ASCII Unicode  -UU ignore any Unicode fields\n\
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   259
+  -C  match filenames case-insensitively     -L  make (some) names \
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   260
+lowercase\n %-42s  -V  retain VMS version numbers\n%s\n\
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   261
+  -O CHARSET  specify a character encoding for DOS, Windows and OS/2 archives\n\
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   262
+  -I CHARSET  specify a character encoding for UNIX and other archives\n\n";
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   263
+#else /* !UNIX */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   264
 static ZCONST char Far UnzipUsageLine4[] = "\
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   265
 modifiers:\n\
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   266
   -n  never overwrite existing files         -q  quiet mode (-qq => quieter)\n\
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   267
@@ -674,6 +696,7 @@
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   268
   -U  use escapes for all non-ASCII Unicode  -UU ignore any Unicode fields\n\
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   269
   -C  match filenames case-insensitively     -L  make (some) names \
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   270
 lowercase\n %-42s  -V  retain VMS version numbers\n%s";
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   271
+#endif /* UNIX */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   272
 #endif /* ?VMS */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   273
 #else /* !UNICODE_SUPPORT */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   274
 #ifdef VMS
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   275
@@ -742,6 +765,9 @@
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   276
     int i;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   277
 #endif
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   278
     int retcode, error=FALSE;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   279
+#ifdef UNIX
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   280
+    const char *loc;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   281
+#endif
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   282
 #ifndef NO_EXCEPT_SIGNALS
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   283
 #ifdef REENTRANT
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   284
     savsigs_info *oldsighandlers = NULL;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   285
@@ -756,7 +782,12 @@
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   286
 #endif /* NO_EXCEPT_SIGNALS */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   287
 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   288
     /* initialize international char support to the current environment */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   289
+#ifdef UNIX
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   290
+    loc = SETLOCALE(LC_CTYPE,"");
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   291
+    init_conversion_charsets(loc);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   292
+#else /* !UNIX */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   293
     SETLOCALE(LC_CTYPE, "");
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   294
+#endif /* UNIX */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   295
 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   296
 #ifdef UNICODE_SUPPORT
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   297
     /* see if can use UTF-8 Unicode locale */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   298
@@ -1336,6 +1367,11 @@
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   299
     argc = *pargc;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   300
     argv = *pargv;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   301
 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   302
+#ifdef UNIX
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   303
+    extern char OEM_CP[MAX_CP_NAME];
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   304
+    extern char ISO_CP[MAX_CP_NAME];
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   305
+#endif
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   306
+    
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   307
     while (++argv, (--argc > 0 && *argv != NULL && **argv == '-')) {
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   308
         s = *argv + 1;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   309
         while ((c = *s++) != 0) {    /* "!= 0":  prevent Turbo C warning */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   310
@@ -1517,6 +1553,37 @@
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   311
                     }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   312
                     break;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   313
 #endif  /* MACOS */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   314
+#ifdef UNIX
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   315
+                case ('I'):
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   316
+                    if (negative) {
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   317
+                        Info(slide, 0x401, ((char *)slide,
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   318
+                          "error:  encodings can't be negated"));
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   319
+                        return(PK_PARAM);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   320
+                    } else {
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   321
+                        if(*s) { /* Handle the -Icharset case */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   322
+                            /* Assume that charsets can't start with a dash to spot arguments misuse */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   323
+                            if(*s == '-') { 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   324
+                                Info(slide, 0x401, ((char *)slide,
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   325
+                                  "error:  a valid character encoding should follow the -I argument"));
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   326
+                                return(PK_PARAM); 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   327
+                            }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   328
+                            strncpy(ISO_CP, s, sizeof(ISO_CP) - 1);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   329
+                            ISO_CP[sizeof(ISO_CP) - 1] = '\0';
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   330
+                        } else { /* -I charset */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   331
+                            ++argv;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   332
+                            if(!(--argc > 0 && *argv != NULL && **argv != '-')) {
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   333
+                                Info(slide, 0x401, ((char *)slide,
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   334
+                                  "error:  a valid character encoding should follow the -I argument"));
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   335
+                                return(PK_PARAM); 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   336
+                            }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   337
+                            s = *argv;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   338
+                            strncpy(ISO_CP, s, sizeof(ISO_CP) - 1);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   339
+                            ISO_CP[sizeof(ISO_CP) - 1] = '\0';
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   340
+                        }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   341
+                        while(*(++s)); /* No params straight after charset name */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   342
+                    }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   343
+                    break;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   344
+#endif /* ?UNIX */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   345
                 case ('j'):    /* junk pathnames/directory structure */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   346
                     if (negative)
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   347
                         uO.jflag = FALSE, negative = 0;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   348
@@ -1592,6 +1659,37 @@
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   349
                     } else
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   350
                         ++uO.overwrite_all;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   351
                     break;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   352
+#ifdef UNIX
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   353
+                case ('O'):
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   354
+                    if (negative) {
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   355
+                        Info(slide, 0x401, ((char *)slide,
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   356
+                          "error:  encodings can't be negated"));
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   357
+                        return(PK_PARAM);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   358
+                    } else {
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   359
+                        if(*s) { /* Handle the -Ocharset case */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   360
+                            /* Assume that charsets can't start with a dash to spot arguments misuse */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   361
+                            if(*s == '-') { 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   362
+                                Info(slide, 0x401, ((char *)slide,
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   363
+                                  "error:  a valid character encoding should follow the -I argument"));
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   364
+                                return(PK_PARAM); 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   365
+                            }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   366
+                            strncpy(OEM_CP, s, sizeof(OEM_CP) - 1);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   367
+                            OEM_CP[sizeof(OEM_CP) - 1] = '\0';
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   368
+                        } else { /* -O charset */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   369
+                            ++argv;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   370
+                            if(!(--argc > 0 && *argv != NULL && **argv != '-')) {
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   371
+                                Info(slide, 0x401, ((char *)slide,
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   372
+                                  "error:  a valid character encoding should follow the -O argument"));
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   373
+                                return(PK_PARAM); 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   374
+                            }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   375
+                            s = *argv;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   376
+                            strncpy(OEM_CP, s, sizeof(OEM_CP) - 1);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   377
+                            OEM_CP[sizeof(OEM_CP) - 1] = '\0';
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   378
+                        }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   379
+                        while(*(++s)); /* No params straight after charset name */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   380
+                    }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   381
+                    break;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   382
+#endif /* ?UNIX */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   383
                 case ('p'):    /* pipes:  extract to stdout, no messages */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   384
                     if (negative) {
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   385
                         uO.cflag = FALSE;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   386
Only in unzip60: unzip.c.orig
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   387
diff -ur unzip60-orig/unzpriv.h unzip60/unzpriv.h
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   388
--- unzip60-orig/unzpriv.h	2009-04-20 01:59:26.000000000 +0200
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   389
+++ unzip60/unzpriv.h	2011-02-25 11:57:38.275212165 +0100
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   390
@@ -3003,6 +3003,18 @@
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   391
  * All other ports are assumed to code zip entry filenames in ISO 8859-1.
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   392
  */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   393
 #ifndef Ext_ASCII_TO_Native
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   394
+#ifdef UNIX
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   395
+#  define Ext_ASCII_TO_Native(string, hostnum, hostver, isuxatt, islochdr, ssize) \
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   396
+    if (((hostnum) == FS_FAT_ && \
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   397
+         !(((islochdr) || (isuxatt)) && \
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   398
+           ((hostver) == 25 || (hostver) == 26 || (hostver) == 40))) || \
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   399
+        (hostnum) == FS_HPFS_ || \
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   400
+        ((hostnum) == FS_NTFS_/* && (hostver) == 50*/)) { \
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   401
+        _OEM_INTERN((string), (ssize)); \
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   402
+    } else { \
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   403
+        _ISO_INTERN((string), (ssize)); \
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   404
+    }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   405
+#else /* !UNIX */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   406
 #  define Ext_ASCII_TO_Native(string, hostnum, hostver, isuxatt, islochdr) \
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   407
     if (((hostnum) == FS_FAT_ && \
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   408
          !(((islochdr) || (isuxatt)) && \
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   409
@@ -3013,10 +3025,10 @@
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   410
     } else { \
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   411
         _ISO_INTERN((string)); \
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   412
     }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   413
+#endif /* UNIX */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   414
 #endif
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   415
 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   416
 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   417
-
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   418
 /**********************/
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   419
 /*  Global constants  */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   420
 /**********************/
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   421
Only in unzip60: unzpriv.h.orig
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   422
diff -ur unzip60-orig/zipinfo.c unzip60/zipinfo.c
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   423
--- unzip60-orig/zipinfo.c	2009-02-08 18:04:30.000000000 +0100
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   424
+++ unzip60/zipinfo.c	2011-02-25 11:57:38.281586457 +0100
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   425
@@ -457,6 +457,10 @@
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   426
     int    tflag_slm=TRUE, tflag_2v=FALSE;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   427
     int    explicit_h=FALSE, explicit_t=FALSE;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   428
 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   429
+#ifdef UNIX
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   430
+    extern char OEM_CP[MAX_CP_NAME];
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   431
+    extern char ISO_CP[MAX_CP_NAME];
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   432
+#endif
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   433
 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   434
 #ifdef MACOS
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   435
     uO.lflag = LFLAG;         /* reset default on each call */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   436
@@ -501,6 +505,37 @@
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   437
                             uO.lflag = 0;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   438
                     }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   439
                     break;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   440
+#ifdef UNIX
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   441
+                case ('I'):
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   442
+                    if (negative) {
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   443
+                        Info(slide, 0x401, ((char *)slide,
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   444
+                          "error:  encodings can't be negated"));
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   445
+                        return(PK_PARAM);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   446
+                    } else {
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   447
+                        if(*s) { /* Handle the -Icharset case */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   448
+                            /* Assume that charsets can't start with a dash to spot arguments misuse */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   449
+                            if(*s == '-') { 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   450
+                                Info(slide, 0x401, ((char *)slide,
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   451
+                                  "error:  a valid character encoding should follow the -I argument"));
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   452
+                                return(PK_PARAM); 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   453
+                            }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   454
+                            strncpy(ISO_CP, s, sizeof(ISO_CP) - 1);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   455
+                            ISO_CP[sizeof(ISO_CP) - 1] = '\0';
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   456
+                        } else { /* -I charset */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   457
+                            ++argv;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   458
+                            if(!(--argc > 0 && *argv != NULL && **argv != '-')) {
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   459
+                                Info(slide, 0x401, ((char *)slide,
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   460
+                                  "error:  a valid character encoding should follow the -I argument"));
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   461
+                                return(PK_PARAM); 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   462
+                            }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   463
+                            s = *argv;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   464
+                            strncpy(ISO_CP, s, sizeof(ISO_CP) - 1);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   465
+                            ISO_CP[sizeof(ISO_CP) - 1] = '\0';
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   466
+                        }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   467
+                        while(*(++s)); /* No params straight after charset name */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   468
+                    }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   469
+                    break;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   470
+#endif /* ?UNIX */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   471
                 case 'l':      /* longer form of "ls -l" type listing */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   472
                     if (negative)
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   473
                         uO.lflag = -2, negative = 0;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   474
@@ -521,6 +556,37 @@
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   475
                         G.M_flag = TRUE;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   476
                     break;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   477
 #endif
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   478
+#ifdef UNIX
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   479
+                case ('O'):
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   480
+                    if (negative) {
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   481
+                        Info(slide, 0x401, ((char *)slide,
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   482
+                          "error:  encodings can't be negated"));
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   483
+                        return(PK_PARAM);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   484
+                    } else {
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   485
+                        if(*s) { /* Handle the -Ocharset case */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   486
+                            /* Assume that charsets can't start with a dash to spot arguments misuse */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   487
+                            if(*s == '-') { 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   488
+                                Info(slide, 0x401, ((char *)slide,
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   489
+                                  "error:  a valid character encoding should follow the -I argument"));
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   490
+                                return(PK_PARAM); 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   491
+                            }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   492
+                            strncpy(OEM_CP, s, sizeof(OEM_CP) - 1);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   493
+                            OEM_CP[sizeof(OEM_CP) - 1] = '\0';
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   494
+                        } else { /* -O charset */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   495
+                            ++argv;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   496
+                            if(!(--argc > 0 && *argv != NULL && **argv != '-')) {
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   497
+                                Info(slide, 0x401, ((char *)slide,
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   498
+                                  "error:  a valid character encoding should follow the -O argument"));
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   499
+                                return(PK_PARAM); 
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   500
+                            }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   501
+                            s = *argv;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   502
+                            strncpy(OEM_CP, s, sizeof(OEM_CP) - 1);
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   503
+                            OEM_CP[sizeof(OEM_CP) - 1] = '\0';
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   504
+                        }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   505
+                        while(*(++s)); /* No params straight after charset name */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   506
+                    }
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   507
+                    break;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   508
+#endif /* ?UNIX */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   509
                 case 's':      /* default:  shorter "ls -l" type listing */
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   510
                     if (negative)
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   511
                         uO.lflag = -2, negative = 0;
64b262c9d53f 7036934 Move unzip to userland.
Jiri Sasek <jurasek@opensolaris.org>
parents:
diff changeset
   512
Only in unzip60: zipinfo.c.orig