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

(-)unzip60orig/unzip.c (-5 / +77 lines)
Lines 331-337 static ZCONST char Far ZipInfoUsageLine3 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 Send bug reports using //www.info-zip.or 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 modifiers:\n\ 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 modifiers:\n\ 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 803-808 int unzip(__G__ argc, argv) Link Here
803
#endif /* UNICODE_SUPPORT */
808
#endif /* UNICODE_SUPPORT */
804
809
805
810
811
#ifdef UNIX
812
    init_conversion_charsets();
813
#endif
814
806
#if (defined(__IBMC__) && defined(__DEBUG_ALLOC__))
815
#if (defined(__IBMC__) && defined(__DEBUG_ALLOC__))
807
    extern void DebugMalloc(void);
816
    extern void DebugMalloc(void);
808
817
Lines 1336-1341 int uz_opts(__G__ pargc, pargv) Link Here
1336
    argc = *pargc;
1345
    argc = *pargc;
1337
    argv = *pargv;
1346
    argv = *pargv;
1338
1347
1348
#ifdef UNIX
1349
    extern char OEM_CP[MAX_CP_NAME];
1350
    extern char ISO_CP[MAX_CP_NAME];
1351
#endif
1352
    
1339
    while (++argv, (--argc > 0 && *argv != NULL && **argv == '-')) {
1353
    while (++argv, (--argc > 0 && *argv != NULL && **argv == '-')) {
1340
        s = *argv + 1;
1354
        s = *argv + 1;
1341
        while ((c = *s++) != 0) {    /* "!= 0":  prevent Turbo C warning */
1355
        while ((c = *s++) != 0) {    /* "!= 0":  prevent Turbo C warning */
Lines 1517-1522 int uz_opts(__G__ pargc, pargv) Link Here
1517
                    }
1531
                    }
1518
                    break;
1532
                    break;
1519
#endif  /* MACOS */
1533
#endif  /* MACOS */
1534
#ifdef UNIX
1535
    			case ('I'):
1536
                    if (negative) {
1537
                        Info(slide, 0x401, ((char *)slide,
1538
                          "error:  encodings can't be negated"));
1539
                        return(PK_PARAM);
1540
    				} else {
1541
    					if(*s) { /* Handle the -Icharset case */
1542
    						/* Assume that charsets can't start with a dash to spot arguments misuse */
1543
    						if(*s == '-') { 
1544
    	                        Info(slide, 0x401, ((char *)slide,
1545
        		                  "error:  a valid character encoding should follow the -I argument"));
1546
    	                        return(PK_PARAM); 
1547
    						}
1548
    						strncpy(ISO_CP, s, sizeof(ISO_CP));
1549
    					} else { /* -I charset */
1550
    						++argv;
1551
    						if(!(--argc > 0 && *argv != NULL && **argv != '-')) {
1552
    	                        Info(slide, 0x401, ((char *)slide,
1553
        		                  "error:  a valid character encoding should follow the -I argument"));
1554
    	                        return(PK_PARAM); 
1555
    						}
1556
    						s = *argv;
1557
    						strncpy(ISO_CP, s, sizeof(ISO_CP));
1558
    					}
1559
    					while(*(++s)); /* No params straight after charset name */
1560
    				}
1561
    				break;
1562
#endif /* ?UNIX */
1520
                case ('j'):    /* junk pathnames/directory structure */
1563
                case ('j'):    /* junk pathnames/directory structure */
1521
                    if (negative)
1564
                    if (negative)
1522
                        uO.jflag = FALSE, negative = 0;
1565
                        uO.jflag = FALSE, negative = 0;
Lines 1592-1597 int uz_opts(__G__ pargc, pargv) Link Here
1592
                    } else
1635
                    } else
1593
                        ++uO.overwrite_all;
1636
                        ++uO.overwrite_all;
1594
                    break;
1637
                    break;
1638
#ifdef UNIX
1639
    			case ('O'):
