From owner-freebsd-ports-bugs@FreeBSD.ORG Wed Feb 21 14:40:04 2007 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3E87616D6F4 for ; Wed, 21 Feb 2007 14:40:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id 1B3E813C4A8 for ; Wed, 21 Feb 2007 14:40:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l1LEe3V4058558 for ; Wed, 21 Feb 2007 14:40:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l1LEe3jE058555; Wed, 21 Feb 2007 14:40:03 GMT (envelope-from gnats) Resent-Date: Wed, 21 Feb 2007 14:40:03 GMT Resent-Message-Id: <200702211440.l1LEe3jE058555@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Ivan Petrov Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0014916DF98 for ; Wed, 21 Feb 2007 14:39:11 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [69.147.83.33]) by mx1.freebsd.org (Postfix) with ESMTP id E413413C471 for ; Wed, 21 Feb 2007 14:39:11 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l1LEdB46001429 for ; Wed, 21 Feb 2007 14:39:11 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id l1LEdB4N001428; Wed, 21 Feb 2007 14:39:11 GMT (envelope-from nobody) Message-Id: <200702211439.l1LEdB4N001428@www.freebsd.org> Date: Wed, 21 Feb 2007 14:39:11 GMT From: Ivan Petrov To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.0 Cc: Subject: ports/109393: update converters/chmview X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2007 14:40:04 -0000 >Number: 109393 >Category: ports >Synopsis: update converters/chmview >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Feb 21 14:40:03 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Ivan Petrov >Release: >Organization: >Environment: >Description: update converters/chmview to latest version >How-To-Repeat: >Fix: Patch attached with submission follows: Index: converters/chmview/Makefile @@ -6,30 +6,26 @@ # PORTNAME= chmview -PORTVERSION= 1.0 +PORTVERSION= 2.0b3 PORTREVISION= 2 CATEGORIES= converters textproc -MASTER_SITES= http://trexinc.narod.ru/myprogs/files/ -DISTNAME= chmview +MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} +MASTER_SITE_SUBDIR= trexinc +DISTNAME= "CHMView_${PORTVERSION}" MAINTAINER= alexs@snark.rinet.ru COMMENT= Extractor from .chm files USE_ZIP= yes +USE_DOS2UNIX= yes WRKSRC= ${WRKDIR}/src PLIST_FILES= bin/chmview -PORTDOCS= chmformat.html pre-patch: - @${SH} ${FILESDIR}/convert.sh ${WRKSRC} @${CP} ${FILESDIR}/Makefile ${WRKSRC} do-install: @${INSTALL_PROGRAM} ${WRKSRC}/chmview ${PREFIX}/bin/ -.if !defined(NOPORTDOCS) - -@${MKDIR} ${DOCSDIR} - @${INSTALL_DATA} ${WRKSRC}/${PORTDOCS} ${DOCSDIR}/ -.endif .include Index: converters/chmview/files/Makefile @@ -5,18 +5,19 @@ EXEDIR = . EXENAME = $(EXEDIR)/chmview -CFLAGS += -g -LFLAGS += -g +CFLAGS += -DUNIX all: $(EXENAME) OBJS = $(OBJDIR)/chmview.o \ - $(OBJDIR)/chmlib.o \ + $(OBJDIR)/chm_lib.o \ + $(OBJDIR)/utf8.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 +$(OBJDIR)/chmview.o: chmview.c chm_lib.h +$(OBJDIR)/chm_lib.o: chm_lib.c chm_lib.h lzx.h +$(OBJDIR)/lzx.o: lzx.c lzx.h +$(OBJDIR)/utf8.o: utf8.c utf8.h .c.o: $(CC) $(CFLAGS) -c ${.IMPSRC} Index: converters/chmview/files/patch-aa @@ -1,9 +1,180 @@ -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); +--- ../src/chmview.c ++++ chmview.c.new +@@ -17,16 +17,30 @@ + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ - void chm_close(chmfile *l); ++#ifndef UNIX + #include ++#endif + -+#define MODE 0755 + #include + #include + #include + #include ++ ++#ifdef UNIX ++#include ++#include ++#else + #include ++#endif + + #include "chm_lib.h" + #include "utf8.h" + ++#ifdef UNIX ++#define _strnicmp strncasecmp ++#define MODE 755 ++#endif ++ + struct cb_data + { + int extractwithoutpath; +@@ -44,6 +58,7 @@ + return p; + } + ++#ifndef UNIX + int makedir(char *path) + { + char *end; +@@ -75,6 +90,39 @@ + } + 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"); ++ exit(1); ++ /* return 0; */ ++ } ++ ++ return 1; ++} ++#endif + + const char ILLEGAL_SYMB[] = "<>:|?*\""; + const char ILLEGAL_REPL[] = "()_!__'"; +@@ -103,6 +151,9 @@ + char fullpath[CHM_MAX_PATHLEN*2+1]; + char target[CHM_MAX_PATHLEN*2+1]; + wchar_t temp[CHM_MAX_PATHLEN+1]; ++#ifdef UNIX ++ size_t pathlen; ++#endif + + if (ui->length) + { +@@ -116,13 +167,32 @@ + return -1; + } + } ++#ifndef UNIX + GetCurrentDirectory(sizeof(fullpath)-1,fullpath); + while ((p = strstr(fullpath,"\\")) != NULL) + *p = '/'; + if (fullpath[strlen(fullpath)-1] != '/') + strcat(fullpath,"/"); ++#else ++ getcwd(fullpath, sizeof(fullpath)-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; ++ } ++#endif + decode_UTF8(temp,ui->path); ++#ifndef UNIX + WideCharToMultiByte(CP_ACP,0,temp,-1,target,sizeof(target),NULL,NULL); ++#else ++ wcstombs(target, temp, sizeof(target)); ++#endif + ReplaceIllegalChars(target); + strcat(fullpath,extractwithoutpath?pointtoname(target):(target[0]=='/'?target+1:target)); + if (!extractwithoutpath) +@@ -153,15 +223,19 @@ + wchar_t temp[CHM_MAX_PATHLEN+1]; + + decode_UTF8(temp,ui->path); ++#ifndef UNIX + WideCharToMultiByte(CP_OEMCP,0,temp,-1,target,sizeof(target),NULL,NULL); ++#else ++ wcstombs(target, temp, sizeof(target)); ++#endif + printf("Extracting %s ",target); + if (savetofile(c, ui, extractwithoutpath)) + { + printf("Error\n"); + error=1; + //return CHM_ENUMERATOR_FAILURE; +- } +- printf("OK\n"); ++ } else ++ printf("OK\n"); + } + + int _extract_callback_all(struct chmFile *c, struct chmUnitInfo *ui, void *context) +@@ -193,7 +267,11 @@ + wchar_t temp[CHM_MAX_PATHLEN+1]; + + decode_UTF8(temp,ui->path); ++#ifndef UNIX + WideCharToMultiByte(CP_OEMCP,0,temp,-1,target,sizeof(target),NULL,NULL); ++#else ++ wcstombs(target, temp, sizeof(target)); ++#endif + + if ((target)[0] == '/') + { +@@ -243,6 +321,9 @@ + + infname = argv[2]; + ++#ifdef UNIX ++ setlocale(LC_ALL,""); ++#endif + c = chm_open(infname); + if (!c) + exit(-1); +@@ -305,7 +386,11 @@ + strcat(target,name+1); + else + strcat(target,name); ++#ifndef UNIX + MultiByteToWideChar(CP_ACP,0,target,-1,temp,sizeof(temp)); ++#else ++ mbstowcs(temp, target, sizeof(target)); ++#endif + encode_UTF8(target,temp); + status = chm_resolve_object(c,target,&ui); + if (status==CHM_RESOLVE_SUCCESS && ui.path[strlen(ui.path)-1]!='/') Index: converters/chmview/files/patch-ab @@ -1,95 +0,0 @@ -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)) Index: converters/chmview/files/convert.sh @@ -1,20 +0,0 @@ -#!/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 - Index: converters/chmview/distinfo @@ -1,3 +1,3 @@ -MD5 (chmview.zip) = 8b9dcae298aeda972d4b5ab56af466f0 -SHA256 (chmview.zip) = c26d24ddb6be98b73f9e472d1c478462ba1c6fa59a3e49c697eb08955c35bb27 -SIZE (chmview.zip) = 66764 +MD5 (CHMView_2.0b3.zip) = ebe6b61bcf08672348b608969206e9a2 +SHA256 (CHMView_2.0b3.zip) = d9cd81b1f5a1851e2ea47f6e6b7dd6ba76578fcd26c8d636df2d80be4a050adf +SIZE (CHMView_2.0b3.zip) = 50891 >Release-Note: >Audit-Trail: >Unformatted: