View | Details | Raw Unified | Return to bug 165287
Collapse All | Expand All

(-)converters/chmview/Makefile (-9 / +6 lines)
Lines 7-33 Link Here
7
7
8
PORTNAME=	chmview
8
PORTNAME=	chmview
9
DISTVERSION=	2.0b3
9
DISTVERSION=	2.0b3
10
PORTREVISION=	1
10
PORTREVISION=	2
11
CATEGORIES=	converters textproc
11
CATEGORIES=	converters textproc
12
MASTER_SITES=	SF/trexinc/CHMView/2.0%20beta%203
12
MASTER_SITES=	SF/trexinc/CHMView/2.0%20beta%203
13
DISTNAME=	CHMView_${DISTVERSION}
13
DISTNAME=	CHMView_${DISTVERSION}
14
14
15
MAINTAINER=	ports@FreeBSD.org
15
MAINTAINER=	spam@rm-rf.kiev.ua
16
COMMENT=	Extractor from .chm files
16
COMMENT=	Extractor from .chm files
17
17
18
LIB_DEPENDS=	chm:${PORTSDIR}/misc/chmlib
19
18
USE_ZIP=	yes
20
USE_ZIP=	yes
19
USE_DOS2UNIX=	yes
21
USE_DOS2UNIX=	chmview.c utf8.c utf8.h
20
22
21
WRKSRC=		${WRKDIR}/src
23
WRKSRC=		${WRKDIR}/src
22
PLIST_FILES=	bin/chmview
24
PLIST_FILES=	bin/chmview
23
MAKE_JOBS_SAFE=	yes
25
MAKE_JOBS_SAFE=	yes
24
26
25
ONLY_FOR_ARCHS=	i386 amd64
26
27
pre-patch:
27
pre-patch:
28
	@${CP} ${FILESDIR}/Makefile ${WRKSRC}
28
	@${CP} ${FILESDIR}/Makefile ${WRKSRC}
29
30
do-install:
31
	@${INSTALL_PROGRAM} ${WRKSRC}/chmview ${PREFIX}/bin/
32
29
33
.include <bsd.port.mk>
30
.include <bsd.port.mk>
(-)converters/chmview/files/Makefile (-27 / +14 lines)
Lines 1-27 Link Here
1
#
1
BINDIR?=	${PREFIX}/bin
2
# $FreeBSD: ports/converters/chmview/files/Makefile,v 1.3 2007/03/05 12:15:12 rafan Exp $
2
3
#
3
CFLAGS+=	-DUNIX -I${LOCALBASE}/include
4
OBJDIR = .
4
LDADD+=		-L${LOCALBASE}/lib -lchm
5
EXEDIR = .
5
6
EXENAME = $(EXEDIR)/chmview
6
WARNS?=		6
7
7
8
CFLAGS += -DUNIX
8
NO_MAN=		yes
9
9
10
all: $(EXENAME)
10
PROG=		chmview
11
11
12
OBJS = $(OBJDIR)/chmview.o \
12
SRCS=		chmview.c utf8.h utf8.c
13
       $(OBJDIR)/chm_lib.o \
13
14
       $(OBJDIR)/lzx.o \
14
.include <bsd.prog.mk>
15
       $(OBJDIR)/utf8.o
16
17
$(OBJDIR)/chmview.o: chmview.c chm_lib.h
18
$(OBJDIR)/chm_lib.o: chm_lib.c chm_lib.h lzx.h
19
$(OBJDIR)/utf8.o: utf8.c utf8.h
20
$(OBJDIR)/lzx.o: lzx.c lzx.h
21
22
.c.o:
23
	$(CC) $(CFLAGS) -c ${.IMPSRC}
24
25
$(EXENAME): $(OBJS)
26
	echo $(OBJS)
27
	$(CC) $(LFLAGS) -o $(EXENAME) ${.ALLSRC}
(-)converters/chmview/files/patch-aa (-19 / +78 lines)
Lines 1-7 Link Here
1
diff -ruN src.old/chmview.c src/chmview.c
1
Index: chmview.c
2
--- src.old/chmview.c	2005-03-07 21:29:18.000000000 +0100
2
@@ -17,19 +17,47 @@
3
+++ chmview.c	2008-08-18 14:39:39.000000000 +0200
4
@@ -17,19 +17,33 @@
5
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
3
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
6
 */
4
 */
7
 
5
 
Lines 9-14 Link Here
9
 #include <windows.h>
7
 #include <windows.h>
10
+#endif
8
+#endif
11
+
9
+
10
+#include <sys/stat.h>
11
+#include <unistd.h>
12
 #include <stdio.h>
12
 #include <stdio.h>
13
 #include <stdlib.h>
13
 #include <stdlib.h>
14
 #include <string.h>
14
 #include <string.h>
