Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 69945
Collapse All | Expand All

(-)unzip-5.52/convfn.c (+52 lines)
Line 0 Link Here
1
#ifdef _USE_ICONV
2
#include <stdlib.h>
3
#include <string.h>
4
#include <iconv.h>
5
#include <langinfo.h>
6
#define ICONV_BUFSIZE 260
7
char* getLegacyCharset() {
8
	char *lang = getenv("LANG");
9
	if(!lang) return "ISO8859-1";
10
	if(!strncmp(lang, "ko", 2)) return "UHC";
11
	if(!strncmp(lang, "zh_TW", 5)) return "BIG5";
12
	if(!strncmp(lang, "zh_GB", 5)) return "GB2312";
13
	if(!strncmp(lang, "ja", 2)) return "EUC-JP";
14
	if(!strncmp(lang, "ru", 2)) return "CP1251";
15
	if(!strncmp(lang, "uk", 2)) return "KOI8-U";
16
	if(!strncmp(lang, "th", 2)) return "TIS-620";
17
	if(!strncmp(lang, "vi", 2)) return "TCVN";
18
	return "ISO8859-1";
19
20
}
21
22
23
char* convertfn(char *filename) {
24
		size_t ileft, oleft;
25
		iconv_t cd;
26
		size_t iconv_result;
27
		size_t size;
28
		char inbuf[ICONV_BUFSIZE];
29
		char outbuf[ICONV_BUFSIZE];
30
		char *inptr = inbuf;
31
		char *outptr = outbuf;
32
		
33
		size = strlen(filename)+1;
34
		strncpy(inbuf, filename, size);
35
		ileft = size;
36
		oleft = sizeof(outbuf);
37
38
		cd = iconv_open(nl_langinfo(CODESET), getLegacyCharset());
39
40
		iconv_result = iconv(cd, &inptr, &ileft, &outptr, &oleft);
41
42
		outbuf[ICONV_BUFSIZE - oleft] = 0;
43
		if(iconv_result != -1) strcpy(filename, outbuf);
44
45
		iconv_close(cd);
46
		return filename;
47
}
48
#else 
49
char* convertfn(char *filename) {
50
	return filename;
51
}
52
#endif
(-)unzip-5.52/convfn.h (+5 lines)
Line 0 Link Here
1
#ifndef _CONVERT_FILE_NAME_H
2
#define _CONVERT_FILE_NAME_H
3
char* convertfn(char *filename);
4
#endif
5
(-)unzip-5.52/extract.c (+5 lines)
Lines 2344-2349 Link Here
2344
    return (char *)space;
2344
    return (char *)space;
2345
2345
2346
#else /* NATIVE:  EBCDIC or whatever */
2346
#else /* NATIVE:  EBCDIC or whatever */
2347
#if 1
2348
#include "convfn.h"
2349
	raw = convertfn(raw);
2350
#endif
2351
2347
    return (char *)raw;
2352
    return (char *)raw;
2348
#endif
2353
#endif
2349
2354
(-)unzip-5.52/fileio.c (+5 lines)
Lines 2139-2148 Link Here
2139
            return PK_EOF;
2139
            return PK_EOF;
2140
        G.filename[length] = '\0';      /* terminate w/zero:  ASCIIZ */
2140
        G.filename[length] = '\0';      /* terminate w/zero:  ASCIIZ */
2141
2141
2142
#if 0
2142
        /* translate the Zip entry filename coded in host-dependent "extended
2143
        /* translate the Zip entry filename coded in host-dependent "extended
2143
           ASCII" into the compiler's (system's) internal text code page */
2144
           ASCII" into the compiler's (system's) internal text code page */
2144
        Ext_ASCII_TO_Native(G.filename, G.pInfo->hostnum, G.pInfo->hostver,
2145
        Ext_ASCII_TO_Native(G.filename, G.pInfo->hostnum, G.pInfo->hostver,
2145
                            G.pInfo->HasUxAtt, (option == DS_FN_L));
2146
                            G.pInfo->HasUxAtt, (option == DS_FN_L));
2147
#else
2148
#include "convfn.h"
2149
		convertfn(G.filename);
2150
#endif
2146
2151
2147
        if (G.pInfo->lcflag)      /* replace with lowercase filename */
