Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 275244 | Differences between
and this patch

Collapse All | Expand All

(-)unzip-5.52-orig/unix/Makefile (-1 / +1 lines)
Lines 52-58 Link Here
52
CF = $(CFLAGS) $(CF_NOOPT)
52
CF = $(CFLAGS) $(CF_NOOPT)
53
LFLAGS1 =
53
LFLAGS1 =
54
LF = -o unzip$E $(LFLAGS1)
54
LF = -o unzip$E $(LFLAGS1)
55
LF2 = -s
55
LF2 = -l natspec
56
# UnZipSFX flags
56
# UnZipSFX flags
57
SL = -o unzipsfx$E $(LFLAGS1)
57
SL = -o unzipsfx$E $(LFLAGS1)
(-)unzip-5.52-orig/unix/unix.c (+44 lines)
Lines 30-35 Link Here
30
#define UNZIP_INTERNAL
30
#define UNZIP_INTERNAL
31
#include "unzip.h"
31
#include "unzip.h"
32
32
33
#include <iconv.h>
34
#include <natspec.h>
35
33
#ifdef SCO_XENIX
36
#ifdef SCO_XENIX
34
#  define SYSNDIR
37
#  define SYSNDIR
35
#else  /* SCO Unix, AIX, DNIX, TI SysV, Coherent 4.x, ... */
38
#else  /* SCO Unix, AIX, DNIX, TI SysV, Coherent 4.x, ... */
Lines 1666-1668 static void qlfix(__G__ ef_ptr, ef_len) Link Here
1666
    }
1669
    }
1667
}
1670
}
1668
#endif /* QLZIP */
1671
#endif /* QLZIP */
1672
1673
1674
char OEM_CP[MAX_CP_NAME] = "";
1675
char ISO_CP[MAX_CP_NAME] = "";
1676
1677
/* Getr the default value of OEM_CP based on the current locale.
1678
 * ISO_CP is left alone for now. */
1679
void init_conversion_charsets()
1680
{
1681
    /* Make a guess only if OEM_CP not already set. */ 
1682
    if(*OEM_CP == '\0') {
1683
        const char * archive_charset = natspec_get_charset_by_locale(NATSPEC_DOSCS, "");
1684
        strncpy(OEM_CP, archive_charset, sizeof(OEM_CP));
1685
    }
1686
1687
    if(*ISO_CP == '\0') {
1688
        const char * archive_charset = natspec_get_charset_by_locale(NATSPEC_WINCS, "");
1689
        strncpy(ISO_CP, archive_charset, sizeof(ISO_CP));
1690
    }
1691
1692
}
1693
1694
/* Convert a string from OEM_CP to the current locale charset. */
1695
inline void oem_intern(char *string)
1696
{
1697
    char *buf = natspec_convert(string, 0, OEM_CP, 0);
1698
	/* Since Ext_ASCII_TO_Native used only for G.filename[FILNAMESIZE],
1699
	   use FILNAMSIZ as string size */
1700
    strncpy(string, buf, FILNAMSIZ);
1701
	free (buf);
1702
}
1703
1704
/* Convert a string from ISO_CP to the current locale charset. */
1705
inline void iso_intern(char *string)
1706
{
1707
    char *buf = natspec_convert(string, 0, ISO_CP, 0);
1708
	/* Since Ext_ASCII_TO_Native used only for G.filename[FILNAMESIZE],
1709
	   use FILNAMSIZ as string size */
1710
    strncpy(string, buf, FILNAMSIZ);
1711
	free (buf);
1712
}
(-)unzip-5.52-orig/unix/unxcfg.h (+26 lines)
Lines 141-144 Link Here
141
/* wild_dir, dirname, wildname, matchname[], dirnamelen, have_dirname, */
141
/* wild_dir, dirname, wildname, matchname[], dirnamelen, have_dirname, */
142
/*    and notfirstcall are used by do_wild().                          */
142
/*    and notfirstcall are used by do_wild().                          */
143
143
144
145
#define MAX_CP_NAME 25 
146
   
