diff -urN --exclude=*~ --exclude=#* --exclude=Makefile.in --exclude=Makefile --exclude=configure --exclude=aclocal.m4 --exclude=.deps ../texinfo-4.0.jcn1/ChangeLog ./ChangeLog
--- ../texinfo-4.0.jcn1/ChangeLog	Tue Sep 28 21:39:54 1999
+++ ./ChangeLog	Tue Nov 14 00:17:52 2000
@@ -1,3 +1,54 @@
+2000-11-14  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+	* makeinfo/toc.c (contents_update_html): 
+	(shortcontents_update_html): no double entries in toc.
+
+2000-11-10  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+	* makeinfo: removed code for numbered split HTML output, removed
+	SPLIT_JCN conditional.
+
+2000-11-09  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+	* makeinfo/html.c: prepared nodifying filename functions for
+	linking not non-spit HTML documents, by adding ``#anchor'' to
+	external refernces.
+
+	* doc/texinfo.txi (Installing HTML info): updated doco for --html
+	option, added node Installing HTML info.
+
+	* util/install-info-html.in: new script.  The bare minimum
+	required for generating HTML index.  
+
+	* lib/system.h:	compilation fix.
+
+2000-11-08  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+	* makeinfo/makeinfo.c (convert_from_loaded_file): [SPLIT_JCN]:
+	overloaded already way too hairy function with logic to put split
+	html output into subdirectory with basename of toplevel output
+	file.
+
+	* makeinfo/html.c (fix_filename): new function.
+
+2000-11-07  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+	* toc.c (toc_add_entry): 
+	(contents_update_html): 
+	(shortcontents_update_html): [SPLIT_JCN]: use hrefs for nodename based
+	html files.
+
+	* node.c (cm_node): [SPLIT_JCN]: create html filename based on
+	nodename (instead of a numbered node<num>.html filename).
+
+	* makeinfo/makeinfo.c (main): [SPLIT_JCN]: enable splitting of
+	html output.
+
+	* makeinfo/html.c
+	(add_url_name,add_nodename_to_filename,nodename_to_filename): new
+	functions.
+	
+
 2000-04-14    <janneke@gnu.org>
 
 	* applied texinfo-3.12s.jcn4 patch
diff -urN --exclude=*~ --exclude=#* --exclude=Makefile.in --exclude=Makefile --exclude=configure --exclude=aclocal.m4 --exclude=.deps ../texinfo-4.0.jcn1/NEWS ./NEWS
--- ../texinfo-4.0.jcn1/NEWS	Tue Sep 28 21:39:54 1999
+++ ./NEWS	Thu Nov  9 09:47:40 2000
@@ -1,5 +1,9 @@
 This file records noteworthy changes.
 
+4.0.jcn2 (8 November 2000)
+* makeinfo:
+  . Supports splitting of HTML output with --html option, by default.
+
 4.0.jcn1 (14 April 2000, patch of 2 September 1999)
 * Language:
   . New commands @verbatim and @verb for printing verbatim inserts
diff -urN --exclude=*~ --exclude=#* --exclude=Makefile.in --exclude=Makefile --exclude=configure --exclude=aclocal.m4 --exclude=.deps ../texinfo-4.0.jcn1/configure.in ./configure.in
--- ../texinfo-4.0.jcn1/configure.in	Tue Sep 28 21:39:54 1999
+++ ./configure.in	Thu Nov  9 12:35:18 2000
@@ -5,7 +5,7 @@
 AC_PREREQ(2.13)dnl Minimum Autoconf version required.
 AM_CONFIG_HEADER(config.h:config.in)dnl Keep filename to 8.3 for MS-DOS.
 
-AM_INIT_AUTOMAKE([texinfo], [4.0.jcn1])
+AM_INIT_AUTOMAKE([texinfo], [4.0.jcn2])
 
 AM_CONDITIONAL(TEXINFO_MAINT, test -n "$TEXINFO_MAINT")
 
@@ -98,6 +98,7 @@
   TERMLIBS="${TERMLIBS} -l${ac_cv_var_ospeed}"
 fi
 AC_SUBST(TERMLIBS)
+AC_PATH_PROG(BASH, bash, sh)
 
 dnl Set of available languages and i18n macros.
 ALL_LINGUAS="cs de de_AT eo fr nl no ru"
