From 6571dcf3dd0175d02c15e6647c3cd7981ed95b10 Mon Sep 17 00:00:00 2001 From: Max Khon Date: Sat, 19 Apr 2003 14:18:50 +0000 Subject: New port: chmview Chmview is a simple program to decompose .chm-file to the components. PR: 50433 Submitted by: Alex Semenyaka --- converters/chmview/Makefile | 31 ++++++++++++ converters/chmview/distinfo | 1 + converters/chmview/files/Makefile | 28 +++++++++++ converters/chmview/files/convert.sh | 20 ++++++++ converters/chmview/files/patch-aa | 9 ++++ converters/chmview/files/patch-ab | 95 +++++++++++++++++++++++++++++++++++++ converters/chmview/pkg-descr | 5 ++ converters/chmview/pkg-plist | 2 + 8 files changed, 191 insertions(+) create mode 100644 converters/chmview/Makefile create mode 100644 converters/chmview/distinfo create mode 100644 converters/chmview/files/Makefile create mode 100644 converters/chmview/files/convert.sh create mode 100644 converters/chmview/files/patch-aa create mode 100644 converters/chmview/files/patch-ab create mode 100644 converters/chmview/pkg-descr create mode 100644 converters/chmview/pkg-plist (limited to 'converters/chmview') 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 +# +# $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 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 + #include + #include +-#include + #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 -- cgit v1.2.3