147
#ifdef SETLOCALE
148
#  undef SETLOCALE
149
#endif
150
#define SETLOCALE(category, locale) setlocale(category, locale)
151
#include <locale.h>
152
   
153
#ifdef _ISO_INTERN
154
#  undef _ISO_INTERN
155
#endif
156
#define _ISO_INTERN(str1) iso_intern(str1)
157
158
#ifdef _OEM_INTERN
159
#  undef _OEM_INTERN
160
#endif
161
#ifndef IZ_OEM2ISO_ARRAY
162
#  define IZ_OEM2ISO_ARRAY
163
#endif
164
#define _OEM_INTERN(str1) oem_intern(str1)
165
166
void iso_intern(char *);
167
void oem_intern(char *);
168
void init_conversion_charsets(void);
169
   
144
#endif /* !__unxcfg_h */
170
#endif /* !__unxcfg_h */
(-)unzip-5.52-orig/unzip.c (-5 / +77 lines)
Lines 331-337 Link Here
331
  -h  print header line       -t  print totals for listed files or for all\n\
331
  -h  print header line       -t  print totals for listed files or for all\n\
332
  -z  print zipfile comment   -T  print file times in sortable decimal format\
332
  -z  print zipfile comment   -T  print file times in sortable decimal format\
333
\n  -C  be case-insensitive   %s\
333
\n  -C  be case-insensitive   %s\
334
  -x  exclude filenames that follow from listing\n";
334
  -x  exclude filenames that follow from listing\n\
335
  -O CHARSET  specify a character encoding for DOS, Windows and OS/2 archives\n\
336
  -I CHARSET  specify a character encoding for UNIX and other archives\n";
335
#ifdef MORE
337
#ifdef MORE
336
   static ZCONST char Far ZipInfoUsageLine4[] =
338
   static ZCONST char Far ZipInfoUsageLine4[] =
337
     "  -M  page output through built-in \"more\"\n";
339
     "  -M  page output through built-in \"more\"\n";
Lines 570-577 Link Here
570
#else /* !VMS */
572
#else /* !VMS */
571
# ifdef COPYRIGHT_CLEAN
573
# ifdef COPYRIGHT_CLEAN
572
   static ZCONST char Far UnzipUsageLine1[] = "\
574
   static ZCONST char Far UnzipUsageLine1[] = "\
573
UnZip %d.%d%d%s of %s, by Info-ZIP.  Maintained by C. Spieler.  Send\n\
575
UnZip %d.%d%d%s of %s, by ALT Linux Team.  Original by Info-ZIP.\
574
bug reports using http://www.info-zip.org/zip-bug.html; see README for details.\
575
\n\n";
576
\n\n";
576
# else
577
# else
577
   static ZCONST char Far UnzipUsageLine1[] = "\
578
   static ZCONST char Far UnzipUsageLine1[] = "\
Lines 673-679 Link Here
673
  -j  junk paths (do not make directories)   -aa treat ALL files as text\n\
674
  -j  junk paths (do not make directories)   -aa treat ALL files as text\n\
674
  -U  use escapes for all non-ASCII Unicode  -UU ignore any Unicode fields\n\
675
  -U  use escapes for all non-ASCII Unicode  -UU ignore any Unicode fields\n\
675
  -C  match filenames case-insensitively     -L  make (some) names \
676
  -C  match filenames case-insensitively     -L  make (some) names \
676
lowercase\n %-42s  -V  retain VMS version numbers\n%s";
677
lowercase\n %-42s  -V  retain VMS version numbers\n%s\
678
  -O CHARSET  specify a character encoding for DOS, Windows and OS/2 archives\n\
679
  -I CHARSET  specify a character encoding for UNIX and other archives\n";
677
#endif /* ?VMS */
680
#endif /* ?VMS */
678
#else /* !UNICODE_SUPPORT */
681
#else /* !UNICODE_SUPPORT */
679
#ifdef VMS
682
#ifdef VMS
Lines 692-698 Link Here
692
  -o  overwrite files WITHOUT prompting      -a  auto-convert any text files\n\