@@ -112,4 +113,5 @@
            makeinfo/tests/Makefile \
            po/Makefile.in	\
            util/Makefile        \
+           util/install-info-html \
            ])
diff -urN --exclude=*~ --exclude=#* --exclude=Makefile.in --exclude=Makefile --exclude=configure --exclude=aclocal.m4 --exclude=.deps ../texinfo-4.0.jcn1/doc/stamp-vti ./doc/stamp-vti
--- ../texinfo-4.0.jcn1/doc/stamp-vti	Tue Sep 28 21:40:40 1999
+++ ./doc/stamp-vti	Thu Nov  9 12:44:58 2000
@@ -1,3 +1,3 @@
-@set UPDATED 28 September 1999
-@set EDITION 4.0
-@set VERSION 4.0
+@set UPDATED 9 November 2000
+@set EDITION 4.0.jcn2
+@set VERSION 4.0.jcn2
diff -urN --exclude=*~ --exclude=#* --exclude=Makefile.in --exclude=Makefile --exclude=configure --exclude=aclocal.m4 --exclude=.deps ../texinfo-4.0.jcn1/doc/stamp-vti1 ./doc/stamp-vti1
--- ../texinfo-4.0.jcn1/doc/stamp-vti1	Thu Jan  1 01:00:00 1970
+++ ./doc/stamp-vti1	Thu Nov  9 12:41:12 2000
@@ -0,0 +1,3 @@
+@set UPDATED 25 June 1999
+@set EDITION 4.0.jcn2
+@set VERSION 4.0.jcn2
diff -urN --exclude=*~ --exclude=#* --exclude=Makefile.in --exclude=Makefile --exclude=configure --exclude=aclocal.m4 --exclude=.deps ../texinfo-4.0.jcn1/doc/texinfo.txi ./doc/texinfo.txi
--- ../texinfo-4.0.jcn1/doc/texinfo.txi	Tue Sep 28 21:39:54 1999
+++ ./doc/texinfo.txi	Thu Nov  9 12:44:50 2000
@@ -587,6 +587,7 @@
 * Installing Dir Entries::      How to specify what menu entry to add
                                   to the Info directory.
 * Invoking install-info::       @code{install-info} options.
+* Installing HTML info::        How to install HTML documents.
 
 Sample Permissions
 
@@ -13835,7 +13836,9 @@
 Print a usage message listing all available options, then exit successfully.
 
 @item --html
-Generate HTML output rather than Info.  @xref{makeinfo html}.
+Generate HTML output rather than Info.  @xref{makeinfo html}.  By
+default, the HTML output is split at node level.  The split output is
+written into a subdirectory with the name of the toplevel info file.
 
 @item -I @var{dir}
 @opindex -I @var{dir}
@@ -13917,8 +13920,9 @@
 file name specified in the @code{@@setfilename} command found in the
 Texinfo source (@pxref{setfilename}).  If @var{file} is @samp{-}, output
 goes to standard output and @samp{--no-split} is implied.  For split
-HTML output, @var{file} is the name of the output file for the top node
-(@pxref{makeinfo html}).
+HTML output, @var{file} is the name of the output file for the top node,
+as well as the name for the subdirectory that all HTML nodes are written
+to (@pxref{makeinfo html}).
 
 @item -P @var{dir}
 @opindex -P @var{dir}
@@ -14328,12 +14332,18 @@
 
 As an alternative to the normal Info format output you can use the
 @samp{--html} option to generate output in HTML format, for installation
-on a web site (for example).  In this release, HTML output from
-@code{makeinfo} is monolithic, splitting the output by chapter or node
-is not supported.  We hope to implement this feature soon.
+on a web site (for example).  By default, the HTML output is split at
+node level.
 