1640
                    if (negative) {
1641
                        Info(slide, 0x401, ((char *)slide,
1642
                          "error:  encodings can't be negated"));
1643
                        return(PK_PARAM);
1644
    				} else {
1645
    					if(*s) { /* Handle the -Ocharset case */
1646
    						/* Assume that charsets can't start with a dash to spot arguments misuse */
1647
    						if(*s == '-') { 
1648
    	                        Info(slide, 0x401, ((char *)slide,
1649
        		                  "error:  a valid character encoding should follow the -I argument"));
1650
    	                        return(PK_PARAM); 
1651
    						}
1652
    						strncpy(OEM_CP, s, sizeof(OEM_CP));
1653
    					} else { /* -O charset */
1654
    						++argv;
1655
    						if(!(--argc > 0 && *argv != NULL && **argv != '-')) {
1656
    	                        Info(slide, 0x401, ((char *)slide,
1657
        		                  "error:  a valid character encoding should follow the -O argument"));
1658
    	                        return(PK_PARAM); 
1659
    						}
1660
    						s = *argv;
1661
    						strncpy(OEM_CP, s, sizeof(OEM_CP));
1662
    					}
1663
    					while(*(++s)); /* No params straight after charset name */
1664
    				}
1665
    				break;
1666
#endif /* ?UNIX */
1595
                case ('p'):    /* pipes:  extract to stdout, no messages */
1667
                case ('p'):    /* pipes:  extract to stdout, no messages */
1596
                    if (negative) {
1668
                    if (negative) {
1597
                        uO.cflag = FALSE;
1669
                        uO.cflag = FALSE;
(-)unzip60orig/unzpriv.h (-1 / +1 lines)
Lines 3008-3014 char *GetLoadPath OF((__GPRO)); Link Here
3008
         !(((islochdr) || (isuxatt)) && \
3008
         !(((islochdr) || (isuxatt)) && \
3009
           ((hostver) == 25 || (hostver) == 26 || (hostver) == 40))) || \
3009
           ((hostver) == 25 || (hostver) == 26 || (hostver) == 40))) || \
3010
        (hostnum) == FS_HPFS_ || \
3010
        (hostnum) == FS_HPFS_ || \
3011
        ((hostnum) == FS_NTFS_ && (hostver) == 50)) { \
3011
        ((hostnum) == FS_NTFS_/* && (hostver) == 50*/)) { \
3012
        _OEM_INTERN((string)); \
3012
        _OEM_INTERN((string)); \
3013
    } else { \
3013
    } else { \
3014
        _ISO_INTERN((string)); \
3014
        _ISO_INTERN((string)); \
(-)unzip60orig/zipinfo.c (+62 lines)
Lines 457-462 int zi_opts(__G__ pargc, pargv) Link Here
457
    int    tflag_slm=TRUE, tflag_2v=FALSE;
457
    int    tflag_slm=TRUE, tflag_2v=FALSE;
458
    int    explicit_h=FALSE, explicit_t=FALSE;
458
    int    explicit_h=FALSE, explicit_t=FALSE;
459
459
460
#ifdef UNIX
461
    extern char OEM_CP[MAX_CP_NAME];
462
    extern char ISO_CP[MAX_CP_NAME];
463
#endif
460
464
461
#ifdef MACOS
465
#ifdef MACOS
462
    uO.lflag = LFLAG;         /* reset default on each call */
466
    uO.lflag = LFLAG;         /* reset default on each call */
Lines 501-506 int zi_opts(__G__ pargc, pargv) Link Here
501
                            uO.lflag = 0;
505
                            uO.lflag = 0;
502
                    }
506
                    }
503
                    break;
507
                    break;
508
#ifdef UNIX
509
    			case ('I'):
510
                    if (negative) {
511
                        Info(slide, 0x401, ((char *)slide,
512
                          "error:  encodings can't be negated"));
513
                        return(PK_PARAM);
514
    				} else {
515
    					if(*s) { /* Handle the -Icharset case */
516
    						/* Assume that charsets can't start with a dash to spot arguments misuse */
517
    						if(*s == '-') { 
518
    	                        Info(slide, 0x401, ((char *)slide,
519
        		                  "error:  a valid character encoding should follow the -I argument"));
520
    	                        return(PK_PARAM); 
521
    						}
522
    						strncpy(ISO_CP, s, sizeof(ISO_CP));
523
    					} else { /* -I charset */
524
    						++argv;
525
    						if(!(--argc > 0 && *argv != NULL && **argv != '-')) {
526
    	                        Info(slide, 0x401, ((char *)slide,
527
        		                  "error:  a valid character encoding should follow the -I argument"));
528
    	                        return(PK_PARAM); 
529
    						}
530
    						s = *argv;
531
    						strncpy(ISO_CP, s, sizeof(ISO_CP));
532
    					}
533
    					while(*(++s)); /* No params straight after charset name */
534
    				}