695
  -o  overwrite files WITHOUT prompting      -a  auto-convert any text files\n\
693
  -j  junk paths (do not make directories)   -aa treat ALL files as text\n\
696
  -j  junk paths (do not make directories)   -aa treat ALL files as text\n\
694
  -C  match filenames case-insensitively     -L  make (some) names \
697
  -C  match filenames case-insensitively     -L  make (some) names \
695
lowercase\n %-42s  -V  retain VMS version numbers\n%s";
698
lowercase\n %-42s  -V  retain VMS version numbers\n%s\
699
  -O CHARSET  specify a character encoding for DOS, Windows and OS/2 archives\n\
700
  -I CHARSET  specify a character encoding for UNIX and other archives\n";
696
#endif /* ?VMS */
701
#endif /* ?VMS */
697
#endif /* ?UNICODE_SUPPORT */
702
#endif /* ?UNICODE_SUPPORT */
698
703
Lines 668-673 int unzip(__G__ argc, argv) Link Here
668
690
669
    SETLOCALE(LC_CTYPE,"");
691
    SETLOCALE(LC_CTYPE,"");
670
692
693
#ifdef UNIX
694
    init_conversion_charsets();
695
#endif
696
671
#if (defined(__IBMC__) && defined(__DEBUG_ALLOC__))
697
#if (defined(__IBMC__) && defined(__DEBUG_ALLOC__))
672
    extern void DebugMalloc(void);
698
    extern void DebugMalloc(void);
673
699
Lines 1089-1094 int uz_opts(__G__ pargc, pargv) Link Here
1089
    argc = *pargc;
1115
    argc = *pargc;
1090
    argv = *pargv;
1116
    argv = *pargv;
1091
1117
1118
#ifdef UNIX
1119
    extern char OEM_CP[MAX_CP_NAME];
1120
    extern char ISO_CP[MAX_CP_NAME];
1121
#endif
1122
    
1092
    while (++argv, (--argc > 0 && *argv != NULL && **argv == '-')) {
1123
    while (++argv, (--argc > 0 && *argv != NULL && **argv == '-')) {
1093
        s = *argv + 1;
1124
        s = *argv + 1;
1094
        while ((c = *s++) != 0) {    /* "!= 0":  prevent Turbo C warning */
1125
        while ((c = *s++) != 0) {    /* "!= 0":  prevent Turbo C warning */
Lines 1252-1257 int uz_opts(__G__ pargc, pargv) Link Here
1252
                    }
1283
                    }
1253
                    break;
1284
                    break;
1254
#endif  /* MACOS */
1285
#endif  /* MACOS */
1286
#ifdef UNIX
1287
    			case ('I'):
1288
                    if (negative) {
1289
                        Info(slide, 0x401, ((char *)slide,
1290
                          "error:  encodings can't be negated"));
1291
                        return(PK_PARAM);
1292
    				} else {
1293
    					if(*s) { /* Handle the -Icharset case */
1294
    						/* Assume that charsets can't start with a dash to spot arguments misuse */
1295
    						if(*s == '-') { 
1296
    	                        Info(slide, 0x401, ((char *)slide,
1297
        		                  "error:  a valid character encoding should follow the -I argument"));
1298
    	                        return(PK_PARAM); 
1299
    						}
1300
    						strncpy(ISO_CP, s, sizeof(ISO_CP));
1301
    					} else { /* -I charset */
1302
    						++argv;
1303
    						if(!(--argc > 0 && *argv != NULL && **argv != '-')) {
1304
    	                        Info(slide, 0x401, ((char *)slide,
1305
        		                  "error:  a valid character encoding should follow the -I argument"));
1306
    	                        return(PK_PARAM); 
1307
    						}
1308
    						s = *argv;
1309
    						strncpy(ISO_CP, s, sizeof(ISO_CP));
1310
    					}
1311
    					while(*(++s)); /* No params straight after charset name */
1312
    				}
1313
    				break;
1314
#endif /* ?UNIX */
1255
                case ('j'):    /* junk pathnames/directory structure */
1315
                case ('j'):    /* junk pathnames/directory structure */
1256
                    if (negative)
1316
                    if (negative)
1257
                        uO.jflag = FALSE, negative = 0;
1317
                        uO.jflag = FALSE, negative = 0;
Lines 1327-1332 int uz_opts(__G__ pargc, pargv) Link Here
1327
                    } else
1387
                    } else