-The HTML output file is named according to @code{@@setfilename}, but
-with any @samp{.info} extension replaced with @samp{.html}.
+The HTML output file for the top node is named according to
+@code{@@setfilename} or @code{--outfile}, but with any @samp{.info}
+extension replaced with @samp{.html}.  All HTML nodes are witten into a
+subdirectory with that same name (but without the @samp{.html}
+extension.
+
+Monolithic ouput (@code{--no-split}) is named according to
+@code{@@setfilename} or @code{--outfile}.  Note that cross-document
+node references are not supported for monolithic HTML output.
 
 Texinfo input marked up with the @code{@@ifhtml} command will produce
 output only with the @samp{--html} option supplied.  Input marked up
@@ -14359,10 +14369,9 @@
 the multi-file regexp and index search facilities provided by Info
 readers.  Otherwise, hyperlinks are generated from Texinfo commands
 where appropriate.  @samp{@@xref} commands to other documents are
-generated assuming the other document is available in HTML form too, and
-@samp{.html} is appended to the @samp{@@xref} Info file name.  This
-presumably will often not work.
-
+generated assuming the other document is available in split HTML form,
+and installed in the same HTML documentation tree, at
+@file{../<info-document>/}.
 
 @node Install an Info File
 @section Installing an Info File
@@ -14382,6 +14391,7 @@
 * Installing Dir Entries::      How to specify what menu entry to add
                                   to the Info directory.
 * Invoking install-info::       @code{install-info} options.
+* Installing HTML info::        How to install HTML documents.
 @end menu
 
 
@@ -14778,6 +14788,30 @@
 
 @end table
 
+@node Installing HTML info
+@subsection Installing HTML info
+
+@pindex install-info-html
+
+TODO
+
+Installing HTML documents has not yet been automated for this release.
+Multiple HTML info documents can be combined into one documentation
+resource, similar to the info documentation.  This assumes that all HTML
+documents are split, and installed like so:
+
+@example
+    index.html         -- the (dir) node
+    emacs/emacs.html   -- the emacs manual
+    bash/bash.html     -- the bash manual
+@end example
+
+The naming of the subdirectories @file{emacs/} and @file{bash/} in this
+case, is the default that @code{makeinfo --html} produces.
+
+The very simple script @file{install-info-html} can generate a
+minimalistic @file{index.html} for you.  See @code{install-info-html
+--help} for details.
 
 @node Command List
 @appendix @@-Command List
diff -urN --exclude=*~ --exclude=#* --exclude=Makefile.in --exclude=Makefile --exclude=configure --exclude=aclocal.m4 --exclude=.deps ../texinfo-4.0.jcn1/doc/version.texi ./doc/version.texi
--- ../texinfo-4.0.jcn1/doc/version.texi	Tue Sep 28 21:40:40 1999
+++ ./doc/version.texi	Thu Nov  9 12:41:12 2000
@@ -1,3 +1,3 @@
-@set UPDATED 28 September 1999
-@set EDITION 4.0
-@set VERSION 4.0
+@set UPDATED 9 November 2000
+@set EDITION 4.0.jcn2
+@set VERSION 4.0.jcn2
diff -urN --exclude=*~ --exclude=#* --exclude=Makefile.in --exclude=Makefile --exclude=configure --exclude=aclocal.m4 --exclude=.deps ../texinfo-4.0.jcn1/lib/system.h ./lib/system.h
--- ../texinfo-4.0.jcn1/lib/system.h	Sat Jul 17 23:11:34 1999
+++ ./lib/system.h	Thu Nov  9 09:39:20 2000
@@ -191,6 +191,13 @@
 /* Some systems don't declare this function in pwd.h. */
 struct passwd *getpwnam ();
 
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
 /* Our library routines not included in any system library.  */
 extern void *xmalloc (), *xrealloc ();
 extern char *xstrdup ();
diff -urN --exclude=*~ --exclude=#* --exclude=Makefile.in --exclude=Makefile --exclude=configure --exclude=aclocal.m4 --exclude=.deps ../texinfo-4.0.jcn1/makeinfo/html.c ./makeinfo/html.c
--- ../texinfo-4.0.jcn1/makeinfo/html.c	Sat Sep 18 21:27:41 1999
+++ ./makeinfo/html.c	Fri Nov 10 16:39:01 2000
@@ -50,6 +50,7 @@
   add_word_args ("<meta name=description content=\"%s\">\n", html_title);
   add_word_args ("<meta name=generator content=\"makeinfo %s\">\n", VERSION);
   add_word ("<link href=\"http://texinfo.org/\" rel=generator-home>\n");
+  add_word ("<link href=\"http://appel.lilypond.org/fred/software\" rel=generator-patches>\n");
   add_word ("</head><body>\n\n");
 }
 
@@ -136,13 +137,13 @@
 /* Output an HTML <link> to the filename for NODE, including the
    other string as extra attributes. */
 void
