]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
also parse the daemon parameter in DEF as specified in the documentation (#748)
authorThilo Bangert <bangert@users.noreply.github.com>
Tue, 11 Oct 2016 09:03:44 +0000 (11:03 +0200)
committerTobias Oetiker <tobi@oetiker.ch>
Tue, 11 Oct 2016 09:03:44 +0000 (04:03 -0500)
src/rrd_graph_helper.c

index 212526ce8aaea45aab282bd1eb5626f626dc0e1c..21e404dede94d5652ad4ae85148e93bd6f685acd 100644 (file)
@@ -366,6 +366,7 @@ static int parse_color( const char *const string, struct gfx_color_t *c)
 #define PARSE_YAXIS        (PARSE_FIELD1|(1ULL<<14))
 #define PARSE_REDUCE       (PARSE_FIELD1|(1ULL<<15))
 #define PARSE_SKIPSCALE    (PARSE_FIELD1|(1ULL<<16))
+#define PARSE_DAEMON       (PARSE_FIELD1|(1ULL<<17))
 
 #define PARSE_DASHES       (PARSE_FIELD1|(1ULL<<20))
 #define PARSE_GRADHEIGHT   (PARSE_FIELD1|(1ULL<<21))
@@ -511,6 +512,13 @@ static graph_desc_t* newGraphDescription(image_desc_t *const im,enum gf_en gf,pa
       if (((int)gdp->cf_reduce)==-1) { rrd_set_error("bad reduce CF: %s",reduce); return NULL; }
     }
   }
+  if (bitscmp(PARSE_DAEMON)) {
+    char *daemon=getKeyValueArgument("daemon",1,pa);
+    if (daemon) {
+      strncpy(gdp->daemon,daemon,strlen(daemon));
+      dprintfparsed("got daemon: %s\n", gdp->daemon);
+    }
+  }
   if (bitscmp(PARSE_XAXIS)) {
     long xaxis=0;
     char *t,*x;
@@ -915,6 +923,7 @@ static int parse_def(enum gf_en gf,parsedargs_t*pa,image_desc_t *const im){
                                        |PARSE_STEP
                                        |PARSE_END
                                        |PARSE_REDUCE
+                                       |PARSE_DAEMON
                                        );
   /* retry in case of errors modifying the name*/
   if (!gdp) {
@@ -944,6 +953,7 @@ static int parse_def(enum gf_en gf,parsedargs_t*pa,image_desc_t *const im){
                                        |PARSE_STEP
                                        |PARSE_END
                                        |PARSE_REDUCE
+                                       |PARSE_DAEMON
                                        |PARSE_RETRY
                                        );
          /* on error, we restore the original error and return */
@@ -968,6 +978,7 @@ static int parse_def(enum gf_en gf,parsedargs_t*pa,image_desc_t *const im){
   dprintf("STEP  : (%lld)\n",(long long int)gdp->step);
   dprintf("END   : (%lld)\n",(long long int)gdp->end);
   dprintf("REDUCE: (%i)\n",gdp->cf_reduce);
+  dprintf("DAEMON: %s\n",gdp->daemon);
   dprintf("=================================\n");
 
   /* and return fine */