View | Details | Raw Unified
Collapse All | Expand All

(-)unzip-5.52-orig/unix/Makefile (-1 / +1 lines)
 Lines 49-55   LOC = $(LOCAL_UNZIP) Link Here 
49
AF = $(LOC)
49
AF = $(LOC)
50
CF = -O -I. -DUNIX $(LOC)
50
CF = -O -I. -DUNIX $(LOC)
51
LF = -o unzip
51
LF = -o unzip
52
LF2 = -s
52
LF2 = -l natspec
53
53
54
# UnZipSFX flags
54
# UnZipSFX flags
55
SL = -o unzipsfx
55
SL = -o unzipsfx
(-)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 (+89 lines)
 Lines 309-319   static ZCONST char Far ZipInfoUsageLine2 Link Here 
309
  -2  just filenames but allow -h/-t/-z  -l  long Unix \"ls -l\" format\n\
309
  -2  just filenames but allow -h/-t/-z  -l  long Unix \"ls -l\" format\n\
310
                                         -v  verbose, multi-page format\n";
310
                                         -v  verbose, multi-page format\n";
311
311
312
#ifndef UNIX
312
static ZCONST char Far ZipInfoUsageLine3[] = "miscellaneous options:\n\
313
static ZCONST char Far ZipInfoUsageLine3[] = "miscellaneous options:\n\
313
  -h  print header line       -t  print totals for listed files or for all\n\
314
  -h  print header line       -t  print totals for listed files or for all\n\
314
  -z  print zipfile comment  %c-T%c print file times in sortable decimal format\
315
  -z  print zipfile comment  %c-T%c print file times in sortable decimal format\
315
\n %c-C%c be case-insensitive   %s\
316
\n %c-C%c be case-insensitive   %s\
316
  -x  exclude filenames that follow from listing\n";
317
  -x  exclude filenames that follow from listing\n";
318
#else /* UNIX */
319
static ZCONST char Far ZipInfoUsageLine3[] = "miscellaneous options:\n\
320
  -h  print header line       -t  print totals for listed files or for all\n\
321
  -z  print zipfile comment  %c-T%c print file times in sortable decimal format\
322
\n %c-C%c be case-insensitive   %s\
323
  -x  exclude filenames that follow from listing\n\
324
  -O CHARSET  specify a character encoding for DOS, Windows and OS/2 archives\n\
325
  -I CHARSET  specify a character encoding for UNIX and other archives\n";
326
#endif /* !UNIX */
317
#ifdef MORE
327
#ifdef MORE
318
#ifdef VMS
328
#ifdef VMS
319
   static ZCONST char Far ZipInfoUsageLine4[] =
329
   static ZCONST char Far ZipInfoUsageLine4[] =
 Lines 599-604   static ZCONST char Far UnzipUsageLine3[] Link Here 
599
#endif /* ?VM_CMS */
609
#endif /* ?VM_CMS */
600
#endif /* ?MACOS */
610
#endif /* ?MACOS */
601
611
612
#ifndef UNIX
602
static ZCONST char Far UnzipUsageLine4[] = "\
613
static ZCONST char Far UnzipUsageLine4[] = "\
603
modifiers:                                   -q  quiet mode (-qq => quieter)\n\
614
modifiers:                                   -q  quiet mode (-qq => quieter)\n\
604
  -n  never overwrite existing files         -a  auto-convert any text files\n\
615
  -n  never overwrite existing files         -a  auto-convert any text files\n\
 Lines 606-611   modifiers: Link Here 
606
 -j  junk paths (do not make directories)   -v  be verbose/print version info\n\
617
 -j  junk paths (do not make directories)   -v  be verbose/print version info\n\
607
 %c-C%c match filenames case-insensitively    %c-L%c make (some) names \
618
 %c-C%c match filenames case-insensitively    %c-L%c make (some) names \
608
lowercase\n %-42s %c-V%c retain VMS version numbers\n%s";
619
lowercase\n %-42s %c-V%c retain VMS version numbers\n%s";
620
#else /* UNIX */
621
static ZCONST char Far UnzipUsageLine4[] = "\
622
modifiers:                                   -q  quiet mode (-qq => quieter)\n\
623
  -n  never overwrite existing files         -a  auto-convert any text files\n\
624
  -o  overwrite files WITHOUT prompting      -aa treat ALL files as text\n \
625
 -j  junk paths (do not make directories)   -v  be verbose/print version info\n\
626
 %c-C%c match filenames case-insensitively    %c-L%c make (some) names \
627
lowercase\n %-42s %c-V%c retain VMS version numbers\n%s\n\
628
  -O CHARSET  specify a character encoding for DOS, Windows and OS/2 archives\n\
629
  -I CHARSET  specify a character encoding for UNIX and other archives\n\n";
630
#endif /* !UNIX */
609
631
610
static ZCONST char Far UnzipUsageLine5[] = "\
632
static ZCONST char Far UnzipUsageLine5[] = "\
611
Examples (see unzip.txt for more info):\n\
633
Examples (see unzip.txt for more info):\n\
 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 (-2 / +4 lines)
 Lines 1193-1199    Link Here 
1193
#  define lastchar(ptr, len) (ptr[(len)-1])
1193
#  define lastchar(ptr, len) (ptr[(len)-1])
1194
#  define MBSCHR(str, c) strchr(str, c)
1194
#  define MBSCHR(str, c) strchr(str, c)
1195
#  define MBSRCHR(str, c) strrchr(str, c)
1195
#  define MBSRCHR(str, c) strrchr(str, c)
1196
#  define SETLOCALE(category, locale)
1196
#  ifndef SETLOCALE
1197
#    define SETLOCALE(category, locale)
1198
#  endif
1197
#endif /* ?_MBCS */
1199
#endif /* ?_MBCS */
1198
#define INCSTR(ptr) PREINCSTR(ptr)
1200
#define INCSTR(ptr) PREINCSTR(ptr)
1199
1201
 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;