X-Git-Url: https://unix4lyfe.org/gitweb/darkstat/blobdiff_plain/bb5f338e2e84c3f961eb619e965e4b2f47d3a13f..f5bd555f2371566b87c249c27ee696e332a861b3:/html.c diff --git a/html.c b/html.c index ebc5eca..fe5bb68 100644 --- a/html.c +++ b/html.c @@ -8,43 +8,55 @@ * GNU General Public License version 2. (see COPYING.GPL) */ -#include "config.h" /* for PACKAGE_STRING */ +#include "config.h" #include "str.h" #include "html.h" -#include "http.h" /* for base_url */ +#include "opt.h" -void html_open(struct str *buf, const char *title, const char *interface, - const int want_graph_js) +#include + +static const char *relpaths[] = { + ".", + "..", + "../.." +}; + +void html_open(struct str *buf, const char *title, + 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" "\n" - "%s (darkstat3 %s)\n" - "\n" + "%s (darkstat %s)\n" + "\n" "\n" - "\n" - , title, interface, PACKAGE_STRING, base_url); + "\n", + title, title_interfaces, root); if (want_graph_js) str_appendf(buf, - "\n" - , base_url); + "\n" + , root); str_appendf(buf, "\n" "\n" "
\n" "\n" "
\n" "
\n" "

%s

\n" - , PACKAGE_STRING, base_url, base_url, title); + , root, root, title); } void html_close(struct str *buf) @@ -55,4 +67,4 @@ void html_close(struct str *buf) "\n"); } -/* vim:set ts=4 sw=4 tw=78 expandtab: */ +/* vim:set ts=4 sw=4 tw=80 et: */