-add_link (node, attributes)
-     char *node, *attributes;
+add_link (nodename, attributes)
+     char *nodename, *attributes;
 {
-  if (node)
+  if (nodename)
     {
       add_word_args ("<link %s href=\"", attributes);
-      add_anchor_name (node, 1);
+      add_anchor_name (nodename, 1);
       add_word ("\">\n");
     }
 }
@@ -175,8 +176,141 @@
      char *nodename;
      int href;
 {
-  if (href)
-    add_char ('#');
+  if (splitting)
+    {
+      add_url_name (nodename, href);
+    }
+  else
+    {   
+      if (href)
+	add_char ('#');
+      add_escaped_anchor_name (nodename);
+    }
+}
+
+/* Insert the text for the name of a reference in an HTML url, aprropriate
+   for NODENAME */
+void
+add_url_name (nodename, href)
+     char *nodename;
+     int href;
+{
+    add_nodename_to_filename (nodename);
+}
+
+  
+/* Only allow [-0-9a-zA-Z_.] when nodifying filenames.  This may
+  result in filename clashes, eg
+  
+  @node Foo ],,,
+  @node Foo [,,,
+  
+  both map to Foo--.html.  Tough, choose better names.  */
+void
+fix_filename (filename)
+     char *filename;
+{
+  char *p;
+  for (p = filename; *p; p++)
+    {
+      if (!(isalnum (*p) || strchr ("-._", *p)))
+	*p = '-';
+    }
+}
+ 
+/* As we can't look-up a (forward-referenced) nodes' html filename
+   from the tentry, we take the easy way out.  We assume that
+   nodenames are unique, and generate the html filename from the
+   nodename, that's always known.  */
+static char *
+_nodename_to_filename (nodename, href)
+     char *nodename;
+     int href;
+{
+  char *p;
+  char *filename;
+  char dirname[PATH_MAX];
+
+  /* We want the top node to have the basename of @setfilename */
+  if (!strcasecmp (nodename, "Top"))
+    return xstrdup (filename_part (toplevel_output_filename));
 
-  add_escaped_anchor_name (nodename);
+  /* We want the (dir) node to be named ``../index.html'' */
+  if (!strcasecmp (nodename, "(dir)"))
+    return xstrdup ("../index.html");
+
+  filename = xmalloc (PATH_MAX);
+  dirname[0] = '\0';
+  *filename = '\0';
+
+  /*
+    Check for external reference: ``(info-document)node-name''
+    Assume this node lives at: ``../info-document/node-name.html''
+
+    We need to handle the special case (sigh): ``(info-document)'',
+    ie, an external top-node, which should translate to:
+    ``../info-document/info-document.html'' */
+  
+  p = nodename;
+  if (*nodename == '(')
+    {
+      int length;
+      
+      p = strchr (nodename, ')');
+      
+      if (p == NULL)
+	{
+	  line_error (_ ("Invalid node name: `%s'"), nodename);
+	  exit (1);
+	}
+
+      length = p - nodename - 1;
+      if (length > 5 &&
+	  !strncmp (p - 5, ".info", 5))
+	length -= 5;
+      strcpy (filename, "../");
+      strncpy (dirname, nodename + 1, length);
+      *(dirname + length) = '\0';
+      fix_filename (dirname);
+      strcat (filename, dirname);
+      strcat (filename, "/");
+      p++;
+      if (*p == '\0')  /* the special external topnode case */
+	p = dirname;
+    }
+
+  strcat (filename, p);
+  /* Hmm */
+  fix_filename (filename + strlen (filename) - strlen (p));
+  strcat (filename, ".html");
+
+  /* We add ``#Nodified-filename'' anchor to external references to be
+     prepared for non-split HTML support.  Maybe drop this. */
+  if (href && *dirname)
+    {
+      strcat (filename, "#");
+      strcat (filename, p);
+      /* Hmm, again */
+      fix_filename (filename + strlen (filename) - strlen (p));
+    }
+  return filename;
+}
+
+/* If necessary, ie, if current filename != filename of node, ouput
+   the node name.  */
+void
+add_nodename_to_filename (nodename)
+     char *nodename;
+{
+  /* for now, don't check: always output filename */
+  char *filename = _nodename_to_filename (nodename, 1);
+  add_word (filename);
+  free (filename);
+}
+
+char *
+nodename_to_filename (nodename)
+     char *nodename;
+{
+  return _nodename_to_filename (nodename, 0);
 }
