UPD_C_FILES = \
mutex.c \
+ rrd_strtod.c \
rrd_create.c \
hash_32.c \
rrd_parsetime.c \
unused.h \
gettext.h \
mutex.h \
+ rrd_strtod.h \
rrd_snprintf.h \
rrd_getopt.h rrd_parsetime.h \
rrd_config_bottom.h rrd_i18n.h \
rrdcached_SOURCES = rrd_daemon.c
rrdcached_DEPENDENCIES = librrd_th.la
rrdcached_CPPFLAGS = -DVERSION='"$(VERSION)"' -DLOCALSTATEDIR='"$(localstatedir)"'
-rrdcached_LDADD = librrd_th.la $(ALL_LIBS)
+rrdcached_LDADD = rrd_strtod.o librrd_th.la $(ALL_LIBS)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = librrd.pc
#include <locale.h>
#endif
+#include "rrd_strtod.h"
#include "rrd.h"
#include "rrd_tool.h"
#include "rrd_client.h"
char *str_key;
char **str_array;
char *endptr;
- char *old_locale;
int status;
size_t i;
/* Enforce the "C" locale so that parsing of the response is not dependent on
* the locale. For example, when using a German locale the strtod() function
* will expect a comma as the decimal separator, i.e. "42,77". */
- old_locale = setlocale (LC_NUMERIC, "C");
-
for (i = 0; i < array_len; i++)
{
endptr = NULL;
- array[i] = (rrd_value_t) strtod (str_array[i], &endptr);
+ array[i] = (rrd_value_t) rrd_strtod (str_array[i], &endptr);
if ((endptr == str_array[i]) || (errno != 0))
{
- (void) setlocale (LC_NUMERIC, old_locale);
free(str_array);
return (-1);
}
}
- (void) setlocale (LC_NUMERIC, old_locale);
free(str_array);
return (0);
} /* }}} int parse_value_array_header */
|| (strcmp ("TreeNodesNumber", key) == 0))
{
s->type = RRDC_STATS_TYPE_GAUGE;
- s->value.gauge = strtod (value, &endptr);
+ s->value.gauge = rrd_strtod (value, &endptr);
}
else if ((strcmp ("DataSetsWritten", key) == 0)
|| (strcmp ("FlushesReceived", key) == 0)
#include <locale.h>
#include <math.h>
+#include "rrd_strtod.h"
#include "rrd_tool.h"
#include "rrd_rpncalc.h"
#include "rrd_hw.h"
ds_def_t *ds_def)
{
char minstr[DS_NAM_SIZE], maxstr[DS_NAM_SIZE];
- char *old_locale;
const char *parsetime_error = NULL;
/*
&(rrd -> ds_def[ds_idx].par[DS_mrhb_cnt].u_cnt),
minstr,maxstr);
*/
- old_locale = setlocale(LC_NUMERIC, "C");
do {
char numbuf[32];
size_t heartbeat_len;
if (minstr[0] == 'U' && minstr[1] == 0)
ds_def->par[DS_min_val].u_val = DNAN;
else
- ds_def->par[DS_min_val].u_val = atof(minstr);
+ ds_def->par[DS_min_val].u_val = rrd_strtod(minstr, 0);
if (maxstr[0] == 'U' && maxstr[1] == 0)
ds_def->par[DS_max_val].u_val = DNAN;
else
- ds_def->par[DS_max_val].u_val = atof(maxstr);
+ ds_def->par[DS_max_val].u_val = rrd_strtod(maxstr, 0);
if (!isnan(ds_def->par[DS_min_val].u_val) &&
!isnan(ds_def->par[DS_max_val].u_val) &&
} while (0);
if (parsetime_error)
rrd_set_error("failed to parse data source %s: %s", def, parsetime_error);
- setlocale(LC_NUMERIC, old_locale);
}
/* Create the CF_DEVPREDICT, CF_DEVSEASONAL, CF_SEASONAL, and CF_FAILURES RRAs
#include <tcpd.h>
#endif /* HAVE_LIBWRAP */
+#include "rrd_strtod.h"
#include <glib.h>
/* }}} */
/* make sure update time is always moving forward. We use double here since
update does support subsecond precision for timestamps ... */
- stamp = strtod(value, &eostamp);
+ stamp = rrd_strtod(value, &eostamp);
if (eostamp == value || eostamp == NULL || *eostamp != ':')
{
pthread_mutex_unlock(&cache_lock);
#include "rrd_tool.h"
#include "unused.h"
+#include "rrd_strtod.h"
#include <dbi/dbi.h>
#include <time.h>
switch (type) {
case DBI_TYPE_STRING:
ptmp=(char*)dbi_result_get_string_idx(result,idx);
- value=strtod(ptmp,NULL);
+ value=rrd_strtod(ptmp,NULL);
break;
case DBI_TYPE_INTEGER:
if (attr & DBI_INTEGER_SIZE1) { value=dbi_result_get_char_idx(result,idx);
}
}
/* convert to number */
- value=strtod(ptmp,NULL);
+ value=rrd_strtod(ptmp,NULL);
/* free pointer */
free(ptmp);
break;
#include "strftime.h"
#endif
+#include "rrd_strtod.h"
+
#include "rrd_tool.h"
#include "unused.h"
{
image_desc_t im;
rrd_info_t *grinfo;
- char *old_locale;
rrd_graph_init(&im);
/* a dummy surface so that we can measure text sizes for placements */
- old_locale = setlocale(LC_NUMERIC, "C");
rrd_graph_options(argc, argv, &im);
if (rrd_test_error()) {
- setlocale(LC_NUMERIC, old_locale); /* reenable locale */
rrd_info_free(im.grinfo);
im_free(&im);
return NULL;
}
if (optind >= argc) {
- setlocale(LC_NUMERIC, old_locale); /* reenable locale */
rrd_info_free(im.grinfo);
im_free(&im);
rrd_set_error("missing filename");
}
if (strlen(argv[optind]) >= MAXPATH) {
- setlocale(LC_NUMERIC, old_locale); /* reenable locale */
rrd_set_error("filename (including path) too long");
rrd_info_free(im.grinfo);
im_free(&im);
}
rrd_graph_script(argc, argv, &im, 1);
- setlocale(LC_NUMERIC, old_locale); /* reenable locale for rendering the graph */
if (rrd_test_error()) {
rrd_info_free(im.grinfo);
int stroff;
char *parsetime_error = NULL;
char scan_gtm[12], scan_mtm[12], scan_ltm[12], col_nam[12];
+ char double_str[20], double_str2[20];
time_t start_tmp = 0, end_tmp = 0;
long long_tmp;
rrd_time_value_t start_tv, end_tv;
im->forceleftspace = 1;
break;
case 'T':
- im->tabwidth = atof(optarg);
+ im->tabwidth = rrd_strtod(optarg, 0);
break;
case 'S':
im->step = atoi(optarg);
}
break;
case 'y':
-
if (strcmp(optarg, "none") == 0) {
im->draw_y_grid = 0;
break;
};
- if (sscanf(optarg, "%lf:%d", &im->ygridstep, &im->ylabfact) == 2) {
+ if (sscanf(optarg, "%[-0-9.e+]:%d", double_str , &im->ylabfact) == 2) {
+ im->ygridstep = rrd_strtod( double_str, 0 );
if (im->ygridstep <= 0) {
rrd_set_error("grid step must be > 0");
return;
break;
case 1008: /* grid-dash */
if(sscanf(optarg,
- "%lf:%lf",
- &im->grid_dash_on,
- &im->grid_dash_off) != 2) {
+ "%[-0-9.e+]:%[-0-9.e+]",
+ double_str,
+ double_str2 ) != 2) {
+ im->grid_dash_on = rrd_strtod( double_str, 0 );
+ im->grid_dash_off = rrd_strtod( double_str2, 0 );
rrd_set_error("expected grid-dash format float:float");
return;
}
week_fmt[(sizeof week_fmt)-1]='\0';
break;
case 1002: /* right y axis */
-
if(sscanf(optarg,
- "%lf:%lf",
- &im->second_axis_scale,
- &im->second_axis_shift) == 2) {
+ "%[-0-9.e+]:%[-0-9.e+]",
+ double_str,
+ double_str2 ) == 2) {
+ im->second_axis_scale = rrd_strtod( double_str, 0 );
+ im->second_axis_shift = rrd_strtod( double_str2, 0 );
if(im->second_axis_scale==0){
rrd_set_error("the second_axis_scale must not be 0");
return;
}
break;
case 'u':
- im->maxval = atof(optarg);
+ im->maxval = rrd_strtod(optarg, 0);
break;
case 'l':
- im->minval = atof(optarg);
+ im->minval = rrd_strtod(optarg, 0);
break;
case 'b':
im->base = atol(optarg);
double size = 1;
int end;
- if (sscanf(optarg, "%10[A-Z]:%lf%n", prop, &size, &end) >= 2) {
+ if (sscanf(optarg, "%10[A-Z]:%[-0-9.e+]%n", prop, double_str, &end) >= 2) {
+ size = rrd_strtod( double_str, 0 );
int sindex, propidx;
if ((sindex = text_prop_conv(prop)) != -1) {
break;
}
case 'm':
- im->zoom = atof(optarg);
+ im->zoom = rrd_strtod(optarg, 0);
if (im->zoom <= 0.0) {
rrd_set_error("zoom factor must be > 0");
return;
* so the parsing is rather simple. Change if needed.
*/
double param;
- char func[30];
+ char func[30], double_str[12];
int n;
n = 0;
- sscanf(str, "%le,%29[A-Z]%n", ¶m, func, &n);
+ sscanf(str, "%[-0-9.e+],%29[A-Z]%n", double_str, func, &n);
+ param = rrd_strtod( double_str, 0 );
if (n == (int) strlen(str)) { /* matched */
;
} else {
#endif
#include "rrd_graph.h"
+#include "rrd_strtod.h"
#define dprintf(...) if (gdp->debug&1) fprintf(stderr,__VA_ARGS__);
#define dprintfparsed(...) if (gdp->debug&2) fprintf(stderr,__VA_ARGS__);
int getDouble(const char* v, double *val,char**extra) {
/* try to execute the parser */
/* NOTE that this may be a bit different from the original parser */
- char *old_locale;
*extra=NULL;
- old_locale = setlocale(LC_NUMERIC, "C");
errno = 0;
- *val = strtod(v,extra);
+ *val = rrd_strtod(v,extra);
if (errno > 0) {
rrd_set_error("converting '%s' to float: %s", v, rrd_strerror(errno));
- setlocale(LC_NUMERIC, old_locale);
return -1;
};
- setlocale(LC_NUMERIC, old_locale);
- *val=strtod(v,extra);
+ *val=rrd_strtod(v,extra);
/* and error handling */
if (extra==NULL) {
return 0;
#include "rrd_rpncalc.h"
#include "rrd_restore.h"
#include "unused.h"
+#include "rrd_strtod.h"
#include <stdio.h>
#include <stdlib.h>
return 0;
}
errno = 0;
- temp = strtod((char *)text,NULL);
+ temp = rrd_strtod((char *)text,NULL);
if (errno>0){
rrd_set_error("ling %d: get_xml_double from '%s' %s",
xmlTextReaderGetParserLineNumber(reader),
char **argv)
{
rrd_t *rrd;
- char *old_locale;
/* init rrd clean */
optind = 0;
opterr = 0; /* initialize getopt */
return (-1);
}
- old_locale = setlocale(LC_NUMERIC, "C");
-
rrd = parse_file(argv[optind]);
- setlocale(LC_NUMERIC, old_locale);
-
if (rrd == NULL)
return (-1);
#include <locale.h>
#include <stdlib.h>
+#include "rrd_strtod.h"
#include "rrd_tool.h"
#include "rrd_rpncalc.h"
// #include "rrd_graph.h"
long steps = -1;
rpnp_t *rpnp;
char vname[MAX_VNAME_LEN + 10];
- char *old_locale;
-
- old_locale = setlocale(LC_NUMERIC, "C");
+ char double_str[20];
rpnp = NULL;
expr = (char *) expr_const;
while (*expr) {
if ((rpnp = (rpnp_t *) rrd_realloc(rpnp, (++steps + 2) *
sizeof(rpnp_t))) == NULL) {
- setlocale(LC_NUMERIC, old_locale);
return NULL;
}
- else if ((sscanf(expr, "%lf%n", &rpnp[steps].val, &pos) == 1)
+ else if ((sscanf(expr, "%[-0-9.e+]%n", double_str, &pos) == 1)
&& (expr[pos] == ',')) {
+ rpnp[steps].val = rrd_strtod( double_str, 0 );
rpnp[steps].op = OP_NUMBER;
expr += pos;
}
else {
rrd_set_error("don't undestand '%s'",expr);
- setlocale(LC_NUMERIC, old_locale);
free(rpnp);
return NULL;
}
if (*expr == ',')
expr++;
else {
- setlocale(LC_NUMERIC, old_locale);
free(rpnp);
return NULL;
}
}
rpnp[steps + 1].op = OP_END;
- setlocale(LC_NUMERIC, old_locale);
return rpnp;
}
#include <stdlib.h>
#include <locale.h>
+#include "rrd_strtod.h"
#include "rrd_tool.h"
#include "rrd_rpncalc.h"
#include "rrd_hw.h"
char ds_nam[DS_NAM_SIZE];
char ds_new[DS_NAM_SIZE];
long heartbeat;
- double min;
- double max;
+ double min = 0;
+ double max = 0;
char dst[DST_SIZE];
int rc = -1;
int opt_newstep = -1;
rrd_file_t *rrd_file = NULL;
char *opt_daemon = NULL;
+ char double_str[ 12 ];
struct option long_options[] = {
{"heartbeat", required_argument, 0, 'h'},
{"minimum", required_argument, 0, 'i'},
{"daemon", required_argument, 0, 'D'},
{0, 0, 0, 0}
};
- char *old_locale = setlocale(LC_NUMERIC, "C");
optind = 0;
opterr = 0; /* initialize getopt */
case 'i':
if ((matches =
- sscanf(optarg, DS_NAM_FMT ":%lf", ds_nam, &min)) < 1) {
+ sscanf(optarg, DS_NAM_FMT ":%[-0-9.e+]", ds_nam, double_str)) < 1) {
rrd_set_error("invalid arguments for minimum ds value");
goto done;
}
+ min = rrd_strtod( double_str, 0 );
if ((ds = ds_match(&rrd, ds_nam)) == -1) {
goto done;
}
case 'a':
if ((matches =
- sscanf(optarg, DS_NAM_FMT ":%lf", ds_nam, &max)) < 1) {
+ sscanf(optarg, DS_NAM_FMT ":%[-0-9.e+]", ds_nam, double_str)) < 1) {
rrd_set_error("invalid arguments for maximum ds value");
goto done;
}
+ max = rrd_strtod( double_str, 0 );
if ((ds = ds_match(&rrd, ds_nam)) == -1) {
goto done;
}
rc = 0;
done:
- if (old_locale) {
- setlocale(LC_NUMERIC, old_locale);
- }
if (rrd_file) {
rrd_close(rrd_file);
}
signed short rra_idx = -1;
/* read the value */
- param = atof(arg);
+ param = rrd_strtod(arg, 0);
if (param <= 0.0 || param >= 1.0) {
rrd_set_error("Holt-Winters parameter must be between 0 and 1");
return -1;
signed short rra_idx = -1;
/* read the value */
- param = atof(arg);
+ param = rrd_strtod(arg, 0);
/* in order to avoid smoothing of SEASONAL or DEVSEASONAL, we need to
* the 0.0 value*/
if (param < 0.0 || param > 1.0) {
unsigned long i;
signed short rra_idx = -1;
- param = atof(arg);
+ param = rrd_strtod(arg, 0);
if (param < 0.1) {
rrd_set_error("Parameter specified is too small");
return -1;
#include "rrd_update.h"
#include <glib.h>
+#include "rrd_strtod.h"
+
#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
/*
{
double tmp;
char *parsetime_error = NULL;
- char *old_locale;
rrd_time_value_t ds_tv;
struct timeval tmp_time; /* used for time conversion */
*current_time = tmp_time.tv_sec;
*current_time_usec = tmp_time.tv_usec;
} else {
- old_locale = setlocale(LC_NUMERIC, "C");
errno = 0;
- tmp = strtod(updvals[0], 0);
+ tmp = rrd_strtod(updvals[0], 0);
if (errno > 0) {
rrd_set_error("converting '%s' to float: %s",
updvals[0], rrd_strerror(errno));
return -1;
};
- setlocale(LC_NUMERIC, old_locale);
if (tmp < 0.0){
gettimeofday(&tmp_time, 0);
tmp = (double)tmp_time.tv_sec + (double)tmp_time.tv_usec * 1e-6f + tmp;
int ii;
char *endptr; /* used in the conversion */
double rate;
- char *old_locale;
enum dst_en dst_idx;
for (ds_idx = 0; ds_idx < rrd->stat_head->ds_cnt; ds_idx++) {
}
break;
case DST_ABSOLUTE:
- old_locale = setlocale(LC_NUMERIC, "C");
errno = 0;
- pdp_new[ds_idx] = strtod(updvals[ds_idx + 1], &endptr);
+ pdp_new[ds_idx] = rrd_strtod(updvals[ds_idx + 1], &endptr);
if (errno > 0) {
rrd_set_error("converting '%s' to float: %s",
updvals[ds_idx + 1], rrd_strerror(errno));
return -1;
};
- setlocale(LC_NUMERIC, old_locale);
if (endptr[0] != '\0') {
rrd_set_error
("conversion of '%s' to float not complete: tail '%s'",
rate = pdp_new[ds_idx] / interval;
break;
case DST_GAUGE:
- old_locale = setlocale(LC_NUMERIC, "C");
errno = 0;
pdp_new[ds_idx] =
- strtod(updvals[ds_idx + 1], &endptr) * interval;
+ rrd_strtod(updvals[ds_idx + 1], &endptr) * interval;
if (errno) {
rrd_set_error("converting '%s' to float: %s",
updvals[ds_idx + 1], rrd_strerror(errno));
return -1;
};
- setlocale(LC_NUMERIC, old_locale);
if (endptr[0] != '\0') {
rrd_set_error
("conversion of '%s' to float not complete: tail '%s'",
#include <fcntl.h>
#endif
+#include "rrd_snprintf.h"
+
int rrd_xport(
int,
char **,
grinfo_push(im, sprintf_alloc("graph_step"), RD_I_CNT, info);
/* set locale */
- char *old_locale = setlocale(LC_NUMERIC, "C");
/* format it for output */
int r=0;
default:
break;
}
- /* restore locale */
- setlocale(LC_NUMERIC, old_locale);
/* handle errors */
if (r) {
/* free legend */
rrd_value_t v=*ptr;ptr++;
/* and print it */
if (isnan(v)) {
- snprintf(buf,255,"%c\"NaN\"",sep);
+ snprintf(buf,255,"%c\"NaN\"",sep);
} else {
- snprintf(buf,255,"%c\"%0.10e\"",sep,v);
+ rrd_snprintf(buf,255,"%c\"%0.10e\"",sep,v);
}
if (addToBuffer(buffer,buf,0)) { return 1;}
}
snprintf(buf,sizeof(buf)," \"%s\": %lld,\n",META_STEP_TAG,(long long int)step);
addToBuffer(buffer,buf,0);
} else {
- snprintf(buf,sizeof(buf)," <%s>%lld</%s>\n",META_STEP_TAG,(long long int)step,META_STEP_TAG);
+ snprintf(buf,sizeof(buf)," <%s>%lld</%s>\n",META_STEP_TAG,(long long int)step,META_STEP_TAG);
addToBuffer(buffer,buf,0);
- snprintf(buf,sizeof(buf)," <%s>%lu</%s>\n",META_ROWS_TAG,row_cnt,META_ROWS_TAG);
+ snprintf(buf,sizeof(buf)," <%s>%lu</%s>\n",META_ROWS_TAG,row_cnt,META_ROWS_TAG);
addToBuffer(buffer,buf,0);
- snprintf(buf,sizeof(buf)," <%s>%lu</%s>\n",META_COLS_TAG,col_cnt,META_COLS_TAG);
+ snprintf(buf,sizeof(buf)," <%s>%lu</%s>\n",META_COLS_TAG,col_cnt,META_COLS_TAG);
addToBuffer(buffer,buf,0);
}
}
else {
if (showtime) {
- snprintf(buf,sizeof(buf),
- " <%s><%s>%s</%s>", DATA_ROW_TAG,COL_TIME_TAG, dbuf, COL_TIME_TAG);
+ snprintf(buf,sizeof(buf),
+ " <%s><%s>%s</%s>", DATA_ROW_TAG,COL_TIME_TAG, dbuf, COL_TIME_TAG);
} else {
- snprintf(buf,sizeof(buf),
- " <%s>", DATA_ROW_TAG);
+ snprintf(buf,sizeof(buf),
+ " <%s>", DATA_ROW_TAG);
}
addToBuffer(buffer,buf,0);
}
if (isnan(newval) || isinf(newval)){
addToBuffer(buffer,"null",0);
} else {
- snprintf(buf,sizeof(buf),"%0.10e",newval);
+ rrd_snprintf(buf,sizeof(buf),"%0.10e",newval);
addToBuffer(buffer,buf,0);
}
if (j < col_cnt -1){
else {
if (isnan(newval)) {
if (enumds) {
- snprintf(buf,sizeof(buf),"<%s%lu>NaN</%s%lu>", COL_DATA_TAG,j,COL_DATA_TAG,j);
+ snprintf(buf,sizeof(buf),"<%s%lu>NaN</%s%lu>", COL_DATA_TAG,j,COL_DATA_TAG,j);
} else {
- snprintf(buf,sizeof(buf),"<%s>NaN</%s>", COL_DATA_TAG,COL_DATA_TAG);
+ snprintf(buf,sizeof(buf),"<%s>NaN</%s>", COL_DATA_TAG,COL_DATA_TAG);
}
} else {
if (enumds) {
- snprintf(buf,sizeof(buf),"<%s%lu>%0.10e</%s%lu>", COL_DATA_TAG,j,newval,COL_DATA_TAG,j);
+ rrd_snprintf(buf,sizeof(buf),"<%s%lu>%0.10e</%s%lu>", COL_DATA_TAG,j,newval,COL_DATA_TAG,j);
} else {
- snprintf(buf,sizeof(buf),"<%s>%0.10e</%s>", COL_DATA_TAG,newval,COL_DATA_TAG);
+ rrd_snprintf(buf,sizeof(buf),"<%s>%0.10e</%s>", COL_DATA_TAG,newval,COL_DATA_TAG);
}
}
addToBuffer(buffer,buf,0);
("bad format for PRINT in \"%s'", im->gdes[i].format);
return -1;
} else {
- snprintf(dbuf,sizeof(dbuf), im->gdes[i].format, printval,"");
+ rrd_snprintf(dbuf,sizeof(dbuf), im->gdes[i].format, printval,"");
}
/* print */
if (json) {
escapeJSON(dbuf,sizeof(dbuf));
- snprintf(buf,sizeof(buf),",\n { \"%s\": \"%s\" }",usetag,dbuf);
+ snprintf(buf,sizeof(buf),",\n { \"%s\": \"%s\" }",usetag,dbuf);
} else {
- snprintf(buf,sizeof(buf)," <%s>%s</%s>\n",usetag,dbuf,usetag);
+ snprintf(buf,sizeof(buf)," <%s>%s</%s>\n",usetag,dbuf,usetag);
}
addToBuffer(usebuffer,buf,0); }
break;
if (json) {
strncpy(dbuf,im->gdes[i].legend,sizeof(dbuf));
escapeJSON(dbuf,sizeof(dbuf));
- snprintf(buf,sizeof(buf),",\n { \"comment\": \"%s\" }",dbuf);
+ snprintf(buf,sizeof(buf),",\n { \"comment\": \"%s\" }",dbuf);
} else {
- snprintf(buf,sizeof(buf)," <comment>%s</comment>\n",im->gdes[i].legend);
+ snprintf(buf,sizeof(buf)," <comment>%s</comment>\n",im->gdes[i].legend);
}
addToBuffer(&gprints,buf,0);
break;
/* I do not know why the legend is "spaced", but let us skip it */
while(isspace(*entry)){entry++;}
if (json) {
- snprintf(buf,sizeof(buf),",\n { \"line\": \"%s\" }",entry);
+ snprintf(buf,sizeof(buf),",\n { \"line\": \"%s\" }",entry);
} else {
- snprintf(buf,sizeof(buf)," <line>%s</line>\n",entry);
+ snprintf(buf,sizeof(buf)," <line>%s</line>\n",entry);
}
addToBuffer(&gprints,buf,0);
break;
case GF_AREA:
if (json) {
- snprintf(buf,sizeof(buf),",\n { \"area\": \"%s\" }",im->gdes[i].legend);
+ snprintf(buf,sizeof(buf),",\n { \"area\": \"%s\" }",im->gdes[i].legend);
} else {
- snprintf(buf,sizeof(buf)," <area>%s</area>\n",im->gdes[i].legend);
+ snprintf(buf,sizeof(buf)," <area>%s</area>\n",im->gdes[i].legend);
}
addToBuffer(&gprints,buf,0);
break;
case GF_STACK:
if (json) {
- snprintf(buf,sizeof(buf),",\n { \"stack\": \"%s\" }",im->gdes[i].legend);
+ snprintf(buf,sizeof(buf),",\n { \"stack\": \"%s\" }",im->gdes[i].legend);
} else {
- snprintf(buf,sizeof(buf)," <stack>%s</stack>\n",im->gdes[i].legend);
+ snprintf(buf,sizeof(buf)," <stack>%s</stack>\n",im->gdes[i].legend);
}
addToBuffer(&gprints,buf,0);
break;
case TXA_JUSTIFIED: val="justified"; break;
}
if (json) {
- snprintf(buf,sizeof(buf),",\n { \"align\": \"%s\" }",val);
+ snprintf(buf,sizeof(buf),",\n { \"align\": \"%s\" }",val);
} else {
- snprintf(buf,sizeof(buf)," <align>%s</align>\n",val);
+ snprintf(buf,sizeof(buf)," <align>%s</align>\n",val);
}
addToBuffer(&gprints,buf,0);
break;
case GF_HRULE:
/* This does not work as expected - Tobi please help!!! */
- snprintf(dbuf,sizeof(dbuf),"%0.10e",im->gdes[i].vf.val);
+ rrd_snprintf(dbuf,sizeof(dbuf),"%0.10e",im->gdes[i].vf.val);
/* and output it */
if (json) {
snprintf(buf,sizeof(buf),",\n { \"hrule\": \"%s\" }",dbuf);
localtime_r(&im->gdes[i].xrule,&loc);
strftime(dbuf,254,timefmt,&loc);
} else {
- snprintf(dbuf,254,"%lld",(long long int)im->gdes[i].vf.when);
+ snprintf(dbuf,254,"%lld",(long long int)im->gdes[i].vf.when);
}
/* and output it */
if (json) {