Lines 21-27 Link Here
21
 #include <dir.h>
21
 #include <dir.h>
22
+#endif
22
+#endif
23
 
23
 
24
 #include "chm_lib.h"
24
-#include "chm_lib.h"
25
+#include <chm_lib.h>
25
 #include "utf8.h"
26
 #include "utf8.h"
26
 
27
 
27
+#ifdef UNIX
28
+#ifdef UNIX
Lines 29-34 Link Here
29
+#define MODE 0755
30
+#define MODE 0755
30
+#endif
31
+#endif
31
+
32
+
33
+char *pointtoname(char *path);
34
+void ReplaceIllegalChars(char *ptr);
35
+void extract(struct chmFile *c, struct chmUnitInfo *ui,
36
+		long extractwithoutpath);
37
+int _extract_callback_all(struct chmFile *c, struct chmUnitInfo *ui,
38
+		void *context);
39
+int _extract_callback_dir(struct chmFile *c, struct chmUnitInfo *ui,
40
+		void *context);
41
+int extractdir(struct chmFile *c, char *path, long extractwithoutpath);
42
+int _print_ui(struct chmFile *c __unused, struct chmUnitInfo *ui,
43
+		void *context __unused);
44
+
32
 struct cb_data
45
 struct cb_data
33
 {
46
 {
34
-  int extractwithoutpath;
47
-  int extractwithoutpath;
Lines 36-42 Link Here
36
   char *path;
49
   char *path;
37
   int pathlen;
50
   int pathlen;
38
 };
51
 };
39
@@ -44,6 +58,7 @@
52
@@ -44,6 +72,7 @@
40
   return p;
53
   return p;
41
 }
54
 }
42
 
55
 
Lines 44-50 Link Here
44
 int makedir(char *path)
57
 int makedir(char *path)
45
 {
58
 {
46
   char *end;
59
   char *end;
47
@@ -75,6 +90,39 @@
60
@@ -75,13 +104,45 @@
48
   }
61
   }
49
   return 1;
62
   return 1;
50
 }
63
 }
Lines 52-58 Link Here
52
+static int makedir(char *path)
65
+static int makedir(char *path)
53
+{
66
+{
54
+  char *slash;
67
+  char *slash;
55
+  int  was_error, done, err;
68
+  int  was_error, done;
56
+
69
+
57
+  slash = path;
70
+  slash = path;
58
+  done = 0;
71
+  done = 0;
Lines 84-90 Link Here
84
 
97
 
85
 const char ILLEGAL_SYMB[] = "<>:|?*\"";
98
 const char ILLEGAL_SYMB[] = "<>:|?*\"";
86
 const char ILLEGAL_REPL[] = "()_!__'";
99
 const char ILLEGAL_REPL[] = "()_!__'";
87
@@ -94,7 +142,7 @@
100
 
101
 void ReplaceIllegalChars(char *ptr)
102
 {
103
-  char *org = ptr;
104
   while ( *ptr )
105
   {
106
     const char *zz;
107
@@ -94,15 +155,17 @@
88
   }
108
   }
89
 }
109
 }
90
 
110
 
Lines 93-99 Link Here
93
 {
113
 {
94
   LONGINT64 length=0;
114
   LONGINT64 length=0;
95
   char *outbuf=NULL;
115
   char *outbuf=NULL;
96
@@ -103,6 +151,9 @@
116
-  char *p;
117
   FILE *f;
97
   char fullpath[CHM_MAX_PATHLEN*2+1];
118
   char fullpath[CHM_MAX_PATHLEN*2+1];
98
   char target[CHM_MAX_PATHLEN*2+1];
119
   char target[CHM_MAX_PATHLEN*2+1];
99
   wchar_t temp[CHM_MAX_PATHLEN+1];
120
   wchar_t temp[CHM_MAX_PATHLEN+1];
Lines 103-109 Link Here
103
 
124
 
104
   if (ui->length)
125
   if (ui->length)
105
   {
126
   {
106
@@ -116,13 +167,32 @@
127
@@ -116,13 +179,32 @@
107
       return -1;
128
       return -1;
108
     }
129
     }
109
   }
130
   }
Lines 136-142 Link Here
136
   ReplaceIllegalChars(target);
157
   ReplaceIllegalChars(target);
137
   strcat(fullpath,extractwithoutpath?pointtoname(target):(target[0]=='/'?target+1:target));
158
   strcat(fullpath,extractwithoutpath?pointtoname(target):(target[0]=='/'?target+1:target));
138
   if (!extractwithoutpath)
159
   if (!extractwithoutpath)
139
@@ -147,26 +217,30 @@
160
@@ -147,30 +229,38 @@
140
   return 0;
161
   return 0;
141
 }
162
 }
142
 
163
 
Lines 163-185 Link Here
163
   printf("OK\n");