diff -urN --exclude=*~ --exclude=#* --exclude=Makefile.in --exclude=Makefile --exclude=configure --exclude=aclocal.m4 --exclude=.deps ../texinfo-4.0.jcn1/makeinfo/html.h ./makeinfo/html.h
--- ../texinfo-4.0.jcn1/makeinfo/html.h	Sun Apr 25 22:53:34 1999
+++ ./makeinfo/html.h	Thu Nov  9 13:30:27 2000
@@ -40,5 +40,8 @@
 
 /* See html.c.  */
 extern void add_anchor_name (/* nodename, href */);
+extern void add_url_name ( /*nodename, href */ );
+extern char* nodename_to_filename ( /* nodename */ );
+extern void add_nodename_to_filename ( /*nodename, href */ );
 
 #endif /* !HTML_H */
diff -urN --exclude=*~ --exclude=#* --exclude=Makefile.in --exclude=Makefile --exclude=configure --exclude=aclocal.m4 --exclude=.deps ../texinfo-4.0.jcn1/makeinfo/makeinfo.c ./makeinfo/makeinfo.c
--- ../texinfo-4.0.jcn1/makeinfo/makeinfo.c	Sun Sep 19 17:24:44 1999
+++ ./makeinfo/makeinfo.c	Fri Nov 10 17:25:10 2000
@@ -625,7 +625,6 @@
           html = 1;
           process_html = 1;
           process_info = 0;
-          splitting = 0; /* too complicated for now */
           break;
 
         case '?':
@@ -1191,6 +1190,67 @@
   convert_from_loaded_file (name);
 }
 
+/* Given OUTPUT_FILENAME = ``/foo/bar/baz.html'', return
+   ``/foo/bar/baz/baz.html.
+   
+  Split html output goes into the subdirectory of the toplevel
+  filename, without extension.  For example:
+
+      @setfilename foo.info
+
+  procudes output in files foo/foo.html, foo/second-node.html. */
+static char *
+insert_toplevel_subdirectory (output_filename)
+     char *output_filename;
+{
+  char *dir;
+  char *subdir;
+  char *base;
+  char *p;
+  char buf[PATH_MAX];
+
+  strcpy (buf, output_filename);
+  dir = pathname_part (buf);
+  base = filename_part (buf);
+  p = dir + strlen (dir) - 1;
+  if (p > dir && *p == '/')
+    *p = '\0';
+
+  p = strrchr (base, '.');
+  if (p)
+    *p = '\0';
+      
+  subdir = "";
+  /* Split html output goes into subdirectory of toplevel name */
+  if (strcmp (base, filename_part (dir)))
+    subdir = base;
+  free (output_filename);
+  output_filename = xmalloc (strlen (dir) + 1 
+			     + strlen (subdir) + 1
+			     + strlen (base)
+			     + 5 /* .html */
+			     + 1);
+  strcpy (output_filename, dir);
+  if (strlen (dir))
+    strcat (output_filename, "/");
+  strcat (output_filename, subdir);
+  if (strlen (subdir))
+    strcat (output_filename, "/");
+  if (mkdir (output_filename, 0755) == -1
+      && errno != EEXIST)
+    {
+      line_error (_ ("Can't create directory: `%s': %s"),
+		  output_filename,
+		  strerror (errno));
+      exit (1);
+	  
+    }
+  strcat (output_filename, base);
+  strcat (output_filename, ".html");
+  return output_filename;
+}
+
+/* FIXME: this is way too hairy */
 void
 convert_from_loaded_file (name)
      char *name;
@@ -1266,6 +1326,7 @@
 
           canon_white (output_filename);
           directory_part = pathname_part (output_filename);
+
           basename_part = filename_part (output_filename);
 
           /* Zap any existing extension.  */
@@ -1297,6 +1358,14 @@
     }
 
   canon_white (output_filename);
