X-Git-Url: https://unix4lyfe.org/gitweb/darkstat/blobdiff_plain/fa6fef9d7db2875136d60db0a26bb6aad4912804..cb79adb46d750aaabebab72c8daff987d7fa1536:/html.c diff --git a/html.c b/html.c index 6e98aaa..2d2b7f7 100644 --- a/html.c +++ b/html.c @@ -8,16 +8,26 @@ * GNU General Public License version 2. (see COPYING.GPL) */ -#include "darkstat.h" #include "config.h" #include "str.h" #include "html.h" -#include "http.h" /* for http_base_url */ #include "opt.h" +#include + +static const char *relpaths[] = { + ".", + "..", + "../.." +}; + void html_open(struct str *buf, const char *title, - const int want_graph_js) + const unsigned int path_depth, const int want_graph_js) { + const char *root; + assert(path_depth < (sizeof(relpaths)/sizeof(*relpaths))); + root = relpaths[path_depth]; + str_appendf(buf, "\n" "\n" @@ -25,13 +35,13 @@ void html_open(struct str *buf, const char *title, "%s (darkstat3 %s)\n" "\n" "\n" - "\n" - , title, opt_interface, http_base_url); + "\n" + , title, opt_interface, root); if (want_graph_js) str_appendf(buf, - "\n" - , http_base_url); + "\n" + , root); str_appendf(buf, "\n" @@ -39,14 +49,14 @@ void html_open(struct str *buf, const char *title, "
\n" "\n" "
\n" "
\n" "

%s

\n" - , http_base_url, http_base_url, title); + , root, root, title); } void html_close(struct str *buf)