From: Florian Forster Date: Fri, 18 Jun 2010 18:23:54 +0000 (+0200) Subject: src/utils_params.[ch]: Implement and use "script_name()". X-Git-Tag: v4.0.0~246 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f3a56fb50f24f64724769541096881083a2c29a3;p=collection4.git src/utils_params.[ch]: Implement and use "script_name()". --- diff --git a/src/action_list_graphs.c b/src/action_list_graphs.c index 29e3d8b..395d8a1 100644 --- a/src/action_list_graphs.c +++ b/src/action_list_graphs.c @@ -75,8 +75,8 @@ static int print_graph_inst_html (graph_config_t *cfg, /* {{{ */ memset (desc, 0, sizeof (desc)); inst_describe (cfg, inst, desc, sizeof (desc)); - printf ("
  • %s
  • \n", - params, desc); + printf ("
  • %s
  • \n", + script_name (), params, desc); return (0); } /* }}} int print_graph_inst_html */ diff --git a/src/utils_params.c b/src/utils_params.c index 6e5dc89..2c7bcc2 100644 --- a/src/utils_params.c +++ b/src/utils_params.c @@ -256,4 +256,15 @@ int uri_escape (char *dst, const char *src, size_t size) /* {{{ */ } /* while (42) */ } /* }}} int uri_escape */ +const char *script_name (void) +{ + char *ret; + + ret = getenv ("SCRIPT_NAME"); + if (ret == NULL) + ret = "collection4.fcgi"; + + return (ret); +} /* }}} char *script_name */ + /* vim: set sw=2 sts=2 et fdm=marker : */ diff --git a/src/utils_params.h b/src/utils_params.h index 3c7ea0a..5d0c845 100644 --- a/src/utils_params.h +++ b/src/utils_params.h @@ -8,4 +8,6 @@ const char *param (const char *key); int uri_escape (char *dst, const char *src, size_t size); +const char *script_name (void); + #endif /* UTILS_PARAMS_H */