+
+  if (html && splitting)
+    {
+      output_filename = insert_toplevel_subdirectory (output_filename);
+      real_output_filename = output_filename;
+    }
+
+  toplevel_output_filename = xstrdup (output_filename);
 
   if (real_output_filename && strcmp (real_output_filename, "-") == 0)
     {
diff -urN --exclude=*~ --exclude=#* --exclude=Makefile.in --exclude=Makefile --exclude=configure --exclude=aclocal.m4 --exclude=.deps ../texinfo-4.0.jcn1/makeinfo/makeinfo.h ./makeinfo/makeinfo.h
--- ../texinfo-4.0.jcn1/makeinfo/makeinfo.h	Tue Sep 28 21:39:54 1999
+++ ./makeinfo/makeinfo.h	Tue Nov  7 19:58:41 2000
@@ -144,6 +144,7 @@
 DECLARE (int, input_text_length, 0);
 DECLARE (int, input_text_offset, 0);
 DECLARE (int, line_number, 0);
+DECLARE (char *, toplevel_output_filename, NULL);
 #define curchar() input_text[input_text_offset]
 
 /* A colon separated list of directories to search for files included
diff -urN --exclude=*~ --exclude=#* --exclude=Makefile.in --exclude=Makefile --exclude=configure --exclude=aclocal.m4 --exclude=.deps ../texinfo-4.0.jcn1/makeinfo/node.c ./makeinfo/node.c
--- ../texinfo-4.0.jcn1/makeinfo/node.c	Mon Sep 20 14:31:21 1999
+++ ./makeinfo/node.c	Fri Nov 10 17:29:37 2000
@@ -24,6 +24,7 @@
 #include "macro.h"
 #include "makeinfo.h"
 #include "node.h"
+#include "html.h"
 #include "sectioning.h"
 #include "insertion.h"
 
@@ -477,23 +478,7 @@
       output_pending_notes ();
     }
 
-  if (html && splitting && top_node_seen)
-    {
-      /* End the current split output file. */
-      close_paragraph ();
-      output_pending_notes ();
-      start_paragraph ();
-      /* Fixme: html: need a navigation bar here. */
-      add_word ("</body></html>\n");
-      close_paragraph ();
-      fclose (output_stream);
-      output_stream = NULL;
-    }
-
-  filling_enabled = indented_fill = 0;
   new_node_pos = output_position;
-  if (!html || (html && splitting))
-    current_footnote_number = 1;
 
   if (macro_expansion_output_stream && !executing_string)
     append_to_expansion_output (input_text_offset + 1);
@@ -510,6 +495,33 @@
   prev = get_node_token (0);
   up = get_node_token (0);
 
+  if (html && splitting && top_node_seen)
+    {
+      if (current_output_filename && output_stream)
+	{
+	  /* Don't close current output file, if next output file is
+             to have the same name.  This may happen at top level.  */
+	  char *filename = nodename_to_filename (node);
+	  if (strcmp (filename, filename_part (current_output_filename)))
+	    {
+	      /* End the current split output file. */
+	      close_paragraph ();
+	      output_pending_notes ();
+	      start_paragraph ();
+	      /* Fixme: html: need a navigation bar here. */
+	      add_word ("</body></html>\n");
+	      close_paragraph ();
+	      fclose (output_stream);
+	      output_stream = NULL;
+	    }
+	  free (filename);
+	}
+    }
+
+  filling_enabled = indented_fill = 0;
+  if (!html || (html && splitting))
+    current_footnote_number = 1;
+  
   if (verbose_mode)
     printf (_("Formatting node %s...\n"), node);
 
@@ -738,17 +750,27 @@
       char *tem;
 
       if (splitting)