2152
        if (G.pInfo->lcflag)      /* replace with lowercase filename */
2148
            STRLOWER(G.filename, G.filename);
2153
            STRLOWER(G.filename, G.filename);
(-)unzip-5.52/funzip.c (+1 lines)
Lines 303-308 Link Here
303
  uch h[LOCHDR];                /* first local header (GZPHDR < LOCHDR) */
303
  uch h[LOCHDR];                /* first local header (GZPHDR < LOCHDR) */
304
  int g = 0;                    /* true if gzip format */
304
  int g = 0;                    /* true if gzip format */
305
  unsigned method = 0;          /* initialized here to shut up gcc warning */
305
  unsigned method = 0;          /* initialized here to shut up gcc warning */
306
  SETLOCALE(LC_ALL, "");
306
#if CRYPT
307
#if CRYPT
307
  char *s = " [-password]";
308
  char *s = " [-password]";
308
  char *p;                      /* password */
309
  char *p;                      /* password */
(-)unzip-5.52/unix/Makefile (-7 / +7 lines)
Lines 81-96 Link Here
81
OSDEP_H =
81
OSDEP_H =
82
82
83
# object files
83
# object files
84
OBJS1 = unzip$O $(CRC32)$O crctab$O crypt$O envargs$O explode$O
84
OBJS1 = unzip$O $(CRC32)$O crctab$O crypt$O envargs$O explode$O convfn$O 
85
OBJS2 = extract$O fileio$O globals$O inflate$O list$O match$O
85
OBJS2 = extract$O fileio$O globals$O inflate$O list$O match$O
86
OBJS3 = process$O ttyio$O unreduce$O unshrink$O zipinfo$O
86
OBJS3 = process$O ttyio$O unreduce$O unshrink$O zipinfo$O
87
OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O
87
OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O
88
LOBJS = $(OBJS)
88
LOBJS = $(OBJS)
89
OBJSDLL = $(OBJS:.o=.pic.o) api.pic.o
89
OBJSDLL = $(OBJS:.o=.pic.o) api.pic.o
90
OBJX = unzipsfx$O $(CRC32)$O crctab_$O crypt_$O extract_$O fileio_$O \
90
OBJX = unzipsfx$O $(CRC32)$O crctab_$O crypt_$O extract_$O fileio_$O \
91
	globals_$O inflate_$O match_$O process_$O ttyio_$O $M_$O
91
	globals_$O inflate_$O match_$O process_$O ttyio_$O convfn$O $M_$O
92
LOBJX = $(OBJX)
92
LOBJX = $(OBJX)
93
OBJF = funzip$O $(CRC32)$O cryptf$O globalsf$O inflatef$O ttyiof$O
93
OBJF = funzip$O $(CRC32)$O cryptf$O globalsf$O inflatef$O ttyiof$O convfn$O
94
#OBJS_OS2 = $(OBJS1:.o=.obj) $(OBJS2:.o=.obj) os2.obj
94
#OBJS_OS2 = $(OBJS1:.o=.obj) $(OBJS2:.o=.obj) os2.obj
95
#OBJF_OS2 = $(OBJF:.o=.obj)
95
#OBJF_OS2 = $(OBJF:.o=.obj)
96
UNZIP_H = unzip.h unzpriv.h globals.h $(OSDEP_H)
96
UNZIP_H = unzip.h unzpriv.h globals.h $(OSDEP_H)
Lines 728-735 Link Here
728
freebsd:		unix_make
728
freebsd:		unix_make
729
	@echo 'NOTE:  use bsd target for non-Intel FreeBSD compiles (if any).'
729
	@echo 'NOTE:  use bsd target for non-Intel FreeBSD compiles (if any).'
730
	$(MAKE) unzips CC=gcc LD=gcc AS=gcc\
730
	$(MAKE) unzips CC=gcc LD=gcc AS=gcc\
731
	 CF="-O3 -Wall -I. -DASM_CRC -DUNIX -DBSD $(LOC)"\
731
	 CF="-O3 -Wall -I. -DASM_CRC -DUNIX -DBSD -D_USE_ICONV $(LOC)"\
732
	 AF="-Di386 $(AF)" CRC32=crc_gcc
