Add a NO_HTMLHELP option, and enable it by default in the Cygwin Makefile,
authorjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Thu, 28 Dec 2006 20:56:01 +0000 (20:56 +0000)
committerjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Thu, 28 Dec 2006 20:56:01 +0000 (20:56 +0000)
since even the latest version of w32api (3.6) shows no sign of HTMLHelp
support.

(This touches mkfiles.pl because that's where the details of what Cygwin
doesn't support are kept currently. This may be deliberate, so I haven't
changed it.)

git-svn-id: svn://svn.tartarus.org/sgt/putty@7032 cda61777-01e9-0310-a592-d414129be87e

Recipe
mkfiles.pl
windows/winhelp.c

diff --git a/Recipe b/Recipe
index 35e0c98..9f04778 100644 (file)
--- a/Recipe
+++ b/Recipe
 #      build, since at the time of writing this <multimon.h> is
 #      known not to be available in Cygwin.
 #
+#  - COMPAT=/DNO_HTMLHELP (Windows only)
+#      Disables PuTTY's use of <htmlhelp.h>, which is not available
+#      with some development environments. The resulting binary
+#      will only look for an old-style WinHelp file (.HLP/.CNT), and
+#      will ignore any .CHM file.
+#
+#      Note that this definition is always enabled in the Cygwin
+#      build, since at the time of writing this <htmlhelp.h> is
+#      known not to be available in Cygwin.
+#
 #  - RCFL=/DNO_MANIFESTS (Windows only)
 #      Disables inclusion of XML application manifests in the PuTTY
 #      binaries. This may be necessary to build for 64-bit Windows;
@@ -158,7 +168,7 @@ version.o: FORCE
 RCFLAGS = $(RCFLAGS) $(VER)
 !end
 !begin cygwin vars
-# XXX GNU-ism, but it's probably all right for a Cygwin/MinGW Makfile.
+# XXX GNU-ism, but it's probably all right for a Cygwin/MinGW Makefile.
 RCFLAGS += $(patsubst -D%,--define %,$(VER))
 !end
 !begin borland vars
index 79a2f0a..e2bc3bb 100755 (executable)
@@ -396,7 +396,7 @@ if (defined $makefiles{'cygwin'}) {
     "# RCINC = --include-dir c:\\cygwin\\include\\\n".
     "\n".
     &splitline("CFLAGS = -mno-cygwin -Wall -O2 -D_WINDOWS -DDEBUG -DWIN32S_COMPAT".
-      " -D_NO_OLDNAMES -DNO_MULTIMON " .
+      " -D_NO_OLDNAMES -DNO_MULTIMON -DNO_HTMLHELP " .
               (join " ", map {"-I$dirpfx$_"} @srcdirs)) .
               "\n".
     "LDFLAGS = -mno-cygwin -s\n".
index 29e7aa0..cc36bee 100644 (file)
 
 #include "putty.h"
 
+#ifndef NO_HTMLHELP
 #include <htmlhelp.h>
+#endif /* NO_HTMLHELP */
 
-typedef HWND (CALLBACK *htmlhelp_t)(HWND, LPCSTR, UINT, DWORD);
-
-static char *help_path, *chm_path;
-static int help_has_contents;
 static int requested_help;
+static char *help_path;
+static int help_has_contents;
+#ifndef NO_HTMLHELP
+typedef HWND (CALLBACK *htmlhelp_t)(HWND, LPCSTR, UINT, DWORD);
+static char *chm_path;
 static DWORD html_help_cookie;
 static htmlhelp_t htmlhelp;
+#endif /* NO_HTMLHELP */
 
 void init_help(void)
 {
@@ -45,6 +49,7 @@ void init_help(void)
     } else
        help_has_contents = FALSE;
 
+#ifndef NO_HTMLHELP
     strcpy(r, PUTTY_CHM_FILE);
     if ( (fp = fopen(b, "r")) != NULL) {
        chm_path = dupstr(b);
@@ -63,12 +68,15 @@ void init_help(void)
        else
            chm_path = NULL;
     }
+#endif /* NO_HTMLHELP */
 }
 
 void shutdown_help(void)
 {
+#ifndef NO_HTMLHELP
     if (chm_path)
        htmlhelp(NULL, NULL, HH_UNINITIALIZE, html_help_cookie);
+#endif /* NO_HTMLHELP */
 }
 
 int has_help(void)
@@ -79,7 +87,11 @@ int has_help(void)
      * unrealistic, since even Vista will have it if the user
      * specifically downloads it.
      */
-    return (help_path || chm_path);
+    return (help_path
+#ifndef NO_HTMLHELP
+           || chm_path
+#endif /* NO_HTMLHELP */
+          );
 }
 
 void launch_help(HWND hwnd, const char *topic)
@@ -87,6 +99,7 @@ void launch_help(HWND hwnd, const char *topic)
     if (topic) {
        int colonpos = strcspn(topic, ":");
 
+#ifndef NO_HTMLHELP
        if (chm_path) {
            char *fname;
            assert(topic[colonpos] != '\0');
@@ -94,15 +107,20 @@ void launch_help(HWND hwnd, const char *topic)
                              topic + colonpos + 1);
            htmlhelp(hwnd, fname, HH_DISPLAY_TOPIC, 0);
            sfree(fname);
-       } else if (help_path) {
+       } else
+#endif /* NO_HTMLHELP */
+       if (help_path) {
            char *cmd = dupprintf("JI(`',`%.*s')", colonpos, topic);
            WinHelp(hwnd, help_path, HELP_COMMAND, (DWORD)cmd);
            sfree(cmd);
        }
     } else {
+#ifndef NO_HTMLHELP
        if (chm_path) {
            htmlhelp(hwnd, chm_path, HH_DISPLAY_TOPIC, 0);
-       } else if (help_path) {
+       } else
+#endif /* NO_HTMLHELP */
+       if (help_path) {
            WinHelp(hwnd, help_path,
                    help_has_contents ? HELP_FINDER : HELP_CONTENTS, 0);
        }
@@ -113,9 +131,12 @@ void launch_help(HWND hwnd, const char *topic)
 void quit_help(HWND hwnd)
 {
     if (requested_help) {
+#ifndef NO_HTMLHELP
        if (chm_path) {
            htmlhelp(NULL, NULL, HH_CLOSE_ALL, 0);
-       } else if (help_path) {
+       } else
+#endif /* NO_HTMLHELP */
+       if (help_path) {
            WinHelp(hwnd, help_path, HELP_QUIT, 0);
        }
        requested_help = FALSE;