- /* expand rrd directives in buffer recursivly */
- for (i=0; buffer[i]; i++) {
- if (buffer[i] != '<')
- continue;
- if (!filter) {
- parse(&buffer, i, "<RRD::CV", cgiget);
- parse(&buffer, i, "<RRD::CV::PATH", cgigetqp);
- parse(&buffer, i, "<RRD::CV::QUOTE", cgigetq);
- parse(&buffer, i, "<RRD::GETENV", rrdgetenv);
- }
- parse(&buffer, i, "<RRD::GETVAR", rrdgetvar);
- parse(&buffer, i, "<RRD::GOODFOR", rrdgoodfor);
- parse(&buffer, i, "<RRD::GRAPH", drawgraph);
- parse(&buffer, i, "<RRD::INCLUDE", includefile);
- parse(&buffer, i, "<RRD::PRINT", drawprint);
- parse(&buffer, i, "<RRD::SETCONSTVAR", rrdsetvarconst);
- parse(&buffer, i, "<RRD::SETENV", rrdsetenv);
- parse(&buffer, i, "<RRD::SETVAR", rrdsetvar);
- 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) {
- printf ("Content-Type: text/html\n"
- "Content-Length: %d\n",
- strlen(buffer));
-
- if (labs(goodfor) > 0) {
- time_t now;
- now = time(NULL);
- printf("Last-Modified: %s\n", http_time(&now));
- now += labs(goodfor);
- printf("Expires: %s\n", http_time(&now));
- if (goodfor < 0) {
- printf("Refresh: %ld\n", labs(goodfor));
- }
- }
- printf("\n");
- }
-
- /* output result */
- printf("%s", buffer);
-
- /* cleanup */
- calfree();
- if (buffer){
- free(buffer);
- }
- donevar();
- exit(0);
+ /* expand rrd directives in buffer recursivly */
+ for (i = 0; buffer[i]; i++) {
+ if (buffer[i] != '<')
+ continue;
+ if (!filter) {
+ parse(&buffer, i, "<RRD::CV", cgiget);
+ parse(&buffer, i, "<RRD::CV::PATH", cgigetqp);
+ parse(&buffer, i, "<RRD::CV::QUOTE", cgigetq);
+ parse(&buffer, i, "<RRD::GETENV", rrdgetenv);
+ }
+ parse(&buffer, i, "<RRD::GETVAR", rrdgetvar);
+ parse(&buffer, i, "<RRD::GOODFOR", rrdgoodfor);
+ parse(&buffer, i, "<RRD::GRAPH", drawgraph);
+ parse(&buffer, i, "<RRD::INCLUDE", includefile);
+ parse(&buffer, i, "<RRD::PRINT", drawprint);
+ parse(&buffer, i, "<RRD::SETCONSTVAR", rrdsetvarconst);
+ parse(&buffer, i, "<RRD::SETENV", rrdsetenv);
+ parse(&buffer, i, "<RRD::SETVAR", rrdsetvar);
+ 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) {
+ printf("Content-Type: text/html\n"
+ "Content-Length: %zd\n", strlen(buffer));
+
+ if (labs(goodfor) > 0) {
+ time_t now;
+
+ now = time(NULL);
+ printf("Last-Modified: %s\n", http_time(&now));
+ now += labs(goodfor);
+ printf("Expires: %s\n", http_time(&now));
+ if (goodfor < 0) {
+ printf("Refresh: %ld\n", labs(goodfor));
+ }
+ }
+ printf("\n");
+ }
+
+ /* output result */
+ printf("%s", buffer);
+
+ /* cleanup */
+ calfree();
+ if (buffer) {
+ free(buffer);
+ }
+ donevar();
+ exit(0);