732
	 AF="-Di386 $(AF)" CRC32=crc_gcc LF2="-liconv $(LF2)"
733
733
734
# Generic BSDish Unix gcc.  ``The $(CFLAGS) only works with later versions of gcc;
734
# Generic BSDish Unix gcc.  ``The $(CFLAGS) only works with later versions of gcc;
735
# you may have to use -O2 or $(CFLAGS) for earlier versions.  I have no idea why
735
# you may have to use -O2 or $(CFLAGS) for earlier versions.  I have no idea why
Lines 773-789 Link Here
773
linux:		unix_make
773
linux:		unix_make
774
	@echo 'NOTE:  use linux_noasm target for non-Intel Linux compiles.'
774
	@echo 'NOTE:  use linux_noasm target for non-Intel Linux compiles.'
775
	$(MAKE) unzips CC=gcc LD=gcc AS=gcc\
775
	$(MAKE) unzips CC=gcc LD=gcc AS=gcc\
776
	 CF="-O3 -Wall -I. -DASM_CRC $(LOC)"\
776
	 CF="-O3 -Wall -I. -DASM_CRC -D_USE_ICONV $(LOC)"\
777
	 AF="-Di386 $(AF)" CRC32=crc_gcc
777
	 AF="-Di386 $(AF)" CRC32=crc_gcc
778
# GRR:  this echo is pointless; if user gets this far, no difference to install
778
# GRR:  this echo is pointless; if user gets this far, no difference to install
779
#	@echo 'Be sure to use the install_asm target rather than the install target'
779
#	@echo 'Be sure to use the install_asm target rather than the install target'
780
780
781
linux_asm:	linux
781
linux_asm:	linux
782
782
783
# Linux (Posix, approximately SysV):  virtually any version since before 0.96,
783
# Linux (Posix, approximately SysV):  virtually any version since before 0.96,
784
# for any platform.  Change "-O" to "-O3" or whatever, as desired...
784
# for any platform.  Change "-O" to "-O3" or whatever, as desired...
785
linux_noasm:	unix_make
785
linux_noasm:	unix_make
786
	$(MAKE) unzips CC=gcc LD=gcc CF="-O -Wall -I. $(LOC)"
786
	$(MAKE) unzips CC=gcc LD=gcc CF="-O -Wall -I. -D_USE_ICONV $(LOC)"
787
787
788
# Linux with lcc compiler:  __inline__ (stat.h) not recognized, and must edit
788
# Linux with lcc compiler:  __inline__ (stat.h) not recognized, and must edit
789
# /usr/include/gnu/types.h to get rid of "long long" if __LCC__ defined.  -O3
789
# /usr/include/gnu/types.h to get rid of "long long" if __LCC__ defined.  -O3
(-)unzip-5.52/unzip.c (-1 / +1 lines)
Lines 666-672 Link Here
666
#endif
666
#endif
667
#endif /* NO_EXCEPT_SIGNALS */
667
#endif /* NO_EXCEPT_SIGNALS */
668
668
669
    SETLOCALE(LC_CTYPE,"");
669
    SETLOCALE(LC_ALL ,"");
670
670
671
#if (defined(__IBMC__) && defined(__DEBUG_ALLOC__))
671
#if (defined(__IBMC__) && defined(__DEBUG_ALLOC__))
672
    extern void DebugMalloc(void);
672
    extern void DebugMalloc(void);
(-)unzip-5.52/unzpriv.h (+5 lines)
Lines 1195-1200 Link Here
1195
#  define MBSRCHR(str, c) strrchr(str, c)
1195
#  define MBSRCHR(str, c) strrchr(str, c)
1196
#  define SETLOCALE(category, locale)
1196
#  define SETLOCALE(category, locale)
1197
#endif /* ?_MBCS */
1197
#endif /* ?_MBCS */
1198
#ifdef _USE_ICONV
1199
#  include <locale.h>
1200
#  undef SETLOCALE
1201
#  define SETLOCALE(category, locale) setlocale(category, locale)
1202
#endif /* ?_USE_ICONV */
1198
#define INCSTR(ptr) PREINCSTR(ptr)
1203
#define INCSTR(ptr) PREINCSTR(ptr)
1199
1204
1200
1205

Return to bug 69945