aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--converters/Makefile1
-rw-r--r--converters/chmview/Makefile31
-rw-r--r--converters/chmview/distinfo1
-rw-r--r--converters/chmview/files/Makefile28
-rw-r--r--converters/chmview/files/convert.sh20
-rw-r--r--converters/chmview/files/patch-aa9
-rw-r--r--converters/chmview/files/patch-ab95
-rw-r--r--converters/chmview/pkg-descr5
-rw-r--r--converters/chmview/pkg-plist2
9 files changed, 192 insertions, 0 deletions
diff --git a/converters/Makefile b/converters/Makefile
index 8a4dd9352d2d..e78bbf6e7e89 100644
--- a/converters/Makefile
+++ b/converters/Makefile
@@ -4,6 +4,7 @@
SUBDIR += aish
SUBDIR += base64
SUBDIR += btoa
+ SUBDIR += chmview
SUBDIR += cn2jp
SUBDIR += dosunix
SUBDIR += dumpasn1
diff --git a/converters/chmview/Makefile b/converters/chmview/Makefile
new file mode 100644
index 000000000000..ac1a495d31f8
--- /dev/null
+++ b/converters/chmview/Makefile
@@ -0,0 +1,31 @@
+# New ports collection makefile for: chmview
+# Date created: Apr 19 2003
+# Whom: Alex Semenyaka <alex@rinet.ru>
+#
+# $FreeBSD$
+#
+
+PORTNAME= chmview
+PORTVERSION= 1.0
+CATEGORIES= converters textproc
+MASTER_SITES= http://trexinc.narod.ru/myprogs/files/
+DISTNAME= chmview
+
+MAINTAINER= alexs@snark.rinet.ru
+COMMENT= Extractor from .chm files
+
+USE_ZIP= yes
+
+WRKSRC= ${WRKDIR}/src
+
+pre-patch:
+ @${SH} ${FILESDIR}/convert.sh ${WRKSRC}
+ @${CP} ${FILESDIR}/Makefile ${WRKSRC}
+
+do-install:
+ -@${MKDIR} ${PREFIX}/bin
+ @${INSTALL_PROGRAM} ${WRKSRC}/chmview ${PREFIX}/bin/chmview
+ -@${MKDIR} ${DOCSDIR}
+ @${INSTALL_DATA} ${WRKSRC}/chmformat.html ${DOCSDIR}
+
+.include <bsd.port.mk>
diff --git a/converters/chmview/distinfo b/converters/chmview/distinfo
new file mode 100644
index 000000000000..3b728f6eac2b
--- /dev/null
+++ b/converters/chmview/distinfo
@@ -0,0 +1 @@
+MD5 (chmview.zip) = 8b9dcae298aeda972d4b5ab56af466f0
diff --git a/converters/chmview/files/Makefile b/converters/chmview/files/Makefile
new file mode 100644
index 000000000000..ba2ef5f64d94
--- /dev/null
+++ b/converters/chmview/files/Makefile
@@ -0,0 +1,28 @@
+#
+# $FreeBSD$
+#
+OBJDIR = .
+EXEDIR = .
+EXENAME = $(EXEDIR)/chmview
+
+CFLAGS += -g
+LFLAGS += -g
+
+CC = gcc
+
+all: $(EXENAME)
+
+OBJS = $(OBJDIR)/chmview.o \
+ $(OBJDIR)/chmlib.o \
+ $(OBJDIR)/lzx.o
+
+$(OBJDIR)/chmview.o: chmview.c chmlib.h
+$(OBJDIR)/chmlib.o: chmlib.c chmlib.h fixendian.h lzx.h
+$(OBJDIR)/lzx.o: lzx.c lzx.h lzx_int.h
+
+.c.o:
+ $(CC) $(CFLAGS) -c ${.IMPSRC}
+
+$(EXENAME): $(OBJS)
+ echo $(OBJS)
+ $(CC) $(LFLAGS) -o $(EXENAME) ${.ALLSRC}
diff --git a/converters/chmview/files/convert.sh b/converters/chmview/files/convert.sh
new file mode 100644
index 000000000000..d2a0192f09a2
--- /dev/null
+++ b/converters/chmview/files/convert.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+if [ X$1 = X ]
+then
+ exit 0
+fi
+
+if ! cd $1
+then
+ exit 1
+fi
+
+rm makefile
+
+for FILE in *
+do
+ tr -d '\r' <${FILE} >${FILE}.NEW
+ mv ${FILE}.NEW ${FILE}
+done
+
diff --git a/converters/chmview/files/patch-aa b/converters/chmview/files/patch-aa
new file mode 100644
index 000000000000..2420b1ae8087
--- /dev/null
+++ b/converters/chmview/files/patch-aa
@@ -0,0 +1,9 @@
+diff -r -u ../src/chmlib.h ./chmlib.h
+--- ../src/chmlib.h Sun Dec 1 01:26:02 2002
++++ ./chmlib.h Fri Mar 28 17:40:39 2003
+@@ -129,3 +129,5 @@
+ chmfile *chm_openfile(char *fname);
+
+ void chm_close(chmfile *l);
++
++#define MODE 0755
diff --git a/converters/chmview/files/patch-ab b/converters/chmview/files/patch-ab
new file mode 100644
index 000000000000..8ea84981592b
--- /dev/null
+++ b/converters/chmview/files/patch-ab
@@ -0,0 +1,95 @@
+diff -r -u ../src/chmview.c ./chmview.c
+--- ../src/chmview.c Fri Mar 28 20:59:31 2003
++++ ./chmview.c Fri Mar 28 19:01:39 2003
+@@ -3,9 +3,7 @@
+ #include <limits.h>
+ #include <errno.h>
+ #include <string.h>
+-#include <dir.h>
+ #include "chmlib.h"
+-#define PATH_MAX 512
+
+ static char *pointtoname(char *path)
+ {
+@@ -15,6 +13,7 @@
+ return p;
+ }
+
++#if 0
+ static int makedir(char *path)
+ {
+ char *end;
+@@ -47,6 +46,38 @@
+ }
+ return 1;
+ }
++#else
++static int makedir(char *path)
++{
++ char *slash;
++ int was_error, done, err;
++
++ slash = path;
++ done = 0;
++ was_error = 0;
++
++ do {
++ slash = index(slash + 1, '/');
++ if (slash)
++ {
++ *slash = 0;
++ if (mkdir(path, MODE) == -1 && EEXIST != errno)
++ was_error = 1;
++ *slash = '/';
++ }
++ else
++ done = 1;
++ } while (! done && ! was_error);
++
++ if (was_error)
++ {
++ perror("mkdir");
++ return 0;
++ }
++
++ return 1;
++}
++#endif
+
+ static int savetofile(chmfile *c, char *target, int extractwithoutpath)
+ {
+@@ -55,18 +86,25 @@
+ char *rtarget;
+ char *p;
+ FILE *f;
+- char path[PATH_MAX];
+- char fullpath[PATH_MAX];
++ char fullpath[PATH_MAX + 1];
++ size_t pathlen;
+
+ if (chm_getfile(c, target, &length, &outbuf) != 0)
+ return 1;
+- getcurdir(0,path);
+- fullpath[0]=getdisk()+'A'; fullpath[1]=':'; fullpath[2]='/'; fullpath[3]='\0';
+- strcat(fullpath,path);
+- while ((p = strstr(fullpath,"\\")) != NULL)
+- *p = '/';
+- if (fullpath[strlen(fullpath)-1] != '/')
+- strcat(fullpath,"/");
++
++ getcwd(fullpath,PATH_MAX-1);
++ pathlen = strlen(fullpath);
++ if (pathlen == 0)
++ return -1; /* impossible but... defensive programming */
++ if (fullpath[pathlen - 1] != '/')
++ {
++ if (pathlen == PATH_MAX)
++ return -1;
++ else
++ fullpath[pathlen] = '/';
++ fullpath[pathlen+1] = 0;
++ }
++
+ strcat(fullpath,extractwithoutpath?pointtoname(target):target+1);
+ if (!extractwithoutpath)
+ if (!makedir(fullpath))
diff --git a/converters/chmview/pkg-descr b/converters/chmview/pkg-descr
new file mode 100644
index 000000000000..550b04ad7f84
--- /dev/null
+++ b/converters/chmview/pkg-descr
@@ -0,0 +1,5 @@
+Chmview is a simple program to decompose .chm-file to the
+components. Originally it was written for MS Windows to work
+in conjunction with Far filemanager.
+
+WWW: http://trexinc.narod.ru
diff --git a/converters/chmview/pkg-plist b/converters/chmview/pkg-plist
new file mode 100644
index 000000000000..f4153fd2a17c
--- /dev/null
+++ b/converters/chmview/pkg-plist
@@ -0,0 +1,2 @@
+bin/chmview
+share/doc/chmview/chmformat.html