184
   printf("OK\n");
164
 }
185
 }
165
 
186
 
166
 int _extract_callback_all(struct chmFile *c, struct chmUnitInfo *ui, void *context)
187
-int _extract_callback_all(struct chmFile *c, struct chmUnitInfo *ui, void *context)
188
+int _extract_callback_all(struct chmFile *c,
189
+		struct chmUnitInfo *ui,
190
+		void *context)
167
 {
191
 {
168
-  extract(c,ui,(int)context);
192
-  extract(c,ui,(int)context);
169
+  extract(c,ui,(long)context);
193
+  extract(c,ui,(long)context);
170
   return CHM_ENUMERATOR_CONTINUE;
194
   return CHM_ENUMERATOR_CONTINUE;
171
 }
195
 }
172
 
196
 
173
@@ -180,7 +254,7 @@
197
-int _extract_callback_dir(struct chmFile *c, struct chmUnitInfo *ui, void *context)
198
+int _extract_callback_dir(struct chmFile *c,
199
+		struct chmUnitInfo *ui,
200
+		void *context)
201
 {
202
   struct cb_data *data = (struct cb_data *)context;
203
   if (!_strnicmp(ui->path,data->path,data->pathlen))
204
@@ -180,29 +270,35 @@
174
   return CHM_ENUMERATOR_CONTINUE;
205
   return CHM_ENUMERATOR_CONTINUE;
175
 }
206
 }
176
 
207
 
177
-extractdir(struct chmFile *c, char *path, int extractwithoutpath)
208
-extractdir(struct chmFile *c, char *path, int extractwithoutpath)
178
+extractdir(struct chmFile *c, char *path, long extractwithoutpath)
209
+int extractdir(struct chmFile *c, char *path, long extractwithoutpath)
179
 {
210
 {
180
   struct cb_data data = {extractwithoutpath,path,strlen(path)};
211
   struct cb_data data = {extractwithoutpath,path,strlen(path)};
181
   chm_enumerate(c,CHM_ENUMERATE_ALL,_extract_callback_dir,(void *)&data);
212
   chm_enumerate(c,CHM_ENUMERATE_ALL,_extract_callback_dir,(void *)&data);
182
@@ -193,7 +267,11 @@
213
   return 0;
214
 }
215
 
216
-int _print_ui(struct chmFile *c, struct chmUnitInfo *ui, void *context)
217
+int _print_ui(struct chmFile *c __unused,
218
+		struct chmUnitInfo *ui,
219
+		void *context __unused)
220
 {
221
   char target[CHM_MAX_PATHLEN*2+1];
183
   wchar_t temp[CHM_MAX_PATHLEN+1];
222
   wchar_t temp[CHM_MAX_PATHLEN+1];
184
 
223
 
185
   decode_UTF8(temp,ui->path);
224
   decode_UTF8(temp,ui->path);
Lines 191-197 Link Here
191
 
230
 
192
   if ((target)[0] == '/')
231
   if ((target)[0] == '/')
193
   {
232
   {
194
@@ -243,6 +321,9 @@
233
-    printf("%12.12u ",ui->length);
234
+    printf("%12.12llu ",ui->length);
235
     printf("%s\n",target);
236
   }
237
   else
238
   {
239
-    printf("%12.12u ",ui->length);
240
+    printf("%12.12llu ",ui->length);
241
     printf("/");
242
     printf("%s\n",target);
243
   }
244
@@ -231,8 +327,6 @@
245
   struct chmFile *c;
246
   char *infname;
247
   char *command;
248
-  FILE *fh;
249
-  int i;
250
   struct chmUnitInfo ui;
251
 
252
   if (argc < 3)
253
@@ -243,6 +337,9 @@
195
 
254
 
196
   infname = argv[2];
255
   infname = argv[2];
197
 
256
 
Lines 201-207 Link Here
201
   c = chm_open(infname);
260
   c = chm_open(infname);
202
   if (!c)
261
   if (!c)
203
     exit(-1);
262
     exit(-1);
204
@@ -265,7 +346,7 @@
263
@@ -265,7 +362,7 @@
205
       char target[CHM_MAX_PATHLEN*2+1];
264
       char target[CHM_MAX_PATHLEN*2+1];
206
       wchar_t temp[CHM_MAX_PATHLEN+1];
265
       wchar_t temp[CHM_MAX_PATHLEN+1];
207
       int status;
266
       int status;
Lines 210-216 Link Here
210
 
269
 
211
       if (argc == 4)
270
       if (argc == 4)
212
       {
271
       {
213
@@ -305,7 +386,11 @@
272
@@ -305,7 +402,11 @@
214
             strcat(target,name+1);
273
             strcat(target,name+1);
215
           else
274
           else
216
             strcat(target,name);
275
             strcat(target,name);

Return to bug 165287