summaryrefslogtreecommitdiff
path: root/textproc
diff options
context:
space:
mode:
authoragc <agc@pkgsrc.org>2001-05-23 15:47:43 +0000
committeragc <agc@pkgsrc.org>2001-05-23 15:47:43 +0000
commitfd90718b4c4025a9f58f6be925de54a3ef7ccdbe (patch)
tree74a6a5f6bcbc7f37aa5b430146aeb7285e390ad2 /textproc
parentc949b5f94e5d5b11f07596400d123537584ef926 (diff)
downloadpkgsrc-fd90718b4c4025a9f58f6be925de54a3ef7ccdbe.tar.gz
Initial import of helpdeco-21 into the packages collection.
Provided by Ben Collver (collver@linuxfreemail.com) in PR 12927 helpdeco is a windows .hlp to RTF converter.
Diffstat (limited to 'textproc')
-rw-r--r--textproc/helpdeco/Makefile59
-rw-r--r--textproc/helpdeco/distinfo9
-rw-r--r--textproc/helpdeco/files/Makefile14
-rw-r--r--textproc/helpdeco/files/compat.c121
-rw-r--r--textproc/helpdeco/files/compat.h35
-rw-r--r--textproc/helpdeco/files/helpdeco-de.txt237
-rw-r--r--textproc/helpdeco/files/helpdeco-en.txt222
-rw-r--r--textproc/helpdeco/patches/patch-aa94
-rw-r--r--textproc/helpdeco/patches/patch-ab33
-rw-r--r--textproc/helpdeco/patches/patch-ac37
-rw-r--r--textproc/helpdeco/patches/patch-ad401
-rw-r--r--textproc/helpdeco/patches/patch-ae28
-rw-r--r--textproc/helpdeco/pkg/DESCR2
-rw-r--r--textproc/helpdeco/pkg/PLIST8
14 files changed, 1300 insertions, 0 deletions
diff --git a/textproc/helpdeco/Makefile b/textproc/helpdeco/Makefile
new file mode 100644
index 00000000000..49b583025a9
--- /dev/null
+++ b/textproc/helpdeco/Makefile
@@ -0,0 +1,59 @@
+# $NetBSD: Makefile,v 1.1.1.1 2001/05/23 15:47:43 agc Exp $
+#
+
+DISTNAME= helpdc21
+PKGNAME= helpdeco-21nb1
+CATEGORIES= textproc
+MASTER_SITES= ${MASTER_SITE_SIMTEL:=win95/winhelp/}
+EXTRACT_SUFX= .zip
+
+MAINTAINER= collver@linuxfreemail.com
+HOMEPAGE= http://www.simtel.net/pub/pd/23694.shtml
+COMMENT= windows .hlp to .rtf converter
+
+NO_WRKSUBDIR= yes
+
+LICENSE= no-commercial-use
+
+# from ftp://ftp.simtel.net/pub/simtelnet/MIRRORS.TXT
+MASTER_SITE_SIMTEL+= ftp://ftp.cdrom.com/pub/simtelnet/ \
+ ftp://ftp.datacanyon.com/pub/simtelnet/ \
+ ftp://ftp.digital.com/pub/micro/pc/simtelnet/ \
+ ftp://ftp.usg.edu/pub/mirrors/simtelnet/ \
+ ftp://uiarchive.cso.uiuc.edu/pub/systems/pc/simtelnet/ \
+ ftp://ftp.bu.edu/pub/mirrors/simtelnet/ \
+ ftp://simtel.klondyke.net/simtel/ \
+ ftp://simtelnet.galilei.com/pub/simtelnet/ \
+ ftp://ftp.rge.com/pub/systems/simtelnet/ \
+ ftp://ftp.ou.edu/pub/simtelnet/ \
+ ftp://ftp.orst.edu/pub/simtelnet/ \
+ ftp://ftphost.simtel.net/pub/simtelnet/ \
+ ftp://mirrors.aol.com/pub/simtelnet/ \
+ ftp://ftp.simtel.net/pub/simtelnet/ \
+ ftp://ftp.telusplanet.net/pub/simtelnet/ \
+ ftp://ftp.crc.ca/pub/systems/ibmpc/simtelnet/ \
+ ftp://ftp.direct.ca/pub/simtelnet/
+
+post-extract:
+ ${RM} -f ${WRKSRC}/*exe
+ ${CP} ${FILESDIR}/helpdeco-de.txt \
+ ${FILESDIR}/helpdeco-en.txt \
+ ${FILESDIR}/compat.h \
+ ${FILESDIR}/compat.c \
+ ${WRKSRC}
+ ${SED} "s|PREFIX|${PREFIX}|" \
+ <${FILESDIR}/Makefile \
+ >${WRKSRC}/Makefile
+
+do-install:
+ ${CP} ${WRKSRC}/splitmrb \
+ ${WRKSRC}/zapres \
+ ${WRKSRC}/helpdeco \
+ ${PREFIX}/bin
+ ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/helpdeco
+ ${CP} ${WRKSRC}/helpdeco-de.txt \
+ ${WRKSRC}/helpdeco-en.txt \
+ ${WRKSRC}/helpfile.txt \
+ ${PREFIX}/share/doc/helpdeco
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/textproc/helpdeco/distinfo b/textproc/helpdeco/distinfo
new file mode 100644
index 00000000000..86f73a5426d
--- /dev/null
+++ b/textproc/helpdeco/distinfo
@@ -0,0 +1,9 @@
+$NetBSD: distinfo,v 1.1.1.1 2001/05/23 15:47:43 agc Exp $
+
+SHA1 (helpdc21.zip) = 1a6ca50acb3783674a225764066cd90307806552
+Size (helpdc21.zip) = 222217 bytes
+SHA1 (patch-aa) = 8890da60f28a678714d7d4c8d8140940b122557e
+SHA1 (patch-ab) = 43cb2836955c1541d7d3f57ec9b21ce285ab1c72
+SHA1 (patch-ac) = a40ce0a49631ea0d03f4f51f5c12d253d19cd282
+SHA1 (patch-ad) = 7416d09c01df45b8b5fa903d69e77e1b3f204e95
+SHA1 (patch-ae) = 2dd709c96ae22671cfc38892c093f544544ce810
diff --git a/textproc/helpdeco/files/Makefile b/textproc/helpdeco/files/Makefile
new file mode 100644
index 00000000000..dae9618d752
--- /dev/null
+++ b/textproc/helpdeco/files/Makefile
@@ -0,0 +1,14 @@
+all: splitmrb zapres helpdeco
+
+CFLAGS+=-g
+
+splitmrb: splitmrb.c
+ ${CC} ${CFLAGS} -o splitmrb splitmrb.c
+zapres: zapres.c compat.o
+ ${CC} ${CFLAGS} -o zapres zapres.c compat.o
+helpdeco: helpdeco.c helpdec1.c compat.o
+ ${CC} ${CFLAGS} -o helpdeco helpdeco.c helpdec1.c compat.o
+compat.o: compat.c
+
+clean:
+ rm -f *.o helpdeco zapres splitmrb
diff --git a/textproc/helpdeco/files/compat.c b/textproc/helpdeco/files/compat.c
new file mode 100644
index 00000000000..39f1b3d31ab
--- /dev/null
+++ b/textproc/helpdeco/files/compat.c
@@ -0,0 +1,121 @@
+#include <ctype.h>
+#include <libgen.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <termios.h>
+#include "compat.h"
+
+void _splitpath(
+ const char *path,
+ char *drive,
+ char *dir,
+ char *file,
+ char *ext)
+{
+ char *p;
+ char *t;
+
+ if (path == NULL)
+ return;
+
+ if (drive != NULL)
+ strcpy(drive, "");
+
+ if (dir != NULL) {
+ p = strdup(path);
+ strncpy(dir, strdup(dirname(p)), _MAX_DIR);
+ free(p);
+ }
+
+ if (ext != NULL) {
+ p = strdup(path);
+ t = strrchr(basename(p), '.');
+ if (t == NULL) {
+ strcpy(ext, "");
+ } else {
+ strncpy(ext, strdup(t), _MAX_EXT);
+ }
+ free(p);
+ }
+
+ if (file != NULL) {
+ p = strdup(path);
+ t = strrchr(p, '.');
+ if (t != NULL && strchr(t, '/') == NULL) {
+ *t = '\000';
+ }
+ strncpy(file, strdup(basename(p)), _MAX_FNAME);
+ free(p);
+ }
+
+ return;
+}
+
+void _makepath(
+ char *path,
+ const char *drive,
+ const char *dir,
+ const char *file,
+ const char *ext)
+{
+ snprintf(path, _MAX_PATH, "%s%s/%s%s",
+ drive,
+ dir,
+ file,
+ ext);
+ return;
+}
+
+int getch(void)
+{
+ int retval;
+ struct termios stored_settings;
+ struct termios new_settings;
+
+ tcgetattr(0, &stored_settings);
+ new_settings = stored_settings;
+ new_settings.c_lflag &= (~(ECHO|ICANON));
+ new_settings.c_cc[VTIME] = 0;
+ new_settings.c_cc[VMIN] = 1;
+ tcsetattr(0, TCSANOW, &new_settings);
+
+ retval = getchar();
+
+ tcsetattr(0, TCSANOW, &stored_settings);
+
+ return retval;
+}
+
+int memcmpi(
+ const void *s1,
+ const void *s2,
+ size_t len)
+{
+ char *p1 = strdup(s1);
+ char *p2 = strdup(s2);
+ int i;
+
+ for (i = 0; i < len; i++) {
+ if (p1[i] == '\000') p1[i] = ' ';
+ if (p2[i] == '\000') p2[i] = ' ';
+ }
+ i = strncasecmp(p1, p2, len);
+ free(p1);
+ free(p2);
+ return i;
+}
+
+char *strupr(char *s)
+{
+ char *p;
+ while (*p != '\000') *p = toupper(*p++);
+ return s;
+}
+
+char *strlwr(char *s)
+{
+ char *p;
+ while (*p != '\000') *p = tolower(*p++);
+ return s;
+}
diff --git a/textproc/helpdeco/files/compat.h b/textproc/helpdeco/files/compat.h
new file mode 100644
index 00000000000..3fe5872b9fb
--- /dev/null
+++ b/textproc/helpdeco/files/compat.h
@@ -0,0 +1,35 @@
+#ifndef __compat_h__
+#define __compat_h__
+
+#include <strings.h>
+
+#define stricmp strcasecmp
+#define strcmpi strcasecmp
+#define memicmp memcmpi
+
+#ifndef _MAX_DIR
+#define _MAX_DIR 256
+#endif
+#ifndef _MAX_EXT
+#define _MAX_EXT 256
+#endif
+#ifndef _MAX_DRIVE
+#define _MAX_DRIVE 3
+#endif
+#ifndef _MAX_FNAME
+#define _MAX_FNAME 256
+#endif
+#ifndef _MAX_PATH
+#define _MAX_PATH 260
+#endif
+#ifndef MAX_PATH
+#define MAX_PATH _MAX_PATH
+#endif
+
+void _splitpath(const char *, char *, char *, char *, char *);
+void _makepath(char *, const char *, const char *, const char *, const char *);
+int getch(void);
+int memcmpi(const void *, const void *, size_t);
+char *strupr(char *);
+char *strlwr(char *);
+#endif
diff --git a/textproc/helpdeco/files/helpdeco-de.txt b/textproc/helpdeco/files/helpdeco-de.txt
new file mode 100644
index 00000000000..e283dedc758
--- /dev/null
+++ b/textproc/helpdeco/files/helpdeco-de.txt
@@ -0,0 +1,237 @@
+HELPDECO - Utility-Programm zum Zerlegen von Windows Hilfedateien
+
+HELPDECO zerlegt HLP-Hilfedateien von Windows 3.0, 3.1, 3.11 und '95 und
+viele MVB-Dateien des Multimedia-Viewers in alle fr den jeweiligen
+Hilfecompiler HC30, HC31, HCP, HCW, HCRTF, WMVC, MMVC oder MVC zum
+erneuten Zusammenbau erforderlichen Dateien. Dazu geh”ren:
+HPJ - die Projektdatei, als Parameter fr den Hilfecompiler anzugeben
+MVP - die Multimediaprojektdatei, als Parameter fr den MM-Compiler
+RTF - die Textdatei mit dem gesamten Hilfetext und allen Fuánoten
+PH - die Phrasen-Datei (wie sie auch vom Hilfecompiler erzeugt wird)
+ICO - ein eventuell der Hilfedatei zugeordnetes Icon
+BMP/WMF/SHG/MRB - alle Bilder in Dateien mit passendem Format
+Baggage - alle als Baggage in der Hilfedatei enthaltenen Dateien
+
+HELPDECO wird von der MS-DOS Kommandozeile aus mit dem Namen der zu
+bearbeitenden Datei, eventuell dem Namen einer internen Datei und
+eventuellen Optionen aufgerufen. HELPDECO l„uft von der Kommandozeile
+von Windows 95 oder Windows NT als 32-bit Applikation zur Bearbeitung
+grӇerer Hilfedateien.
+
+HELPDECO
+Zeigt Benutzungshinweise
+
+HELPDECO helpfilename
+Zerlegt die Hilfedatei in alle zum erneuten Zusammenbau ben”tigten Dateien.
+Diese Dateien werden im aktuellen (m”glichst leeren) Verzeichnis abgelegt.
+Existierende Dateien werden ohne Rckfrage berschrieben wenn die Option /y
+angegeben wird.
+
+Hinter dem Kommando k”nnen durch Leerzeichen abgesetzte Optionen angeben
+werden:
+
+/m
+kann verwendet werden, um das Durchsuchen von macros nach Topicnamen zu
+verhindern, wenn dabei Probleme auftreten. Hilfecompiler wird Warnung 4131
+melden.
+
+/b
+kann verwendet werden, um das Aufl”sen von Browse-Sequenzen zu verhindern,
+wenn dabei Probleme auftreten. Hilfequelltextdatei enth„lt dann keine +
+Fuánoten.
+
+/g
+Schaltet das zeitintensive Raten von Kontextnamen aus. Anzuwenden wenn
+HELPDECO 'no context ids found' meldet oder man nicht an lesbaren
+Kontextnamen interessiert ist. Die Funktionsweise von HELPDECO wird dadurch
+nicht beeintr„chtigt.
+Zum Raten versucht HELPDECO aus Kapitelberschriften und Schlsselw”rten
+die Kontextnamen zu rekonstruieren, was bei einigen Hilfedateien sehr gut,
+bei anderen gar nicht funktioniert, je nach Hilfedateierstellungswerkzeug
+oder Arbeitsmethode des Hilfeautors.
+
+/i
+Wenn man sehen m”chte, welche Kontextnamen HELPDECO err„t...
+
+/hprefix
+HELPDECO versucht aus Kapitelberschriften und Schlsselw”rtern Kontextnamen
+zu erraten, wobei auch idh_ oder helpid_ vorangestellt werden.
+Wenn die Hilfedatei mit anderen bekannten Prefixen erstellt wurde, kann
+die Tabelle durch die Option /h prefix erweitert werden.
+
+/a [annotationfilename.ANN]
+Fgt zus„tzlich alle Anmerkungen aus der angegebenen Anmerkungsdatei als
+Anmerkungen des Benutzers ANN in die RTF-Datei ein. Fehlt der annotation-
+filename, verwendet HELPDECO helpfilename.ANN dafr.
+
+/s n
+Zerteilt die Ausgabe alle n Seiten in eine eigene RTF Datei, z.B. zerlegt
+ HELPDECO helpdemo /s 100
+die Datei helpdemo.hlp und erzeugt RTF-Dateien mit den Namen helpdem1.rtf,
+helpdem2.rtf,.. die jeweils h”chstens 100 Seiten enthalten.
+
+HELPDECO helpfilename /r
+Erzeugt aus der Hilfedatei eine RTF-Datei, die von WinWord geladen dasselbe
+Aussehen hat wie die von WinHelp angezeigten Hilfeseiten. Damit kann eine
+Hilfedatei komplett gedruckt oder weiterverarbeitet werden. Zus„tzlich
+Option /n angeben, wenn an Kapitelgrenzen kein Seitenwechsel stattfinden soll.
+
+HELPDECO helpfilename /c
+Erzeugt aus der Hilfedatei eine *.CNT-Datei fr WinHlp32, die alle Kapitel
+mit šberschriften in der Reihenfolge enth„lt, in der sie in der Hilfedatei
+auftreten. Die Datei muá dann mit HCW 4.00 oder einem Texteditor in eine
+hierarchische Struktur berarbeitet werden.
+
+HELPDECO helpfilename /e
+Zeigt alle Referenzen auf externe Hilfedateien.
+
+HELPDECO helpfilename /e /f
+Zeigt alle Referenzen auf externe Hilfedateien und die Titel der Topics in
+denen sie auftraten.
+
+HELPDECO helpfilename /p
+Prft Referenzen auf externe Hilfedateien. Die referenzierten Hilfedateien
+mssen fr HELPDECO zugreifbar sein. Dieser Aufruf erzeugt keine neuen
+Dateien und modifiziert keine existierenden. Fehler werden auf stdout (den
+Bildschirm) geschrieben.
+
+HELPDECO helpfilename /d
+Zeigt das interne Inhaltsverzeichnis der Hilfedatei. Es kann auch eine
+*.MVB,*.M??,*.ANN,*.CAC,*.AUX Datei anstelle der *.HLP-Datei angegeben
+werden.
+
+HELPDECO helpfilename /x
+Zeigt das interne Inhaltsverzeichnis als HexDump
+
+HELPDECO helpfilename "internalfilename"
+Zeigt die genannte interne Datei in einem passenden Format an, soweit die
+interne Datei anzeigbar ist, sonst als HexDump. Sie k”nnen die Ausgabe in
+eine Datei umleiten durch anh„ngen von >outfile.
+
+HELPDECO helpfilename "internalfilename" /x
+Zeigt die genannte interne Datei als HexDump
+
+HELPDECO helpfilename "internalfilename" /x /t offset
+Zeigt die genannte interne Datei als HexDump beginnend bei Position
+offset, der als Dezimalzahl oder mit vorangestelltem 0x als Hexadezimal-
+zahl akzeptiert wird.
+
+HELPDECO helpfilename "internalfilename" filename
+Exportiert die genannte interne Datei in filename
+
+*.ANN, *.CAC, *.AUX
+Diese Dateien sind auch wie Hilfedateien formatiert, HELPDECO kann aber nur
+verwendet werden, um ihr Inhaltsverzeichnis anzuzeigen oder um einzelne
+Dateien anzuzeigen und zu exportieren.
+
+HELPDECO wurde erstellt von
+Manfred Winterhoff, Geschw.-Scholl-Ring 17, 38444 Wolfsburg, Germany
+CIS 100326,2776
+
+Wenn Sie weitere Fragen, Probleme (oder Antworten!) haben, k”nnen Sie
+durch eine EMail an 100326.2776@compuserve.com mit mir in Kontakt treten.
+
+HELPDECO basiert auf HELPDUMP von Pete Davis ver”ffentlicht in:
+The Windows Help File Format, Dr. Dobbs Journal, Sep/Oct 1993
+Thanks to Holger Haase, who did a lot of work on picture file formats.
+And thanks to Jrgen Mller for pointing out 32-bit differences.
+Thanks to Bent Lynggaard for the information on help file free lists
+and his contribution on context id guessing.
+
+HELPFILE.TXT enth„lt eine Beschreibung des Windows Hilfedateiformats
+wie HELPDECO es versteht und weiterer Dateiformate wie MRB/SHG.
+
+Die neueste Version von HELPDECO befindet sich stets in:
+CompuServe: Dr. Dobbs Journal DDJFOR Undocumented Corner HELPDCxx.ZIP
+InterNet: ftp://gmutant.wrlc.org/pub/winhelp
+
+HELPDECO ist Freeware. Der Einsatz erfolgt auf eigene Gefahr. Kein
+Programmteil darf kommerziell verwendet werden. Fr das Kopieren drfen
+keine Gebhren verlangt werden (Sharewarehandel Finger weg).
+
+Die Verwendung von Inhalten zerlegter Hilfedateien kann eine Verletzung
+des Urheberrechtes bedeuten.
+
+Version 2.1:
+macros may contain rtf meta characters
+Win95 topic names may contain (nearly) all characters
+0x8000 in SWin->Maximize allowed
+ForeHelp creates PhrIndex/PhrImage _and_ _empty_ Phrases file
+HCRTF complained about > footnotes before # footnotes
+macro parsing changed again
+
+Version 2.0:
+Guess context ids from titles and keywords based on idea of Bent Lynggaard
+Recompiled 16 bit EXE without register calling convention. BC++ 3.1 bug.
+Doesn't print last (stray) topic of HC30 help files
+Can list entry points into this help file (option /l)
+
+Version 1.9: faster & better than ever...
+changed TopicPos, TopicOffset, Keyword maintenance
+changed unhash to 40 bit integer arithmetic
+fixed keyword footnotes [Bent Lynggaard]
+no [ALIAS] in MVP files
+no hidden text in option /r RTF files
+some changes in font and stylesheet handling
+corrects rounding error of HC31 on negative values
+handles non-underlined topic jumps
+
+Version 1.8: used some spare days to clean up the to-do list...
+better tracking of TopicOffset during decompilation
+lists and checks references to external files, shows referencing topics
+can add annotations from .ANN file to decompiled .RTF file
+fixed bug in handling of pictures containing JumpId-macro hotspots
+changed parsing of macros (3rd attempt to guess what Microsoft did)
+fixed bug in popup/jump to external file / secondary window
+fixed bug in > footnote / |VIOLA internal file handling
+fixed bug in keyword assignment
+now removes LZ77 compression from exported SHGs/MRBs
+recreates Win 95 (HCW 4.00) [MACROS] section from internal |Rose file
+32 bit version available
+handles LANGUAGE, [CHARTAB] and [GROUP] section of media view files
+
+Version 1.7
+removed unneccessary output statement
+
+Version 1.6 can now check references to external help files plus:
+duplicate macro names preceeding picture hotspot info skipped
+does not write Win95 commands to multi-media help project files
+changed unhash to circumvent Microsoft-C++ float rounding error
+handles keywords defined inside topic text
+
+Version 1.5
+fixed static on buffer of TopicName function (affected HC30 files)
+
+Version 1.4 fixes some bugs reported by different users:
+buffer overflow in expanding LZ77&RunLen (byPacked 3) images fixed
+embedded images {bmxwd} larger than 32k supported
+extract topic names from jump into external file if no file specified
+handles more phrases on HCRTF generated (Win95) help files
+Windows 3.1 (HC31) |Phrases always Zeck compressed
+LinkData2 buffer enlarged 1 byte to store trailing NUL character
+
+Version 1.3
+parses examples of {bmc} etc. statements contained in help text correctly
+can now generate a *.CNT content file for Windows 95 / WinHlp32
+Microsoft C: ctype macros (isalnum/isprint) don't work with signed char
+
+Version 1.2 fixes some severe bugs introduced in version 1.1 and:
+tells you which help compiler to use
+collects multiple keyword footnotes into single lines
+handles \r\n in COPYRIGHT
+converts SPC-macro (but only in [CONFIG] section)
+does not generate duplicate MAP-statements if possible
+{button} and {mci,mci_left,mci_right} commands supported
+[BITMAP]-section in HCRTF help files irritated transparent bitmaps
+
+Version 1.1 now supports more features of Win95/HCRTF 4.00/WinHlp32:
+Supports LCID, CHARSET, AUTO-SIZE HEIGHT, CNT, INDEX_SEPARATORS
+Additional Win95 Macros (to extract original topic names)
+[CONFIG:n] of Win95 supported (internal file |CFn)
+Secondary windows with > footnote supported (internal file |VIOLA)
+Transparent bitmaps supported (bmct,bmlt,bmrt)
+Expanded internal limits as HCRTF allows larger items
+Now does RunLen compressed device dependend bitmaps
+Bugs in handling of metafiles removed
+Bug in placement of pack(1) removed
+Parsing of macros changed (is it really better now ?)
diff --git a/textproc/helpdeco/files/helpdeco-en.txt b/textproc/helpdeco/files/helpdeco-en.txt
new file mode 100644
index 00000000000..9e1c56be5a0
--- /dev/null
+++ b/textproc/helpdeco/files/helpdeco-en.txt
@@ -0,0 +1,222 @@
+HELPDECO - utility program to dissect Windows help files
+
+HELPDECO dissects HLP help files of Windows 3.0, 3.1, 3.11, and '95 and
+many MVB multi media viewer titles into all files required for a rebuild
+using the appropriate help compiler HC30, HC31, HCP, HCW, HCRTF, WMVC,
+MMVC or MVC:
+HPJ - help project file, use as parameter when calling help compiler
+MVP - multi media project file, parameter for multi media help compiler
+RTF - text file containing whole content of help file and all footnotes
+PH - phrases file (same as produced by help compiler)
+ICO - icon of help file if embedded
+BMP/WMF/SHG/MRB - embedded pictures in appropriate format
+Baggage - all baggage files contained in help file
+
+Call HELPDECO from MS-DOS command line. Supply name of help file to use,
+optional name of internal file, and options if appropriate.
+HELPDECO runs from Windows 95 or Windows NT command line as 32-bit
+application to handle larger help files.
+
+HELPDECO
+Displays usage
+
+HELPDECO helpfilename
+Decompiles help file into all sources needed for a rebuild. All files are
+created in current directory (should be empty). Existing files will be
+overwritten without asking if option /y was specified.
+
+Options may be appended to the command, separated using blanks, as follows:
+
+/m
+May be used to stop parsing macros for topic names. Help compiler will emit
+Warning 4131.
+
+/b
+May be used to stop resolving browse sequences. Help source file than
+contains no + footnotes.
+
+/g
+Turns off time consuming guessing of context names. Applicable when
+HELPDECO reports 'no context ids found' or when you are not interested in
+legible context ids. This doesn't affect functionality.
+During guessing HELPDECO tries to reconstruct context ids from topic titles
+and keywords. This may produce good results on some help files and no result
+at all on others, depending on autoring tool used or working method of help
+author.
+
+/i
+If you want to see which context ids are guessed by HELPDECO...
+
+/hprefix
+HELPDECO tries to guess context ids from topic titles and keywords, possibly
+prefixed by idh_ or helpid_. If the help file was created using other
+prefixes, they may be added to the table using the /h prefix option.
+
+/a [annotationfilename.ANN]
+Adds all annotations from annotationfile as annotations of user ANN into
+RTF file. Default annotationfilename is helpfilename.ANN.
+
+/s n
+Splits output every n pages into a separate RTF file. For example
+ HELPDECO helpdemo /s 100
+decompiles helpdeco.hlp and creates different RTF files helpdem1.rtf,
+helpdem2.rtf,.. each containing no more than 100 topics.
+
+HELPDECO helpfilename /r
+Converts help file into RTF file of same appearance if loaded into WinWord
+as if displayed by WinHelp. To print or work with complete content. Specify
+additional option /n, if no page breaks should separate topics.
+
+HELPDECO helpfilename /c
+Generates a *.CNT file used by WinHlp32, containing all chapters that have
+titles assigned in the order they appear in the helpfile. This file should
+then be edited using HCW 4.00 or any text editor into a hierarchical order.
+
+HELPDECO helpfilename /e
+Lists all references to external help files.
+
+HELPDECO helpfilename /e /f
+Lists all references to external help files and titles of topics that
+contained these references.
+
+HELPDECO helpfilename /p
+Checks references to external help files. Referenced help file need to be
+available to HELPDECO. This call doesn't produce any new files and doesn't
+modify existing files. Errors are reported to stdout (screen).
+
+HELPDECO helpfilename /d
+Displays internal directory of help file. You may supply a *.MVB,*.M??,
+*.ANN,*.CAC,*.AUX file instead of a *.HLP file.
+
+HELPDECO helpfilename /x
+Displays hex dump of internal directory
+
+HELPDECO helpfilename "internalfilename"
+Displays internal file in appropriate format if known, else hex dump. You
+may redirect output into a file using >outfile.
+
+HELPDECO helpfilename "internalfilename" /x
+Displays hex dump of internal file
+
+HELPDECO helpfilename "internalfilename" /x /t offset
+Displays hex dump of internal file starting at offset, which may be
+specified in decimal or preceeded with 0x in hex.
+
+HELPDECO helpfilename "internalfilename" filename
+Exports internal file into filename
+
+*.ANN, *.CAC, *.AUX
+These files are formatted like helpfiles, but HELPDECO can only be used to
+display their internal directory or display or export internal files.
+
+HELPDECO was written by
+Manfred Winterhoff, Geschw.-Scholl-Ring 17, 38444 Wolfsburg, Germany
+CIS 100326,2776
+
+If you have more questions, problems (or answers!), please feel free to
+send me an EMail to 100326.2776@compuserve.com
+
+HELPDECO is based upon HELPDUMP from Pete Davis published in:
+The Windows Help File Format, Dr. Dobbs Journal, Sep/Oct 1993
+Thanks to Holger Haase, who did a lot of work on picture file formats.
+And thanks to Juergen Mueller for pointing out 32-bit differences.
+Thanks to Bent Lynggaard for the information on help file free lists
+and his contribution on context id guessing.
+
+See HELPFILE.TXT for a description of the Windows help file format
+as parsed by HELPDECO and related file formats like MRB/SHG.
+
+The newest public version of HELPDECO is always available at:
+CompuServe: Dr. Dobbs Journal DDJFOR Undocumented Corner HELPDCxx.ZIP
+InterNet: ftp://gmutant.wrlc.org/pub/winhelp
+
+HELPDECO is freeware. Use at your own risk. No part of the program may be
+used commercially. No fees may be charged on distributing the program
+(shareware distributors keep off).
+
+The use of parts of decompiled help files may constitute a violation of
+copyright law.
+
+Version 2.1:
+macros may contain rtf meta characters
+Win95 topic names may contain (nearly) all characters
+0x8000 in SWin->Maximize allowed
+ForeHelp creates PhrIndex/PhrImage _and_ _empty_ Phrases file
+HCRTF complained about > footnotes before # footnotes
+macro parsing changed again
+
+Version 2.0:
+Guess context ids from titles and keywords based on idea of Bent Lynggaard
+Recompiled 16 bit EXE without register calling convention. BC++ 3.1 bug.
+Doesn't print last (stray) topic of HC30 help files
+Can list entry points into this help file (option /l)
+
+Version 1.9: faster & better than ever...
+changed TopicPos, TopicOffset, Keyword maintenance
+changed unhash to 40 bit integer arithmetic
+fixed keyword footnotes [Bent Lynggaard]
+no [ALIAS] in MVP files
+no hidden text in option /r RTF files
+some changes in font and stylesheet handling
+corrects rounding error of HC31 on negative values
+handles non-underlined topic jumps
+
+Version 1.8: used some spare days to clean up the to-do list...
+better tracking of TopicOffset during decompilation
+lists and checks references to external files, shows referencing topics
+can add annotations from .ANN file to decompiled .RTF file
+fixed bug in handling of pictures containing JumpId-macro hotspots
+changed parsing of macros (3rd attempt to guess what Microsoft did)
+fixed bug in popup/jump to external file / secondary window
+fixed bug in > footnote / |VIOLA internal file handling
+fixed bug in keyword assignment
+now removes LZ77 compression from exported SHGs/MRBs
+recreates Win 95 (HCW 4.00) [MACROS] section from internal |Rose file
+32 bit version available
+handles LANGUAGE, [CHARTAB] and [GROUP] section of media view files
+
+Version 1.7
+removed unneccessary output statement
+
+Version 1.6 can now check references to external help files plus:
+duplicate macro names preceeding picture hotspot info skipped
+does not write Win95 commands to multi-media help project files
+changed unhash to circumvent Microsoft-C++ float rounding error
+handles keywords defined inside topic text
+
+Version 1.5
+fixed static on buffer of TopicName function (affected HC30 files)
+
+Version 1.4 fixes some bugs reported by different users:
+buffer overflow in expanding LZ77&RunLen (byPacked 3) images fixed
+embedded images {bmxwd} larger than 32k supported
+extract topic names from jump into external file if no file specified
+handles more phrases on HCRTF generated (Win95) help files
+Windows 3.1 (HC31) |Phrases always Zeck compressed
+LinkData2 buffer enlarged 1 byte to store trailing NUL character
+
+Version 1.3
+parses examples of {bmc} etc. statements contained in help text correctly
+can now generate a *.CNT content file for Windows 95 / WinHlp32
+Microsoft C: ctype macros (isalnum/isprint) don't work with signed char
+
+Version 1.2 fixes some severe bugs introduced in version 1.1 and:
+tells you which help compiler to use
+collects multiple keyword footnotes into single lines
+handles \r\n in COPYRIGHT
+converts SPC-macro (but only in [CONFIG] section)
+does not generate duplicate MAP-statements if possible
+{button} and {mci,mci_left,mci_right} commands supported
+[BITMAP]-section in HCRTF help files irritated transparent bitmaps
+
+Version 1.1 now supports more features of Win95/HCRTF 4.00/WinHlp32:
+Supports LCID, CHARSET, AUTO-SIZE HEIGHT, CNT, INDEX_SEPARATORS
+Additional Win95 Macros (to extract original topic names)
+[CONFIG:n] of Win95 supported (internal file |CFn)
+Secondary windows with > footnote supported (internal file |VIOLA)
+Transparent bitmaps supported (bmct,bmlt,bmrt)
+Expanded internal limits as HCRTF allows larger items
+Now does RunLen compressed device dependend bitmaps
+Bugs in handling of metafiles removed
+Bug in placement of pack(1) removed
+Parsing of macros changed (is it really better now ?)
diff --git a/textproc/helpdeco/patches/patch-aa b/textproc/helpdeco/patches/patch-aa
new file mode 100644
index 00000000000..1424204f43b
--- /dev/null
+++ b/textproc/helpdeco/patches/patch-aa
@@ -0,0 +1,94 @@
+$NetBSD: patch-aa,v 1.1.1.1 2001/05/23 15:47:45 agc Exp $
+
+--- splitmrb.c.orig Fri Sep 13 00:11:54 1996
++++ splitmrb.c Sat May 12 23:25:04 2001
+@@ -216,14 +216,10 @@
+ int i,l,n;
+ typedef struct
+ {
+- unsigned char c1,c2,c3;
+- unsigned int x,y,w,h;
+- unsigned long hash;
+- }
+- HOTSPOT;
+-#if sizeof(HOTSPOT)!=15
+-#error Compile byte aligned !
+-#endif
++ u_int8_t c1,c2,c3;
++ u_int16_t x,y,w,h;
++ u_int32_t hash;
++ } HOTSPOT __attribute__((packed));
+ HOTSPOT *hotspot;
+ char name[80];
+ char buffer[128];
+@@ -308,7 +304,7 @@
+ while(l>0&&filename[l-1]!='\\'&&filename[l-1]!='/'&&filename[l-1]!=':') l--;
+ m=l;
+ while(filename[l]!='\0'&&filename[l]!='.') l++;
+- if(filename[l]=='\0') strcpy(filename+l,".MRB");
++ if(filename[l]=='\0') strcpy(filename+l,".mrb");
+ f=fopen(filename,"rb");
+ if(!f)
+ {
+@@ -331,7 +327,7 @@
+ fseek(f,offset,SEEK_SET);
+ byType=getc(f); // type of picture: 5=DDB, 6=DIB, 8=METAFILE
+ byPacked=getc(f); // packing method: 0=unpacked, 1=RunLen, 2=LZ77
+- if(byType==6||byType==5&&byPacked<2)
++ if(byType==6||(byType==5&&byPacked<2))
+ {
+ memset(&bmfh,0,sizeof(bmfh));
+ memset(&bmih,0,sizeof(bmih));
+@@ -378,17 +374,17 @@
+ sprintf(filename+l,".%03d",j);
+ if(w==96&&h==48&&!res[0])
+ {
+- strcpy(filename+l,".CGA");
++ strcpy(filename+l,".cga");
+ res[0]=TRUE;
+ }
+ else if(w==96&&h==72&&!res[1])
+ {
+- strcpy(filename+l,".EGA");
++ strcpy(filename+l,".ega");
+ res[1]=TRUE;
+ }
+ else if(w==96&&h==96&&!res[2])
+ {
+- strcpy(filename+l,".VGA");
++ strcpy(filename+l,".vga");
+ res[2]=TRUE;
+ }
+ else if(w==120&&h==120&&!res[3])
+@@ -398,12 +394,12 @@
+ }
+ else if(w==72&&h==72&&!res[4])
+ {
+- strcpy(filename+l,".MAC");
++ strcpy(filename+l,".mac");
+ res[4]=TRUE;
+ }
+ else if(!res[6])
+ {
+- strcpy(filename+l,".BMP");
++ strcpy(filename+l,".bmp");
+ res[6]=TRUE;
+ }
+ fTarget=fopen(filename+m,"wb");
+@@ -472,7 +468,6 @@
+ }
+ else if(byType==8) // Windows MetaFile
+ {
+- APMFILEHEADER afh;
+ unsigned short *wp;
+
+ memset(&afh,0,sizeof(afh));
+@@ -512,7 +507,7 @@
+ for(k=0;k<10;k++) afh.wChecksum^=*wp++;
+ if(!res[5])
+ {
+- strcpy(filename+l,".WMF");
++ strcpy(filename+l,".wmf");
+ res[5]=TRUE;
+ }
+ else
diff --git a/textproc/helpdeco/patches/patch-ab b/textproc/helpdeco/patches/patch-ab
new file mode 100644
index 00000000000..ca050b62abb
--- /dev/null
+++ b/textproc/helpdeco/patches/patch-ab
@@ -0,0 +1,33 @@
+$NetBSD: patch-ab,v 1.1.1.1 2001/05/23 15:47:45 agc Exp $
+
+--- zapres.c.orig Fri Sep 13 20:52:50 1996
++++ zapres.c Sat May 12 23:26:01 2001
+@@ -17,8 +17,9 @@
+
+ #include <stdio.h>
+ #include <stdlib.h>
+-#include <dir.h>
++#include <sys/dir.h>
+ #include <string.h>
++#include "compat.h"
+
+ int backup(FILE *f,char *oldname)
+ {
+@@ -31,7 +32,7 @@
+ int result=0;
+
+ _splitpath(oldname,drive,dir,fname,ext);
+- _makepath(path,drive,dir,fname,".BAK");
++ _makepath(path,drive,dir,fname,".bak");
+ bak=fopen(path,"wb");
+ if(bak)
+ {
+@@ -102,7 +103,7 @@
+ else for(i=1;i<b;i++)
+ {
+ _splitpath(argv[i],drive,dir,fname,ext);
+- if(!ext[0]) strcpy(ext,".BMP");
++ if(!ext[0]) strcpy(ext,".bmp");
+ _makepath(path,drive,dir,fname,ext);
+ f=fopen(path,"r+b");
+ if(f)
diff --git a/textproc/helpdeco/patches/patch-ac b/textproc/helpdeco/patches/patch-ac
new file mode 100644
index 00000000000..7e701bf3fee
--- /dev/null
+++ b/textproc/helpdeco/patches/patch-ac
@@ -0,0 +1,37 @@
+$NetBSD: patch-ac,v 1.1.1.1 2001/05/23 15:47:45 agc Exp $
+
+--- helpdec1.c.orig Wed May 9 05:49:01 2001
++++ helpdec1.c Wed May 9 06:04:29 2001
+@@ -1,15 +1,6 @@
+ /* HELPDEC1.C - HELPDECO supporting functions */
+-
+-#include <stdlib.h>
+-#include <stdio.h>
+-#include <stdarg.h>
+-#include <string.h>
+-#include <conio.h>
+-#include <ctype.h>
+ #include "helpdeco.h"
+
+-extern BOOL overwrite; /* ugly: declared in HELPDECO.C */
+-
+ void error(char *format,...)
+ {
+ va_list arg;
+@@ -20,16 +11,6 @@
+ va_end(arg);
+ fputs("\nPress CR to continue at your own risk, any other key to exit.\n",stderr);
+ if(getch()!='\r') exit(1);
+-}
+-
+-size_t strlcpy(char *dest,char *src,size_t len) /* limited string copy */
+-{
+- size_t i;
+-
+- if(!dest) return 0;
+- for(i=0;i<len-1&&src&&src[i];i++) dest[i]=src[i];
+- dest[i]='\0';
+- return i;
+ }
+
+ void *my_malloc(long bytes) /* save malloc function */
diff --git a/textproc/helpdeco/patches/patch-ad b/textproc/helpdeco/patches/patch-ad
new file mode 100644
index 00000000000..ab0240d75b2
--- /dev/null
+++ b/textproc/helpdeco/patches/patch-ad
@@ -0,0 +1,401 @@
+$NetBSD: patch-ad,v 1.1.1.1 2001/05/23 15:47:45 agc Exp $
+
+--- helpdeco.c.orig Tue Jan 28 00:57:48 1997
++++ helpdeco.c Mon May 21 14:35:47 2001
+@@ -383,7 +383,7 @@
+ char *extension;
+ int extensions=0;
+ /* index into bmpext: bit 0=multiresolution bit 1=bitmap, bit 2=metafile, bit 3=hotspot data, bit 4=embedded, bit 5=transparent */
+-char *bmpext[]={"???","MRB","BMP","MRB","WMF","MRB","MRB","MRB","SHG","MRB","SHG","MRB","SHG","MRB","SHG","MRB"};
++char *bmpext[]={"???","mrb","bmp","mrb","wmf","mrb","mrb","mrb","shg","mrb","shg","mrb","shg","mrb","shg","mrb"};
+ char **stopwordfilename;
+ int stopwordfiles;
+ char **fontname;
+@@ -473,7 +473,7 @@
+ result=0UL;
+ for(mask=0x80000000UL;mask;mask>>=1)
+ {
+- if(hashhi>divhi||hashhi==divhi&&hashlo>=divlo)
++ if(hashhi>divhi||(hashhi==divhi&&hashlo>=divlo))
+ {
+ result|=mask;
+ hashhi-=divhi;
+@@ -908,8 +908,8 @@
+
+ _splitpath(a,NULL,NULL,aname,aext);
+ _splitpath(b,NULL,NULL,bname,bext);
+- if(aext[0]=='\0') strcpy(aext,".HLP");
+- if(bext[0]=='\0') strcpy(bext,".HLP");
++ if(aext[0]=='\0') strcpy(aext,".hlp");
++ if(bext[0]=='\0') strcpy(bext,".hlp");
+ i=strcmpi(aname,bname);
+ if(i) return i;
+ return strcmpi(aext,bext);
+@@ -1346,7 +1346,7 @@
+ f->seek(f,FileStart+dwOffsBitmap);
+ byType=f->get(f); /* type of picture: 5=DDB, 6=DIB, 8=METAFILE */
+ byPacked=f->get(f); /* packing method: 0=unpacked, 1=RunLen, 2=LZ77, 3=both */
+- if(byType==6&&byPacked<4||byType==5&&byPacked<2)
++ if((byType==6&&byPacked<4)||(byType==5&&byPacked<2))
+ {
+ type|=2; /* contains bitmap */
+ memset(&bmfh,0,sizeof(bmfh));
+@@ -1370,10 +1370,10 @@
+ dwHotspotSize=GetCDWord(f);
+ dwPictureOffset=GetDWord(f);
+ dwHotspotOffset=GetDWord(f);
+- if(exportplain||n==1&&(dwHotspotOffset==0L||dwHotspotSize==0L))
++ if((exportplain||n==1)&&(dwHotspotOffset==0L||dwHotspotSize==0L))
+ {
+ if(checkexternal) break;
+- strcat(szFilename,".BMP");
++ strcat(szFilename,".bmp");
+ fTarget=my_fopen(szFilename,"wb");
+ if(fTarget)
+ {
+@@ -1450,14 +1450,14 @@
+ dwHotspotSize=GetCDWord(f);
+ dwPictureOffset=GetDWord(f);
+ dwHotspotOffset=GetDWord(f);
+- if(exportplain||n==1&&(dwHotspotOffset==0L||dwHotspotSize==0L))
++ if((exportplain||n==1)&&(dwHotspotOffset==0L||dwHotspotSize==0L))
+ {
+ if(checkexternal) break;
+ afh.dwKey=0x9AC6CDD7L;
+ afh.wInch=2540;
+ wp=(unsigned short *)&afh;
+ for(i=0;i<10;i++) afh.wChecksum^=*wp++;
+- strcat(szFilename,".WMF");
++ strcat(szFilename,".wmf");
+ fTarget=my_fopen(szFilename,"wb");
+ if(fTarget)
+ {
+@@ -1589,7 +1589,7 @@
+ case 0xEB: /* topic jump into external file / secondary window */
+ case 0xEE: /* popup jump into external file without font change */
+ case 0xEF: /* topic jump into external file / secondary window without font change */
+- if(hotspot[n].id1!=0&&hotspot[n].id1!=1&&hotspot[n].id1!=4&&hotspot[n].id1!=6||hotspot[n].id2!=0)
++ if((hotspot[n].id1!=0&&hotspot[n].id1!=1&&hotspot[n].id1!=4&&hotspot[n].id1!=6)||(hotspot[n].id2!=0))
+ {
+ }
+ else
+@@ -1631,8 +1631,8 @@
+ return type;
+ }
+ /****************************************************************************
+-// END OF GRAPHICS STUFF
+-//**************************************************************************/
++END OF GRAPHICS STUFF
++**************************************************************************/
+
+ char *getbitmapname(unsigned int n) /* retrieve extension of exported bitmap n */
+ {
+@@ -2018,7 +2018,7 @@
+ }
+ putc('\n',hpj);
+ }
+- if(groups||multi&&browsenums>1)
++ if((groups||multi)&&(browsenums>1))
+ {
+ group=my_malloc(groups*sizeof(GROUP));
+ fputs("[GROUPS]\n",hpj);
+@@ -2320,6 +2320,7 @@
+ void FontLoad(FILE *HelpFile,FILE *rtf,FILE *hpj)
+ {
+ static char *BestFonts[]={"Arial","Times New Roman","MS Sans Serif","MS Serif","Helv","TmsRmn","MS Sans Serif","Helvetica","Times Roman","Times"};
++ int default_font = 0;
+ CHARMAPHEADER CharmapHeader;
+ FONTHEADER FontHdr;
+ FILE *f;
+@@ -2355,6 +2356,9 @@
+ fseek(HelpFile,FontStart+FontHdr.FacenamesOffset+len*i,SEEK_SET);
+ my_fread(FontName,len,HelpFile);
+ FontName[len]='\0';
++ if (FontName[0] == '\000') {
++ strcpy(FontName, BestFonts[default_font]);
++ }
+ ptr=strchr(FontName,',');
+ if(ptr&&FontHdr.FacenamesOffset>=16)
+ {
+@@ -2586,14 +2590,14 @@
+ if(m->font.expndtw!=n->font.expndtw) fprintf(rtf,"\\expndtw%d",m->font.expndtw);
+ if(m->font.FGRGB[0]!=n->font.FGRGB[0]) fprintf(rtf,"\\cf%d",m->font.FGRGB[0]);
+ if(m->font.BGRGB[0]!=n->font.BGRGB[0]) fprintf(rtf,"\\cb%d",m->font.BGRGB[0]);
+- if(m->font.Height!=n->font.Height) fprintf(rtf,"\\fs%d",-2L*m->font.Height);
++ if(m->font.Height!=n->font.Height) fprintf(rtf,"\\fs%ld",-2L*m->font.Height);
+ if((m->font.Weight>500)!=(n->font.Weight>500)) fprintf(rtf,"\\b%d",m->font.Weight>500);
+ if(m->font.Italic!=n->font.Italic) fprintf(rtf,"\\i%d",m->font.Italic);
+ if(m->font.Underline!=n->font.Underline) fprintf(rtf,"\\ul%d",m->font.Underline);
+ if(m->font.StrikeOut!=n->font.StrikeOut) fprintf(rtf,"\\strike%d",m->font.StrikeOut);
+ if(m->font.DoubleUnderline!=n->font.DoubleUnderline) fprintf(rtf,"\\uldb%d",m->font.DoubleUnderline);
+ if(m->font.SmallCaps!=n->font.SmallCaps) fprintf(rtf,"\\scaps%d",m->font.SmallCaps);
+- if(m->font.up!=n->font.up) if(m->font.up>0) fprintf(rtf,"\\up%d",m->font.up); else fprintf(rtf,"\\dn%d",-m->font.up);
++ if(m->font.up!=n->font.up) fprintf(rtf,"\\up%d",abs(m->font.up));
+ fprintf(rtf," \\sbasedon%u",m->BasedOn+9);
+ }
+ else
+@@ -2608,7 +2612,7 @@
+ if(m->font.expndtw) fprintf(rtf,"\\expndtw%d",m->font.expndtw);
+ if(m->font.up>0) fprintf(rtf,"\\up%d",m->font.up);
+ else if(m->font.up<0) fprintf(rtf,"\\dn%d",-m->font.up);
+- fprintf(rtf,"\\fs%d",-2*m->font.Height);
++ fprintf(rtf,"\\fs%ld",-2*m->font.Height);
+ if(m->font.FGRGB[0]) fprintf(rtf,"\\cf%d",m->font.FGRGB[0]);
+ if(m->font.BGRGB[0]) fprintf(rtf,"\\cb%d",m->font.BGRGB[0]);
+ }
+@@ -2630,7 +2634,7 @@
+ if(m->font.FontName!=n->font.FontName) fprintf(rtf,"\\f%d",m->font.FontName);
+ if(m->font.FGRGB[0]!=n->font.FGRGB[0]) fprintf(rtf,"\\cf%d",m->font.FGRGB[0]);
+ if(m->font.BGRGB[0]!=n->font.BGRGB[0]) fprintf(rtf,"\\cb%d",m->font.BGRGB[0]);
+- if(m->font.Height!=n->font.Height) fprintf(rtf,"\\fs%d",-2L*m->font.Height);
++ if(m->font.Height!=n->font.Height) fprintf(rtf,"\\fs%ld",-2L*m->font.Height);
+ if((m->font.Weight>500)!=(n->font.Weight>500)) fprintf(rtf,"\\b%d",m->font.Weight>500);
+ if(m->font.Italic!=n->font.Italic) fprintf(rtf,"\\i%d",m->font.Italic);
+ if(m->font.Underline!=n->font.Underline) fprintf(rtf,"\\ul%d",m->font.Underline);
+@@ -2648,7 +2652,7 @@
+ if(m->font.StrikeOut) fputs("\\strike",rtf);
+ if(m->font.DoubleUnderline) fputs("\\uldb",rtf);
+ if(m->font.SmallCaps) fputs("\\scaps",rtf);
+- fprintf(rtf,"\\fs%d",-2*m->font.Height);
++ fprintf(rtf,"\\fs%ld",-2*m->font.Height);
+ if(m->font.FGRGB[0]) fprintf(rtf,"\\cf%d",m->font.FGRGB[0]);
+ if(m->font.BGRGB[0]) fprintf(rtf,"\\cb%d",m->font.BGRGB[0]);
+ }
+@@ -2800,10 +2804,12 @@
+ {
+ char *buffer;
+ long BytesRead;
++ long i;
+
+ if(Length<=NumBytes) /* no phrase compression in this case */
+ {
+ BytesRead=TopicRead(HelpFile,TopicPos,dest,Length);
++ for (i = BytesRead; i <= Length; i++) dest[i] = '\0';
+ if(BytesRead==Length&&Length<NumBytes) /* some trailing bytes are not used (bug in HCRTF ?) */
+ {
+ buffer=my_malloc(NumBytes-Length);
+@@ -3325,14 +3331,14 @@
+ strcpy(buffer,name);
+ if(i)
+ {
+- itoa(i,num,10);
++ snprintf(num, 7, "%d", i);
+ if(strlen(buffer)+strlen(num)>8)
+ {
+ buffer[8-strlen(num)]='\0';
+ }
+ strcat(buffer,num);
+ }
+- strcat(buffer,".RTF");
++ strcat(buffer,".rtf");
+ }
+
+ /* emit rtf commands to change to font i.
+@@ -3354,17 +3360,17 @@
+ else
+ {
+ /* HC30 can't reset, so reset using \plain */
+- if(CurrentFont.Bold&&!f->Bold
+- || CurrentFont.Italic&&!f->Italic
+- || CurrentFont.Underline&&!(!uldb&&(ul||f->Underline))
+- || CurrentFont.StrikeOut&&!f->StrikeOut
+- || CurrentFont.DoubleUnderline&&!(uldb||f->DoubleUnderline)
+- || CurrentFont.SmallCaps&&!f->SmallCaps
+- || CurrentFont.FontName&&!f->FontName
+- || CurrentFont.textcolor&&!f->textcolor
+- || CurrentFont.backcolor&&!f->backcolor
+- || CurrentFont.up&&!f->up
+- || CurrentFont.style&&!f->style)
++ if((CurrentFont.Bold&&!f->Bold)
++ || (CurrentFont.Italic&&!f->Italic)
++ || (CurrentFont.Underline&&!(!uldb&&(ul||f->Underline)))
++ || (CurrentFont.StrikeOut&&!f->StrikeOut)
++ || (CurrentFont.DoubleUnderline&&!(uldb||f->DoubleUnderline))
++ || (CurrentFont.SmallCaps&&!f->SmallCaps)
++ || (CurrentFont.FontName&&!f->FontName)
++ || (CurrentFont.textcolor&&!f->textcolor)
++ || (CurrentFont.backcolor&&!f->backcolor)
++ || (CurrentFont.up&&!f->up)
++ || (CurrentFont.style&&!f->style))
+ {
+ fputs("\\plain",rtf);
+ memset(&CurrentFont,0,sizeof(CurrentFont));
+@@ -3408,7 +3414,7 @@
+ grouplisted=FALSE;
+ for(i=0;i<groups;i++) if(group[i].GroupHeader.GroupType==1||group[i].GroupHeader.GroupType==2)
+ {
+- if(TopicNum>=group[i].GroupHeader.FirstTopic&&TopicNum<=group[i].GroupHeader.LastTopic&&(group[i].GroupHeader.GroupType==1||group[i].GroupHeader.GroupType==2&&(group[i].Bitmap[TopicNum>>3]&(1<<(TopicNum&7)))))
++ if((TopicNum>=group[i].GroupHeader.FirstTopic&&TopicNum<=group[i].GroupHeader.LastTopic)&&((group[i].GroupHeader.GroupType==1||group[i].GroupHeader.GroupType==2)&&(group[i].Bitmap[TopicNum>>3]&(1<<(TopicNum&7)))))
+ {
+ if(!grouplisted)
+ {
+@@ -3544,9 +3550,9 @@
+ fprintf(rtf,"{\\up #}{\\footnote\\pard\\plain{\\up #} TOPIC%ld}\n",TopicNum);
+ if(resolvebrowse)
+ {
+- if(TopicHdr30->NextTopicNum>TopicNum&&TopicHdr30->PrevTopicNum>TopicNum
+- || TopicHdr30->NextTopicNum==-1&&TopicHdr30->PrevTopicNum>TopicNum
+- || TopicHdr30->NextTopicNum>TopicNum&&TopicHdr30->PrevTopicNum==-1)
++ if((TopicHdr30->NextTopicNum>TopicNum&&TopicHdr30->PrevTopicNum>TopicNum)
++ || (TopicHdr30->NextTopicNum==-1&&TopicHdr30->PrevTopicNum>TopicNum)
++ || (TopicHdr30->NextTopicNum>TopicNum&&TopicHdr30->PrevTopicNum==-1))
+ {
+ BrowseNum=AddLink(TopicNum,TopicHdr30->NextTopicNum,TopicHdr30->PrevTopicNum);
+ }
+@@ -3579,9 +3585,9 @@
+ }
+ if(resolvebrowse)
+ {
+- if(TopicHdr->BrowseFor>TopicOffset&&TopicHdr->BrowseBck>TopicOffset
+- || TopicHdr->BrowseFor==-1L&&TopicHdr->BrowseBck>TopicOffset
+- || TopicHdr->BrowseFor>TopicOffset&&TopicHdr->BrowseBck==-1L)
++ if((TopicHdr->BrowseFor>TopicOffset&&TopicHdr->BrowseBck>TopicOffset)
++ || (TopicHdr->BrowseFor==-1L&&TopicHdr->BrowseBck>TopicOffset)
++ || (TopicHdr->BrowseFor>TopicOffset&&TopicHdr->BrowseBck==-1L))
+ {
+ BrowseNum=AddLink(TopicOffset,TopicHdr->BrowseFor,TopicHdr->BrowseBck);
+ }
+@@ -3635,7 +3641,7 @@
+ }
+ TopicNum++;
+ }
+- else if(LinkData1&&LinkData2&&TopicLink.RecordType==TL_DISPLAY30||TopicLink.RecordType==TL_DISPLAY||TopicLink.RecordType==TL_TABLE)
++ else if(LinkData1&&LinkData2&&(TopicLink.RecordType==TL_DISPLAY30||TopicLink.RecordType==TL_DISPLAY||TopicLink.RecordType==TL_TABLE))
+ {
+ if(AnnoFile) Annotate(TopicPos,rtf);
+ ptr=LinkData1;
+@@ -3738,7 +3744,7 @@
+ break;
+ }
+ }
+- fprintf(rtf,"\\tx%d",(x1&0x3FFF)*scaling-rounderr);
++ fprintf(rtf,"\\tx%ld",(x1&0x3FFF)*scaling-rounderr);
+ }
+ }
+ putc(' ',rtf);
+@@ -4100,7 +4106,7 @@
+ return rtf;
+ }
+
+-int _cdecl ContextRecCmp(const void *a,const void *b)
++int ContextRecCmp(const void *a,const void *b)
+ {
+ if(((const CONTEXTREC *)a)->TopicOffset<((const CONTEXTREC *)b)->TopicOffset) return -1;
+ if(((const CONTEXTREC *)a)->TopicOffset>((const CONTEXTREC *)b)->TopicOffset) return 1;
+@@ -5154,9 +5160,9 @@
+ TopicHdr30=(TOPICHEADER30 *)LinkData1;
+ if(resolvebrowse)
+ {
+- if(TopicHdr30->NextTopicNum>TopicNum&&TopicHdr30->PrevTopicNum>TopicNum
+- || TopicHdr30->NextTopicNum==-1&&TopicHdr30->PrevTopicNum>TopicNum
+- || TopicHdr30->NextTopicNum>TopicNum&&TopicHdr30->PrevTopicNum==-1)
++ if((TopicHdr30->NextTopicNum>TopicNum&&TopicHdr30->PrevTopicNum>TopicNum)
++ || (TopicHdr30->NextTopicNum==-1&&TopicHdr30->PrevTopicNum>TopicNum)
++ || (TopicHdr30->NextTopicNum>TopicNum&&TopicHdr30->PrevTopicNum==-1))
+ {
+ AddBrowse(TopicNum,TopicHdr30->NextTopicNum,TopicHdr30->PrevTopicNum);
+ }
+@@ -5187,9 +5193,9 @@
+ TopicHdr=(TOPICHEADER *)LinkData1;
+ if(resolvebrowse)
+ {
+- if(TopicHdr->BrowseFor>TopicOffset&&TopicHdr->BrowseBck>TopicOffset
+- || TopicHdr->BrowseFor==-1L&&TopicHdr->BrowseBck>TopicOffset
+- || TopicHdr->BrowseFor>TopicOffset&&TopicHdr->BrowseBck==-1L)
++ if((TopicHdr->BrowseFor>TopicOffset&&TopicHdr->BrowseBck>TopicOffset)
++ || (TopicHdr->BrowseFor==-1L&&TopicHdr->BrowseBck>TopicOffset)
++ || (TopicHdr->BrowseFor>TopicOffset&&TopicHdr->BrowseBck==-1L))
+ {
+ AddBrowse(TopicOffset,TopicHdr->BrowseFor,TopicHdr->BrowseBck);
+ }
+@@ -5394,7 +5400,7 @@
+ }
+ }
+
+-int _cdecl CTXOMAPRecCmp(const void *a,const void *b)
++int CTXOMAPRecCmp(const void *a,const void *b)
+ {
+ if(((CTXOMAPREC *)a)->TopicOffset<((CTXOMAPREC *)b)->TopicOffset) return -1;
+ if(((CTXOMAPREC *)a)->TopicOffset>((CTXOMAPREC *)b)->TopicOffset) return 1;
+@@ -5577,22 +5583,22 @@
+ strcpy(hpjfilename,name);
+ if(mvp)
+ {
+- strcat(hpjfilename,".MVP");
++ strcat(hpjfilename,".mvp");
+ }
+ else
+ {
+- strcat(hpjfilename,".HPJ");
++ strcat(hpjfilename,".hpj");
+ }
+ hpj=my_fopen(hpjfilename,"wt");
+ if(hpj)
+ {
+ strcpy(filename,name);
+- strcat(filename,".ICO");
++ strcat(filename,".ico");
+ SysList(HelpFile,hpj,filename); /* after ContextLoad */
+ ListBaggage(HelpFile,hpj,before31);
+ if(!mvp) AliasList(hpj); /* after ContextLoad, before TopicDump */
+ strcpy(filename,name);
+- strcat(filename,".PH");
++ strcat(filename,".ph");
+ PhraseList(filename); /* after PhraseLoad */
+ BuildName(filename,TopicsPerRTF>0);
+ rtf=my_fopen(filename,"wt");
+@@ -5672,7 +5678,7 @@
+ putc('\n',stderr);
+ if(!before31&&guessing) GuessFromKeywords(HelpFile); /* after FirstPass, before SysList */
+ strcpy(filename,name);
+- strcat(filename,".CNT");
++ strcat(filename,".cnt");
+ rtf=my_fopen(filename,"wt");
+ if(rtf)
+ {
+@@ -5752,7 +5758,7 @@
+ PhraseLoad(HelpFile);
+ DumpTopic(HelpFile,offset);
+ }
+- else if(strcmp(dumpfile+strlen(dumpfile)-4,".GRP")==0)
++ else if(strcmp(dumpfile+strlen(dumpfile)-4,".grp")==0)
+ {
+ GroupDump(HelpFile);
+ }
+@@ -5882,7 +5888,7 @@
+ return TRUE;
+ }
+
+-int _cdecl main(int argc,char *argv[])
++int main(int argc,char *argv[])
+ {
+ char AnnoFileName[81];
+ char drive[_MAX_DRIVE];
+@@ -6036,9 +6042,8 @@
+ }
+ if(filename)
+ {
+- strupr(filename);
+ _splitpath(filename,drive,dir,name,ext);
+- if(ext[0]=='\0') strcpy(ext,".HLP");
++ if(ext[0]=='\0') strcpy(ext,".hlp");
+ mvp=ext[1]=='M';
+ _makepath(HelpFileName,drive,dir,name,ext);
+ f=fopen(HelpFileName,"rb");
+@@ -6046,7 +6051,7 @@
+ {
+ if(annotate)
+ {
+- if(AnnoFileName[0]=='\0') _makepath(AnnoFileName,drive,dir,name,".ANN");
++ if(AnnoFileName[0]=='\0') _makepath(AnnoFileName,drive,dir,name,".ann");
+ AnnoFile=fopen(AnnoFileName,"rb");
+ if(!AnnoFile)
+ {
+@@ -6096,7 +6101,6 @@
+ "work like the original. This program is Freeware. Use at your own risk. No\n"
+ "part of it may be used commercially. No fees may be charged on distributing.\n"
+ #ifndef _WIN32
+- "Launch from Windows 95/Windows NT command line to handle larger helpfiles."
+ #endif
+ ,sizeof(int)*8);
+ }
diff --git a/textproc/helpdeco/patches/patch-ae b/textproc/helpdeco/patches/patch-ae
new file mode 100644
index 00000000000..fe3566ad56f
--- /dev/null
+++ b/textproc/helpdeco/patches/patch-ae
@@ -0,0 +1,28 @@
+$NetBSD: patch-ae,v 1.1.1.1 2001/05/23 15:47:45 agc Exp $
+
+--- helpdeco.h.orig Wed May 9 05:48:55 2001
++++ helpdeco.h Wed May 9 06:04:46 2001
+@@ -7,8 +7,8 @@
+ #include <stdarg.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <conio.h>
+ #include <ctype.h>
++#include "compat.h"
+
+ #ifdef __TURBOC__
+ typedef struct { char a,b,c; } align;
+@@ -588,7 +588,6 @@
+ MFILE;
+
+ extern void error(char *format,...);
+-extern size_t strlcpy(char *dest,char *src,size_t len); /* limited string copy */
+ extern void *my_malloc(long bytes); /* save malloc function */
+ extern void *my_realloc(void *ptr,long bytes); /* save realloc function */
+ extern char *my_strdup(char *ptr); /* save strdup function */
+@@ -651,4 +650,5 @@
+ extern void LinkDump(FILE *HelpFile);
+ extern void AnnotationDump(FILE *HelpFile,long FileLength,char *name);
+
++extern BOOL overwrite; /* ugly: declared in HELPDECO.C */
+ #endif
diff --git a/textproc/helpdeco/pkg/DESCR b/textproc/helpdeco/pkg/DESCR
new file mode 100644
index 00000000000..c152969defa
--- /dev/null
+++ b/textproc/helpdeco/pkg/DESCR
@@ -0,0 +1,2 @@
+helpdeco decompiles Windows help files into rich text format and image files.
+This does not operate on .chm (compressed html) documents.
diff --git a/textproc/helpdeco/pkg/PLIST b/textproc/helpdeco/pkg/PLIST
new file mode 100644
index 00000000000..a69e1227e27
--- /dev/null
+++ b/textproc/helpdeco/pkg/PLIST
@@ -0,0 +1,8 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2001/05/23 15:47:43 agc Exp $
+bin/helpdeco
+bin/zapres
+bin/splitmrb
+share/doc/helpdeco/helpdeco-de.txt
+share/doc/helpdeco/helpdeco-en.txt
+share/doc/helpdeco/helpfile.txt
+@dirrm share/doc/helpdeco