535
    				break;
536
#endif /* ?UNIX */
504
                case 'l':      /* longer form of "ls -l" type listing */
537
                case 'l':      /* longer form of "ls -l" type listing */
505
                    if (negative)
538
                    if (negative)
506
                        uO.lflag = -2, negative = 0;
539
                        uO.lflag = -2, negative = 0;
Lines 521-526 int zi_opts(__G__ pargc, pargv) Link Here
521
                        G.M_flag = TRUE;
554
                        G.M_flag = TRUE;
522
                    break;
555
                    break;
523
#endif
556
#endif
557
#ifdef UNIX
558
    			case ('O'):
559
                    if (negative) {
560
                        Info(slide, 0x401, ((char *)slide,
561
                          "error:  encodings can't be negated"));
562
                        return(PK_PARAM);
563
    				} else {
564
    					if(*s) { /* Handle the -Ocharset case */
565
    						/* Assume that charsets can't start with a dash to spot arguments misuse */
566
    						if(*s == '-') { 
567
    	                        Info(slide, 0x401, ((char *)slide,
568
        		                  "error:  a valid character encoding should follow the -I argument"));
569
    	                        return(PK_PARAM); 
570
    						}
571
    						strncpy(OEM_CP, s, sizeof(OEM_CP));
572
    					} else { /* -O charset */
573
    						++argv;
574
    						if(!(--argc > 0 && *argv != NULL && **argv != '-')) {
575
    	                        Info(slide, 0x401, ((char *)slide,
576
        		                  "error:  a valid character encoding should follow the -O argument"));
577
    	                        return(PK_PARAM); 
578
    						}
579
    						s = *argv;
580
    						strncpy(OEM_CP, s, sizeof(OEM_CP));
581
    					}
582
    					while(*(++s)); /* No params straight after charset name */
583
    				}
584
    				break;
585
#endif /* ?UNIX */
524
                case 's':      /* default:  shorter "ls -l" type listing */
586
                case 's':      /* default:  shorter "ls -l" type listing */
525
                    if (negative)
587
                    if (negative)
526
                        uO.lflag = -2, negative = 0;
588
                        uO.lflag = -2, negative = 0;
(-)unzip60orig/unix/configure (-1 / +1 lines)
Lines 17-23 CFLAGSR=${CFLAGS} Link Here
17
IZ_BZIP2=${3}
17
IZ_BZIP2=${3}
18
CFLAGS="${CFLAGS} -I. -DUNIX"
18
CFLAGS="${CFLAGS} -I. -DUNIX"
19
LFLAGS1=""
19
LFLAGS1=""
20
LFLAGS2="-s"
20
LFLAGS2="-l natspec"
21
LN="ln -s"
21
LN="ln -s"
22
22
23
CFLAGS_OPT=''
23
CFLAGS_OPT=''
(-)unzip60orig/unix/Makefile (-3 / +3 lines)
Lines 45-58 Link Here
45
CC = cc#	try using "gcc" target rather than changing this (CC and LD
45
CC = cc#	try using "gcc" target rather than changing this (CC and LD
46
LD = $(CC)#	must match, else "unresolved symbol:  ___main" is possible)
46
LD = $(CC)#	must match, else "unresolved symbol:  ___main" is possible)
47
AS = as
47
AS = as
48
LOC = $(D_USE_BZ2) $(LOCAL_UNZIP)
48
LOC = $(D_USE_BZ2) -DNO_SETLOCALE $(LOCAL_UNZIP)
49
AF = $(LOC)
49
AF = $(LOC)
50
CFLAGS = -O
50
CFLAGS = -O
51
CF_NOOPT = -I. -I$(IZ_BZIP2) -DUNIX $(LOC)
51
CF_NOOPT = -I. -I$(IZ_BZIP2) -DUNIX $(LOC)
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
56
57
# UnZipSFX flags
57
# UnZipSFX flags
58
SL = -o unzipsfx$E $(LFLAGS1)
58
SL = -o unzipsfx$E $(LFLAGS1)
Lines 121-127 INSTALL_PROGRAM = $(INSTALL) Link Here
121
INSTALL_D = mkdir -p
121
INSTALL_D = mkdir -p
122
# on some systems, manext=l and MANDIR=/usr/man/man$(manext) may be appropriate
122
# on some systems, manext=l and MANDIR=/usr/man/man$(manext) may be appropriate
123
manext = 1
123
manext = 1
124
prefix = /usr/local
124
prefix = /usr
125
BINDIR = $(prefix)/bin#			where to install executables
125
BINDIR = $(prefix)/bin#			where to install executables
126
MANDIR = $(prefix)/man/man$(manext)#	where to install man pages
126
MANDIR = $(prefix)/man/man$(manext)#	where to install man pages
127
INSTALLEDBIN = $(BINDIR)/funzip$E $(BINDIR)/unzip$E $(BINDIR)/unzipsfx$E \
127
INSTALLEDBIN = $(BINDIR)/funzip$E $(BINDIR)/unzip$E $(BINDIR)/unzipsfx$E \
(-)unzip60orig/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 1874-1876 static void qlfix(__G__ ef_ptr, ef_len) Link Here
1874
    }
