Fiddle about with the configure script so it notices the need for
[sgt/agedu] / html.h
1 /*
2 * html.h: HTML output format for agedu.
3 */
4
5 struct html_config {
6 /*
7 * If "format" is non-NULL, it is treated as an sprintf format
8 * string which must contain exactly one %lu and no other
9 * formatting directives (other than %%, which doesn't count);
10 * this will be used to construct URLs to use in hrefs
11 * pointing to queries of other related (parent and child)
12 * pathnames.
13 */
14 const char *format;
15
16 /*
17 * If "rootpage" is non-NULL, it overrides "format" to give a
18 * special name (e.g. "index.html") to the top-level page of the
19 * index.
20 */
21 const char *rootpage;
22
23 /*
24 * Time stamps to assign to the extreme ends of the colour
25 * scale. If "autoage" is true, they are ignored and the time
26 * stamps are derived from the limits of the age data stored
27 * in the index.
28 */
29 int autoage;
30 time_t oldest, newest;
31
32 /*
33 * Specify whether to show individual files as well as
34 * directories in the report.
35 */
36 int showfiles;
37 };
38
39 /*
40 * Generate an HTML document containing the results of a query
41 * against the pathname at a given index. Returns a dynamically
42 * allocated piece of memory containing the entire HTML document,
43 * as an ordinary C zero-terminated string.
44 *
45 * 'downlink' is TRUE if hyperlinks should be generated for
46 * subdirectories. (This can also be disabled by setting cfg->format
47 * to NULL, but that also disables the upward hyperlinks to parent
48 * directories. Setting cfg->format to non-NULL but downlink to NULL
49 * will generate uplinks but no downlinks.)
50 */
51 char *html_query(const void *t, unsigned long index,
52 const struct html_config *cfg, int downlink);
53
54 /*
55 * Recursively output a dump of lots of HTML files which crosslink
56 * to each other. cfg->format and cfg->rootpath will be used to
57 * generate the filenames for both the hyperlinks and the output
58 * file names; the file names will have "pathprefix" prepended to
59 * them before being opened.
60 *
61 * "index" and "endindex" point to the region of index file that
62 * should be generated by the dump, which must be a subdirectory.
63 *
64 * "maxdepth" limits the depth of recursion. Setting it to zero
65 * outputs only one page, 1 outputs the current directory and its
66 * immediate children but no further, and so on. Making it negative
67 * gives unlimited depth.
68 *
69 * Return value is 0 on success, or 1 if an error occurs during
70 * output.
71 */
72 int html_dump(const void *t, unsigned long index, unsigned long endindex,
73 int maxdepth, const struct html_config *cfg,
74 const char *pathprefix);