Make the existing -d (depth) option apply to the -H (static HTML
[sgt/agedu] / html.h
diff --git a/html.h b/html.h
index d99af0a..dc90c4b 100644 (file)
--- a/html.h
+++ b/html.h
@@ -14,6 +14,13 @@ struct html_config {
     const char *format;
 
     /*
+     * If "rootpage" is non-NULL, it overrides "format" to give a
+     * special name (e.g. "index.html") to the top-level page of the
+     * index.
+     */
+    const char *rootpage;
+
+    /*
      * Time stamps to assign to the extreme ends of the colour
      * scale. If "autoage" is true, they are ignored and the time
      * stamps are derived from the limits of the age data stored
@@ -34,6 +41,34 @@ struct html_config {
  * against the pathname at a given index. Returns a dynamically
  * allocated piece of memory containing the entire HTML document,
  * as an ordinary C zero-terminated string.
+ *
+ * 'downlink' is TRUE if hyperlinks should be generated for
+ * subdirectories. (This can also be disabled by setting cfg->format
+ * to NULL, but that also disables the upward hyperlinks to parent
+ * directories. Setting cfg->format to non-NULL but downlink to NULL
+ * will generate uplinks but no downlinks.)
  */
 char *html_query(const void *t, unsigned long index, 
-                const struct html_config *cfg);
+                const struct html_config *cfg, int downlink);
+
+/*
+ * Recursively output a dump of lots of HTML files which crosslink
+ * to each other. cfg->format and cfg->rootpath will be used to
+ * generate the filenames for both the hyperlinks and the output
+ * file names; the file names will have "pathprefix" prepended to
+ * them before being opened.
+ *
+ * "index" and "endindex" point to the region of index file that
+ * should be generated by the dump, which must be a subdirectory.
+ *
+ * "maxdepth" limits the depth of recursion. Setting it to zero
+ * outputs only one page, 1 outputs the current directory and its
+ * immediate children but no further, and so on. Making it negative
+ * gives unlimited depth.
+ *
+ * Return value is 0 on success, or 1 if an error occurs during
+ * output.
+ */
+int html_dump(const void *t, unsigned long index, unsigned long endindex,
+             int maxdepth, const struct html_config *cfg,
+             const char *pathprefix);