X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_graph.c;h=1e597d1b40e90c0229793e3206971daa10299bd8;hb=537c362313f6174f43090aa5dda299582c30cc6f;hp=f0b8e55af90098b74ebba37f9951da1a9614f1fa;hpb=c24cf5317f753d0bfb376835b4f907462a770384;p=rrdtool.git diff --git a/src/rrd_graph.c b/src/rrd_graph.c index f0b8e55..1e597d1 100644 --- a/src/rrd_graph.c +++ b/src/rrd_graph.c @@ -1,5 +1,5 @@ /**************************************************************************** - * RRDtool 1.3rc9 Copyright by Tobi Oetiker, 1997-2008 + * RRDtool 1.3.0 Copyright by Tobi Oetiker, 1997-2008 **************************************************************************** * rrd__graph.c produce graphs from data in rrdfiles ****************************************************************************/ @@ -26,6 +26,7 @@ #endif #include "rrd_graph.h" +#include "rrd_client.h" /* some constant definitions */ @@ -302,6 +303,13 @@ int im_free( if (im == NULL) return 0; + + if (im->use_rrdcached) + { + rrdc_disconnect (); + im->use_rrdcached = 0; + } + for (i = 0; i < (unsigned) im->gdes_c; i++) { if (im->gdes[i].data_first) { /* careful here, because a single pointer can occur several times */ @@ -829,6 +837,7 @@ int data_fetch( &im->gdes[i].start, &im->gdes[i].end, &ft_step, + im->use_rrdcached ? 1 : 0, &im->gdes[i].ds_cnt, &im->gdes[i].ds_namv, &im->gdes[i].data)) == -1) { @@ -3600,7 +3609,7 @@ rrd_info_t *rrd_graph_v( char **argv) { image_desc_t im; - rrd_info_t *grinfo; + rrd_info_t *grinfo; rrd_graph_init(&im); /* a dummy surface so that we can measure text sizes for placements */ @@ -3709,6 +3718,7 @@ void rrd_graph_init( im->grinfo_current = (rrd_info_t *) NULL; im->imgformat = IF_PNG; im->imginfo = NULL; + im->use_rrdcached = 0; im->lazy = 0; im->logarithmic = 0; im->maxval = DNAN; @@ -3746,26 +3756,6 @@ void rrd_graph_init( cairo_font_options_set_antialias(im->font_options, CAIRO_ANTIALIAS_GRAY); for (i = 0; i < DIM(graph_col); i++) im->graph_col[i] = graph_col[i]; -#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) - { - char *windir; - char rrd_win_default_font[1000]; - - windir = getenv("windir"); - /* %windir% is something like D:\windows or C:\winnt */ - if (windir != NULL) { - strncpy(rrd_win_default_font, windir, 500); - rrd_win_default_font[500] = '\0'; - strcat(rrd_win_default_font, "\\fonts\\"); - strcat(rrd_win_default_font, RRD_DEFAULT_FONT); - for (i = 0; i < DIM(text_prop); i++) { - strncpy(text_prop[i].font, - rrd_win_default_font, sizeof(text_prop[i].font) - 1); - text_prop[i].font[sizeof(text_prop[i].font) - 1] = '\0'; - } - } - } -#endif { char *deffont; @@ -3847,6 +3837,7 @@ void rrd_graph_options( { "watermark", required_argument, 0, 'W'}, { "alt-y-mrtg", no_argument, 0, 1000}, /* this has no effect it is just here to save old apps from crashing when they use it */ { "pango-markup", no_argument, 0, 'P'}, + { "daemon", required_argument, 0, 'd'}, { 0, 0, 0, 0} }; /* *INDENT-ON* */ @@ -3861,7 +3852,7 @@ void rrd_graph_options( int col_start, col_end; opt = getopt_long(argc, argv, - "s:e:x:y:v:w:h:D:iu:l:rb:oc:n:m:t:f:a:I:zgjFYAMEX:L:S:T:NR:B:W:kP", + "s:e:x:y:v:w:h:D:iu:l:rb:oc:n:m:t:f:a:I:zgjFYAMEX:L:S:T:NR:B:W:kPd:", long_options, &option_index); if (opt == EOF) break; @@ -4205,6 +4196,25 @@ void rrd_graph_options( strncpy(im->watermark, optarg, 100); im->watermark[99] = '\0'; break; + case 'd': + { + int status; + if (im->use_rrdcached) + { + rrd_set_error ("You cannot specify --daemon " + "more than once."); + return; + } + status = rrdc_connect (optarg); + if (status != 0) + { + rrd_set_error ("rrdc_connect(%s) failed with status %i.", + optarg, status); + return; + } + im->use_rrdcached = 1; + break; + } case '?': if (optopt != 0) rrd_set_error("unknown option '%c'", optopt);