1328
                        ++uO.overwrite_all;
1388
                        ++uO.overwrite_all;
1329
                    break;
1389
                    break;
1390
#ifdef UNIX
1391
    			case ('O'):
1392
                    if (negative) {
1393
                        Info(slide, 0x401, ((char *)slide,
1394
                          "error:  encodings can't be negated"));
1395
                        return(PK_PARAM);
1396
    				} else {
1397
    					if(*s) { /* Handle the -Ocharset case */
1398
    						/* Assume that charsets can't start with a dash to spot arguments misuse */
1399
    						if(*s == '-') { 
1400
    	                        Info(slide, 0x401, ((char *)slide,
1401
        		                  "error:  a valid character encoding should follow the -I argument"));
1402
    	                        return(PK_PARAM); 
1403
    						}
1404
    						strncpy(OEM_CP, s, sizeof(OEM_CP));
1405
    					} else { /* -O charset */
1406
    						++argv;
1407
    						if(!(--argc > 0 && *argv != NULL && **argv != '-')) {
1408
    	                        Info(slide, 0x401, ((char *)slide,
1409
        		                  "error:  a valid character encoding should follow the -O argument"));
1410
    	                        return(PK_PARAM); 
1411
    						}
1412
    						s = *argv;
1413
    						strncpy(OEM_CP, s, sizeof(OEM_CP));
1414
    					}
1415
    					while(*(++s)); /* No params straight after charset name */
1416
    				}
1417
    				break;
1418
#endif /* ?UNIX */
1330
                case ('p'):    /* pipes:  extract to stdout, no messages */
1419
                case ('p'):    /* pipes:  extract to stdout, no messages */
1331
                    if (negative) {
1420
                    if (negative) {
1332
                        uO.cflag = FALSE;
1421
                        uO.cflag = FALSE;
(-)unzip-5.52-orig/unzpriv.h (-1 / +1 lines)
Lines 2564-2570 char *GetLoadPath OF((__GPRO)); Link Here
2564
         !(((islochdr) || (isuxatt)) && \
2566
         !(((islochdr) || (isuxatt)) && \
2565
           ((hostver) == 25 || (hostver) == 26 || (hostver) == 40))) || \
2567
           ((hostver) == 25 || (hostver) == 26 || (hostver) == 40))) || \
2566
        (hostnum) == FS_HPFS_ || \
2568
        (hostnum) == FS_HPFS_ || \
2567
        ((hostnum) == FS_NTFS_ && (hostver) == 50)) { \
2569
        ((hostnum) == FS_NTFS_/* && (hostver) == 50*/)) { \
2568
        _OEM_INTERN((string)); \
2570
        _OEM_INTERN((string)); \
2569
    } else { \
2571
    } else { \
2570
        _ISO_INTERN((string)); \
2572
        _ISO_INTERN((string)); \
(-)unzip-5.52-orig/zipinfo.c (+62 lines)
Lines 447-452 int zi_opts(__G__ pargc, pargv) Link Here
447
    int    tflag_slm=TRUE, tflag_2v=FALSE;
447
    int    tflag_slm=TRUE, tflag_2v=FALSE;
448
    int    explicit_h=FALSE, explicit_t=FALSE;
448
    int    explicit_h=FALSE, explicit_t=FALSE;
449
449
450
#ifdef UNIX
451
    extern char OEM_CP[MAX_CP_NAME];
452
    extern char ISO_CP[MAX_CP_NAME];
453
#endif
450
454
451
#ifdef MACOS
455
#ifdef MACOS
452
    uO.lflag = LFLAG;         /* reset default on each call */
456
    uO.lflag = LFLAG;         /* reset default on each call */
Lines 491-496 int zi_opts(__G__ pargc, pargv) Link Here
491
                            uO.lflag = 0;
495
                            uO.lflag = 0;
492
                    }