1877
    }
1875
}
1878
}
1876
#endif /* QLZIP */
1879
#endif /* QLZIP */
1880
1881
1882
char OEM_CP[MAX_CP_NAME] = "";
1883
char ISO_CP[MAX_CP_NAME] = "";
1884
1885
/* Getr the default value of OEM_CP based on the current locale.
1886
 * ISO_CP is left alone for now. */
1887
void init_conversion_charsets()
1888
{
1889
    /* Make a guess only if OEM_CP not already set. */ 
1890
    if(*OEM_CP == '\0') {
1891
        const char * archive_charset = natspec_get_charset_by_locale(NATSPEC_DOSCS, "");
1892
        strncpy(OEM_CP, archive_charset, sizeof(OEM_CP));
1893
    }
1894
1895
    if(*ISO_CP == '\0') {
1896
        const char * archive_charset = natspec_get_charset_by_locale(NATSPEC_WINCS, "");
1897
        strncpy(ISO_CP, archive_charset, sizeof(ISO_CP));
1898
    }
1899
1900
}
1901
1902
/* Convert a string from OEM_CP to the current locale charset. */
1903
inline void oem_intern(char *string)
1904
{
1905
    char *buf = natspec_convert(string, 0, OEM_CP, 0);
1906
	/* Since Ext_ASCII_TO_Native used only for G.filename[FILNAMESIZE],
1907
	   use FILNAMSIZ as string size */
1908
    strncpy(string, buf, FILNAMSIZ);
1909
	free (buf);
1910
}
1911
1912
/* Convert a string from ISO_CP to the current locale charset. */
1913
inline void iso_intern(char *string)
1914
{
1915
    char *buf = natspec_convert(string, 0, ISO_CP, 0);
1916
	/* Since Ext_ASCII_TO_Native used only for G.filename[FILNAMESIZE],
1917
	   use FILNAMSIZ as string size */
1918
    strncpy(string, buf, FILNAMSIZ);
1919
	free (buf);
1920
}
(-)unzip60orig/unix/unxcfg.h (+26 lines)
Lines 227-230 typedef struct stat z_stat; Link Here
227
/* wild_dir, dirname, wildname, matchname[], dirnamelen, have_dirname, */
227
/* wild_dir, dirname, wildname, matchname[], dirnamelen, have_dirname, */
228
/*    and notfirstcall are used by do_wild().                          */
228
/*    and notfirstcall are used by do_wild().                          */
229
229
230
231
#define MAX_CP_NAME 25 
232
   
233
#ifdef SETLOCALE
234
#  undef SETLOCALE
235
#endif
236
#define SETLOCALE(category, locale) setlocale(category, locale)
237
#include <locale.h>
238
   
239
#ifdef _ISO_INTERN
240
#  undef _ISO_INTERN
241
#endif
242
#define _ISO_INTERN(str1) iso_intern(str1)
243
244
#ifdef _OEM_INTERN
245
#  undef _OEM_INTERN
246
#endif
247
#ifndef IZ_OEM2ISO_ARRAY
248
#  define IZ_OEM2ISO_ARRAY
249
#endif
250
#define _OEM_INTERN(str1) oem_intern(str1)
251
252
void iso_intern(char *);
253
void oem_intern(char *);
254
void init_conversion_charsets(void);
255
   
230
#endif /* !__unxcfg_h */
256
#endif /* !__unxcfg_h */

Return to bug 275244