From f3a56fb50f24f64724769541096881083a2c29a3 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Fri, 18 Jun 2010 20:23:54 +0200 Subject: [PATCH] src/utils_params.[ch]: Implement and use "script_name()". --- src/action_list_graphs.c | 4 ++-- src/utils_params.c | 11 +++++++++++ src/utils_params.h | 2 ++ 3 files changed, 15 insertions(+), 2 deletions(-) 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 */ -- 2.11.0