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