-        { /* this code not operational, we do not currently split html */
-          char filename[20];
+        {
+	  char *basename;
+	  char *dirname;
+	  char filename[PATH_MAX];
+
+	  basename = nodename_to_filename (node);
+	  dirname = pathname_part (toplevel_output_filename);
+	  strcpy (filename, dirname);
+	  strcat (filename, basename);
+	  free (dirname);
+	  free (basename);
 
-          sprintf (filename, "node%d.html", number_of_node (node));
-          output_stream = fopen (filename, "w");
+	  if (output_stream == NULL)
+	    output_stream = fopen (filename, "w");
           if (output_stream == NULL)
             {
               fs_error (filename);
               xexit (1);
             }
           set_current_output_filename (filename);
+
           /* FIXME: when this code is operational, we will need to
              expand node, next, prev, and up before output.  */
           add_word_args ("<html><head><title>%s</title>", node);
diff -urN --exclude=*~ --exclude=#* --exclude=Makefile.in --exclude=Makefile --exclude=configure --exclude=aclocal.m4 --exclude=.deps ../texinfo-4.0.jcn1/makeinfo/toc.c ./makeinfo/toc.c
--- ../texinfo-4.0.jcn1/makeinfo/toc.c	Mon Aug  9 22:28:18 1999
+++ ./makeinfo/toc.c	Tue Nov 14 00:16:39 2000
@@ -25,6 +25,7 @@
 #include "files.h"
 #include "macro.h"
 #include "node.h"
+#include "html.h"
 #include "lang.h"
 #include "makeinfo.h"
 #include "sectioning.h"
@@ -71,7 +72,12 @@
 
   toc_entry_alist[toc_counter] = xmalloc (sizeof (TOC_ENTRY_ELT));
 
-  if (html)
+  if (html && splitting)
+    {
+      /* For split html: one node, one ref. */
+      toc_entry_alist[toc_counter]->name = xstrdup (node_name);
+    }
+  else if (html)
     {
       /* We need to insert the expanded node name into the TOC, so
 	 that when we eventually output the TOC, its <A REF= link will
@@ -230,8 +236,19 @@
           for (k = 0; k < (last_level-toc_entry_alist[i]->level); k++)
             fputs ("</ul>\n", fp);
         }
-
-      fprintf (fp, "<li><a href=\"#%s</a>\n", toc_entry_alist[i]->name);
+      /* No Top or double entries in toc */
+      if (splitting && strcasecmp (toc_entry_alist[i]->name, "Top")
+	  && i && strcmp (toc_entry_alist[i]->name,
+			  toc_entry_alist[i-1]->name))
+	{
+	  char *filename = nodename_to_filename (toc_entry_alist[i]->name);
+	  fprintf (fp, "<li><a href=\"%s\">%s</a>\n",
+		   filename,
+		   toc_entry_alist[i]->name);
+	  free (filename);
+	}
+      else if (!splitting)
+	fprintf (fp, "<li><a href=\"#%s</a>\n", toc_entry_alist[i]->name);
 
       last_level = toc_entry_alist[i]->level;
     }
@@ -295,11 +312,24 @@
     {
       if ((toc_entry_alist[i])->level == 0)
         {
-          fputs ("<li>", fp);
-          fprintf (fp, "<a href=\"#%s\n", toc_entry_alist[i]->name);
-        }
+	  /* No Top or double entries in toc */
+	  if (splitting && strcasecmp (toc_entry_alist[i]->name, "Top")
+	      && i && strcmp (toc_entry_alist[i]->name,
+			      toc_entry_alist[i-1]->name))
+	    {
+	      char *filename = nodename_to_filename (toc_entry_alist[i]->name);
+	      fprintf (fp, "<li><a href=\"%s\">%s</a>\n",
+		       filename,
+		   toc_entry_alist[i]->name);
+	      free (filename);
+	    }
+	  else if (!splitting)
+	    {
+	      fputs ("<li>", fp);
+	      fprintf (fp, "<a href=\"#%s\n", toc_entry_alist[i]->name);
+	    }
+	}
     }
-
   fputs ("</ul>\n\n", fp);
 }
 
diff -urN --exclude=*~ --exclude=#* --exclude=Makefile.in --exclude=Makefile --exclude=configure --exclude=aclocal.m4 --exclude=.deps ../texinfo-4.0.jcn1/util/Makefile.am ./util/Makefile.am
--- ../texinfo-4.0.jcn1/util/Makefile.am	Sat Jul 17 00:00:26 1999
+++ ./util/Makefile.am	Thu Nov  9 12:29:27 2000
@@ -3,7 +3,7 @@
 ## Run automake in .. to produce Makefile.in from this.
 
 bin_PROGRAMS = install-info texindex
-bin_SCRIPTS = texi2dvi
+bin_SCRIPTS = texi2dvi install-info-html
 
 localedir = $(datadir)/locale
 INCLUDES = -I$(top_srcdir)/lib -I../intl -DLOCALEDIR=\"$(localedir)\"
@@ -12,4 +12,5 @@
 # Most of these are just for fun.  The only one that's really supported
 # is texi2dvi.
 EXTRA_DIST = README deref.c fix-info-dir fixfonts fixref.gawk gen-dir-node \
