summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 45c3812)
raw | patch | inline | side by side (parent: 45c3812)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Mon, 6 Feb 2006 19:49:23 +0000 (19:49 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Mon, 6 Feb 2006 19:49:23 +0000 (19:49 +0000) |
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@760 a5681a0c-68f1-0310-ab6d-d61299d08faa
doc/rrdcgi.pod | patch | blob | history | |
src/rrd_cgi.c | patch | blob | history |
diff --git a/doc/rrdcgi.pod b/doc/rrdcgi.pod
index c8152b4eac9d1e1a0dd8e4dc4552ef04de6b5ead..9860f311ceee382b0c400063dab407324b56b04a 100644 (file)
--- a/doc/rrdcgi.pod
+++ b/doc/rrdcgi.pod
then you can access their output with this tag. The I<number> argument refers to the
number of the B<PRINT> argument. This first B<PRINT> has I<number> 0.
+=item RRD::INTERNAL <var>
+
+This tag gets replaced by an internal var. Currently these vars are known:
+VERSION, COPYRIGHT, COMPILETIME, OS.
+These vars represent the compiled-in values.
+
=back
=head1 EXAMPLE 1
diff --git a/src/rrd_cgi.c b/src/rrd_cgi.c
index c1684f7beb423599bed1d1208dc7f6301a075b01..b2195e426e308c0ec18208399d8a16dc139b24c2 100644 (file)
--- a/src/rrd_cgi.c
+++ b/src/rrd_cgi.c
/* for how long is the output of the cgi valid ? */
char* rrdgoodfor(long, const char **);
+/* return rrdcgi version string */
+char* rrdgetinternal(long, const char **);
+
char* rrdstrip(char *buf);
char* scanargs(char *line, int *argc, char ***args);
parse(&buffer, i, "<RRD::TIME::LAST", printtimelast);
parse(&buffer, i, "<RRD::TIME::NOW", printtimenow);
parse(&buffer, i, "<RRD::TIME::STRFTIME", printstrftime);
+ parse(&buffer, i, "<RRD::INTERNAL", rrdgetinternal);
}
return buffer;
}
parse(&buffer, i, "<RRD::TIME::LAST", printtimelast);
parse(&buffer, i, "<RRD::TIME::NOW", printtimenow);
parse(&buffer, i, "<RRD::TIME::STRFTIME", printstrftime);
+ parse(&buffer, i, "<RRD::INTERNAL", rrdgetinternal);
}
if (!filter) {
if (envvar) {
return stralloc(envvar);
} else {
-#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
- _snprintf(buf, sizeof(buf), "[ERROR:_getenv_'%s'_failed", args[0]);
-#else
snprintf(buf, sizeof(buf), "[ERROR:_getenv_'%s'_failed", args[0]);
-#endif
return stralloc(buf);
}
}
if (value) {
return stralloc(value);
} else {
-#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
- _snprintf(buf, sizeof(buf), "[ERROR:_getvar_'%s'_failed", args[0]);
-#else
snprintf(buf, sizeof(buf), "[ERROR:_getvar_'%s'_failed", args[0]);
-#endif
return stralloc(buf);
}
}
return stralloc("");
}
+char* rrdgetinternal(long argc, const char **args){
+ if (argc == 1) {
+ if( strcasecmp( args[0], "VERSION") == 0) {
+ return stralloc(PACKAGE_VERSION);
+ } else if( strcasecmp( args[0], "COPYRIGHT") == 0) {
+ return stralloc(PACKAGE_COPYRIGHT);
+ } else if( strcasecmp( args[0], "COMPILETIME") == 0) {
+ return stralloc(__DATE__ " " __TIME__);
+ } else if( strcasecmp( args[0], "OS") == 0) {
+ return stralloc(OS);
+ } else {
+ return stralloc("[ERROR: internal unknown argument]");
+ }
+ } else {
+ return stralloc("[ERROR: internal expected 1 argument]");
+ }
+}
+
/* Format start or end times using strftime. We always need both the
* start and end times, because, either might be relative to the other.
* */