/[gentoo-x86]/app-arch/zip/files/zip-3.0-natspec.patch
Gentoo

Contents of /app-arch/zip/files/zip-3.0-natspec.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download) (as text)
Wed Dec 22 16:50:38 2010 UTC (9 years, 7 months ago) by pva
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/x-diff
Added patch to use libnatspec to fix interoperability with Windows, bug #275244.

(Portage version: 2.1.9.25/cvs/Linux x86_64)

1 This patch makes zip use libnatspec to recode file names is national charset.
2 Initially this patch was written for altlinux:
3 http://sisyphus.ru/ru/srpm/Sisyphus/zip/patches
4
5 Later it was a bit improved and improved version was posted here (in Russian):
6 http://www.opennet.ru/tips/info/2494.shtml
7
8 Also I've added natspec support to output of zipnote (thank vapier for notice).
9
10 Gentoo reference:
11 https://bugs.gentoo.org/show_bug.cgi?id=275244
12
13 --
14 pva@gentoo.org
15
16 === modified file 'fileio.c'
17 --- fileio.c 2010-12-22 13:02:43 +0000
18 +++ fileio.c 2010-12-22 13:03:00 +0000
19 @@ -929,7 +929,7 @@
20 }
21 if ((zname = in2ex(iname)) == NULL)
22 return ZE_MEM;
23 -#ifdef UNICODE_SUPPORT
24 +#if defined(UNICODE_SUPPORT) && !defined(UNIX)
25 /* Convert name to display or OEM name */
26 oname = local_to_display_string(iname);
27 #else
28
29 === modified file 'globals.c'
30 --- globals.c 2010-12-22 13:02:43 +0000
31 +++ globals.c 2010-12-22 13:03:00 +0000
32 @@ -32,7 +32,7 @@
33 int scanimage = 1; /* 1=scan through image files */
34 #endif
35 int method = BEST; /* one of BEST, DEFLATE (only), or STORE (only) */
36 -int dosify = 0; /* 1=make new entries look like MSDOS */
37 +int dosify = 1; /* 1=make new entries look like MSDOS */
38 int verbose = 0; /* 1=report oddities in zip file structure */
39 int fix = 0; /* 1=fix the zip file, 2=FF, 3=ZipNote */
40 int filesync = 0; /* 1=file sync, delete entries not on file system */
41
42 === modified file 'unix/Makefile'
43 --- unix/Makefile 2010-12-22 13:02:43 +0000
44 +++ unix/Makefile 2010-12-22 15:43:40 +0000
45 @@ -38,7 +38,7 @@
46 MANFLAGS = 644
47
48 # target directories - where to install executables and man pages to
49 -prefix = /usr/local
50 +prefix = /usr
51 BINDIR = $(prefix)/bin
52 MANEXT=1
53 MANDIR = $(prefix)/man/man$(MANEXT)
54 @@ -61,6 +61,7 @@
55 CFLAGS = -O2 $(CFLAGS_NOOPT)
56 LFLAGS1 =
57 LFLAGS2 = -s
58 +LDADD = -lnatspec
59
60 # object file lists
61 OBJZ = zip.o zipfile.o zipup.o fileio.o util.o globals.o crypt.o ttyio.o \
62 @@ -125,9 +126,9 @@
63 zipsman: $(ZIPS) $(ZIPMANUALs)
64
65 zip$E: $(OBJZ) $(OBJI) $(OBJA) $(LIB_BZ)
66 - $(BIND) -o zip$E $(LFLAGS1) $(OBJZ) $(OBJI) $(OBJA) $(LFLAGS2)
67 + $(BIND) -o zip$E $(LFLAGS1) $(OBJZ) $(OBJI) $(OBJA) $(LFLAGS2) $(LDADD)
68 zipnote$E: $(OBJN)
69 - $(BIND) -o zipnote$E $(LFLAGS1) $(OBJN) $(LFLAGS2)
70 + $(BIND) -o zipnote$E $(LFLAGS1) $(OBJN) $(LFLAGS2) $(LDADD)
71 zipcloak$E: $(OBJC) $(OCRCTB)
72 $(BIND) -o zipcloak$E $(LFLAGS1) $(OBJC) $(LFLAGS2)
73 zipsplit$E: $(OBJS)
74
75 === modified file 'unix/osdep.h'
76 --- unix/osdep.h 2010-12-22 13:02:43 +0000
77 +++ unix/osdep.h 2010-12-22 15:45:29 +0000
78 @@ -78,3 +78,6 @@
79 #if !defined(NO_EF_UT_TIME) && !defined(USE_EF_UT_TIME)
80 # define USE_EF_UT_TIME
81 #endif
82 +
83 +/* Set Windows code as archive type */
84 +# define OS_CODE 0xb00
85
86 === modified file 'unix/unix.c'
87 --- unix/unix.c 2010-12-22 13:02:43 +0000
88 +++ unix/unix.c 2010-12-22 13:03:00 +0000
89 @@ -14,6 +14,11 @@
90
91 #include <time.h>
92
93 +#ifdef UNIX
94 +# include <natspec.h>
95 +# include <locale.h>
96 +#endif
97 +
98 #if defined(MINIX) || defined(__mpexl)
99 # ifdef S_IWRITE
100 # undef S_IWRITE
101 @@ -60,6 +65,7 @@
102
103 /* Local functions */
104 local char *readd OF((DIR *));
105 +local const char *oem_charset = NULL;
106
107
108 #ifdef NO_DIR /* for AT&T 3B1 */
109 @@ -262,6 +268,16 @@
110 if (!pathput)
111 t = last(t, PATH_END);
112
113 +#ifdef UNIX
114 + if (!oem_charset) {
115 + setlocale(LC_CTYPE, "");
116 + oem_charset = natspec_get_charset_by_locale(NATSPEC_DOSCS, "");
117 + }
118 + /* Convert to internal encoding */
119 + if ((n = natspec_convert(t, oem_charset, 0, 0)) == NULL)
120 + return NULL;
121 + return n;
122 +#else
123 /* Malloc space for internal name and copy it */
124 if ((n = malloc(strlen(t) + 1)) == NULL)
125 return NULL;
126 @@ -269,6 +285,7 @@
127
128 if (dosify)
129 msname(n);
130 +#endif
131
132 #ifdef EBCDIC
133 strtoasc(n, n); /* here because msname() needs native coding */
134 @@ -289,8 +306,19 @@
135 {
136 char *x; /* external file name */
137
138 +#ifdef UNIX
139 + if (!oem_charset) {
140 + oem_charset = natspec_get_charset_by_locale(NATSPEC_DOSCS, "");
141 + setlocale(LC_CTYPE, "");
142 + }
143 + /* Convert to internal encoding */
144 + if ((x = natspec_convert(n, 0, oem_charset, 0)) == NULL)
145 + return NULL;
146 + return x;
147 +#else
148 if ((x = malloc(strlen(n) + 1 + PAD)) == NULL)
149 return NULL;
150 +#endif
151 #ifdef EBCDIC
152 strtoebc(x, n);
153 #else
154
155 === modified file 'zip.c'
156 --- zip.c 2010-12-22 13:02:43 +0000
157 +++ zip.c 2010-12-22 13:03:00 +0000
158 @@ -2025,6 +2025,7 @@
159 #endif /* ?MACOS */
160 {"J", "junk-sfx", o_NO_VALUE, o_NOT_NEGATABLE, 'J', "strip self extractor from archive"},
161 {"k", "DOS-names", o_NO_VALUE, o_NOT_NEGATABLE, 'k', "force use of 8.3 DOS names"},
162 + {"K", "no DOS-names",o_NO_VALUE, o_NOT_NEGATABLE, 'K', "no use 8.3 DOS names"},
163 {"l", "to-crlf", o_NO_VALUE, o_NOT_NEGATABLE, 'l', "convert text file line ends - LF->CRLF"},
164 {"ll", "from-crlf", o_NO_VALUE, o_NOT_NEGATABLE, o_ll, "convert text file line ends - CRLF->LF"},
165 {"lf", "logfile-path",o_REQUIRED_VALUE, o_NOT_NEGATABLE, o_lf, "log to log file at path (default overwrite)"},
166 @@ -2289,7 +2290,7 @@
167 dispose = 0; /* 1=remove files after put in zip file */
168 pathput = 1; /* 1=store path with name */
169 method = BEST; /* one of BEST, DEFLATE (only), or STORE (only) */
170 - dosify = 0; /* 1=make new entries look like MSDOS */
171 + dosify = 1; /* 1=make new entries look like MSDOS */
172 verbose = 0; /* 1=report oddities in zip file structure */
173 fix = 0; /* 1=fix the zip file */
174 adjust = 0; /* 1=adjust offsets for sfx'd file (keep preamble) */
175 @@ -2859,6 +2860,8 @@
176 junk_sfx = 1; break;
177 case 'k': /* Make entries using DOS names (k for Katz) */
178 dosify = 1; break;
179 + case 'K': /* Make entries using DOS names (K for Kompat) */
180 + dosify = 0; break;
181 case 'l': /* Translate end-of-line */
182 translate_eol = 1; break;
183 case o_ll:
184
185 === modified file 'zipnote.c'
186 --- zipnote.c 2010-12-22 13:02:43 +0000
187 +++ zipnote.c 2010-12-22 15:42:45 +0000
188 @@ -21,6 +21,11 @@
189 #include "revision.h"
190 #include <signal.h>
191
192 +#ifdef UNIX
193 +# include <natspec.h>
194 +# include <locale.h>
195 +#endif
196 +
197 /* Calculate size of static line buffer used in write (-w) mode. */
198 #define WRBUFSIZ 2047
199 /* The line buffer size should be at least as large as FNMAX. */
200 @@ -537,7 +542,13 @@
201 {
202 for (z = zfiles; z != NULL; z = z->nxt)
203 {
204 +#ifdef UNIX
205 + char *oem_charset = NULL;
206 + oem_charset = natspec_get_charset_by_locale(NATSPEC_DOSCS, "");
207 + printf("%c %s\n", MARK, natspec_convert(z->zname, 0, oem_charset, 0));
208 +#else
209 printf("%c %s\n", MARK, z->zname);
210 +#endif
211 putclean(z->comment, z->com);
212 printf("%c%s\n", MARK, MARKE);
213 }
214

  ViewVC Help
Powered by ViewVC 1.1.20