-  outline.gawk prepinfo.awk tex3patch texi-docstring-magic.el texi2dvi
+  outline.gawk prepinfo.awk tex3patch texi-docstring-magic.el texi2dvi \
+  install-info-html.in
diff -urN --exclude=*~ --exclude=#* --exclude=Makefile.in --exclude=Makefile --exclude=configure --exclude=aclocal.m4 --exclude=.deps ../texinfo-4.0.jcn1/util/install-info-html.in ./util/install-info-html.in
--- ../texinfo-4.0.jcn1/util/install-info-html.in	Thu Jan  1 01:00:00 1970
+++ ./util/install-info-html.in	Thu Nov  9 12:35:51 2000
@@ -0,0 +1,156 @@
+#!@BASH@
+
+name=install-info-html
+version=1.0
+
+all=
+index_dir=.
+
+#
+# debugging
+#
+debug_echo=:
+
+
+#
+# print usage
+#
+function help ()
+{
+	cat << EOF
+$name $version
+Install HTML info document.
+
+Usage: $name [OPTION]... [DOCUMENT-DIR]...
+
+Options:
+  -a,--all             assume all subdirectories of index to be DOCUMENT-DIRs
+  -d,--dir=DIR         set index directory to DIR (default=.)
+  -D,--debug           print debugging info
+  -h,--help            this help text
+  -v,--version         show version
+EOF
+}
+ 
+
+function cleanup ()
+{
+	$debug_echo "cleaning ($?)..."
+}
+
+trap cleanup 0 9 15
+
+#
+# Find command line options and switches
+#
+
+# "x:" x takes argument
+#
+options="adhvW:"
+#
+# ugh, "\-" is a hack to support long options
+# must be in double quotes for bash-2.0
+
+while getopts "\-:$options" O
+do
+	$debug_echo "O: \`$O'"
+	$debug_echo "arg: \`$OPTARG'"
+	case $O in
+		a)
+			all=yes
+			;;
+		D)
+		 	[ "$debug_echo" = "echo" ] && set -x
+		      	debug_echo=echo
+			;;
+		h)
+      			help;
+			exit 0
+			;;
+		v)
+			echo $name $version
+			exit 0
+			;;
+		d)
+			index_dir=$OPTARG
+			;;
+	# a long option!
+	-)
+		case "$OPTARG" in
+			a*|-a*)
+				all=yes
+				;;
+			de*|-de*)
+				[ "$debug_echo" = "echo" ] && set -x
+				debug_echo=echo
+				;;
+			h*|-h*)
+				help;
+				exit 0
+				;;
+			di*|-di*)
+				index_dir="`expr \"$OPTARG\" ':' '[^=]*=\(.*\)'`"
+				;;
+			version|-version)
+				echo $name $version
+				exit 0
+				;;
+			*|-*)
+				echo "$0: invalid option -- \"$OPTARG\""
+				help;
+				exit -1
+				;;
+		esac
+	esac
+done
+shift `expr $OPTIND - 1`
+
+#
+# Input file name
+#
+if [ -z "$all" -a -z "$1" ]; then
+	help
+	echo "$name: No HTML documents given"
+	exit 2
+fi
+
+if [ -n "$all" -a -n "$1" ]; then
+	echo "$name: --all specified, ignoring DIRECTORY-DIRs"
+fi
+
+if [ -n "$all" ]; then
+	document_dirs=`/bin/ls -d1 $index_dir`
+else
+	document_dirs=$*
+fi
+
+index_file=$index_dir/index.html
+rm -f $index_file
+echo -n "$name: Writing index: $index_file..."
+
+# head
+cat >> $index_file <<EOF
+<html> 
+<title>Info documentation index</title>
+<body>
+<h1>Info documentation index</h1>
+This is the directory file \`index.html' a.k.a. \`DIR', which contains the
+topmost node of the HTML Info hierarchy.
+<p>
+This is all very much Work in Progress (WiP).
+<p>
+<ul>
+EOF
+
+#list
+for i in $document_dirs; do
+	echo "<li> <a href=$i/$i.html>$i</a>"
+done >> $index_file
+
+# foot
+cat >> $index_file <<EOF
+</ul>
+</body>
+</html>
+EOF
+echo
\ No newline at end of file