496
                    }
493
                    break;
497
                    break;
498
#ifdef UNIX
499
    			case ('I'):
500
                    if (negative) {
501
                        Info(slide, 0x401, ((char *)slide,
502
                          "error:  encodings can't be negated"));
503
                        return(PK_PARAM);
504
    				} else {
505
    					if(*s) { /* Handle the -Icharset case */
506
    						/* Assume that charsets can't start with a dash to spot arguments misuse */
507
    						if(*s == '-') { 
508
    	                        Info(slide, 0x401, ((char *)slide,
509
        		                  "error:  a valid character encoding should follow the -I argument"));
510
    	                        return(PK_PARAM); 
511
    						}
512
    						strncpy(ISO_CP, s, sizeof(ISO_CP));
513
    					} else { /* -I charset */
514
    						++argv;
515
    						if(!(--argc > 0 && *argv != NULL && **argv != '-')) {
516
    	                        Info(slide, 0x401, ((char *)slide,
517
        		                  "error:  a valid character encoding should follow the -I argument"));
518
    	                        return(PK_PARAM); 
519
    						}
520
    						s = *argv;
521
    						strncpy(ISO_CP, s, sizeof(ISO_CP));
522
    					}
523
    					while(*(++s)); /* No params straight after charset name */
524
    				}
525
    				break;
526
#endif /* ?UNIX */
494
                case 'l':      /* longer form of "ls -l" type listing */
527
                case 'l':      /* longer form of "ls -l" type listing */
495
                    if (negative)
528
                    if (negative)
496
                        uO.lflag = -2, negative = 0;
529
                        uO.lflag = -2, negative = 0;
Lines 511-516 int zi_opts(__G__ pargc, pargv) Link Here
511
                        G.M_flag = TRUE;
544
                        G.M_flag = TRUE;
512
                    break;
545
                    break;
513
#endif
546
#endif
547
#ifdef UNIX
548
    			case ('O'):
549
                    if (negative) {
550
                        Info(slide, 0x401, ((char *)slide,
551
                          "error:  encodings can't be negated"));
552
                        return(PK_PARAM);
553
    				} else {
554
    					if(*s) { /* Handle the -Ocharset case */
555
    						/* Assume that charsets can't start with a dash to spot arguments misuse */
556
    						if(*s == '-') { 
557
    	                        Info(slide, 0x401, ((char *)slide,
558
        		                  "error:  a valid character encoding should follow the -I argument"));
559
    	                        return(PK_PARAM); 
560
    						}
561
    						strncpy(OEM_CP, s, sizeof(OEM_CP));
562
    					} else { /* -O charset */
563
    						++argv;
564
    						if(!(--argc > 0 && *argv != NULL && **argv != '-')) {
565
    	                        Info(slide, 0x401, ((char *)slide,
566
        		                  "error:  a valid character encoding should follow the -O argument"));
567
    	                        return(PK_PARAM); 
568
    						}
569
    						s = *argv;
570
    						strncpy(OEM_CP, s, sizeof(OEM_CP));
571
    					}
572
    					while(*(++s)); /* No params straight after charset name */
573
    				}
574
    				break;
575
#endif /* ?UNIX */
514
                case 's':      /* default:  shorter "ls -l" type listing */
576
                case 's':      /* default:  shorter "ls -l" type listing */
515
                    if (negative)
577
                    if (negative)
516
                        uO.lflag = -2, negative = 0;
578
                        uO.lflag = -2, negative = 0;

Return to bug 275244