long long_tmp;
struct rrd_time_value start_tv, end_tv;
long unsigned int color;
+ char *old_locale = "";
+
/* defines for long options without a short equivalent. should be bytes,
and may not collide with (the ASCII value of) short options */
#define LONGOPT_UNITS_SI 255
- struct option long_options[] = {
- {"start", required_argument, 0, 's'},
- {"end", required_argument, 0, 'e'},
- {"x-grid", required_argument, 0, 'x'},
- {"y-grid", required_argument, 0, 'y'},
- {"vertical-label", required_argument, 0, 'v'},
- {"width", required_argument, 0, 'w'},
- {"height", required_argument, 0, 'h'},
- {"full-size-mode", no_argument, 0, 'D'},
- {"interlaced", no_argument, 0, 'i'},
- {"upper-limit", required_argument, 0, 'u'},
- {"lower-limit", required_argument, 0, 'l'},
- {"rigid", no_argument, 0, 'r'},
- {"base", required_argument, 0, 'b'},
- {"logarithmic", no_argument, 0, 'o'},
- {"color", required_argument, 0, 'c'},
- {"font", required_argument, 0, 'n'},
- {"title", required_argument, 0, 't'},
- {"imginfo", required_argument, 0, 'f'},
- {"imgformat", required_argument, 0, 'a'},
- {"lazy", no_argument, 0, 'z'},
- {"zoom", required_argument, 0, 'm'},
- {"no-legend", no_argument, 0, 'g'},
- {"force-rules-legend", no_argument, 0, 'F'},
- {"only-graph", no_argument, 0, 'j'},
- {"alt-y-grid", no_argument, 0, 'Y'},
- {"no-minor", no_argument, 0, 'I'},
- {"slope-mode", no_argument, 0, 'E'},
- {"alt-autoscale", no_argument, 0, 'A'},
- {"alt-autoscale-min", no_argument, 0, 'J'},
- {"alt-autoscale-max", no_argument, 0, 'M'},
- {"no-gridfit", no_argument, 0, 'N'},
- {"units-exponent", required_argument, 0, 'X'},
- {"units-length", required_argument, 0, 'L'},
- {"units", required_argument, 0, LONGOPT_UNITS_SI},
- {"step", required_argument, 0, 'S'},
- {"tabwidth", required_argument, 0, 'T'},
- {"font-render-mode", required_argument, 0, 'R'},
- {"graph-render-mode", required_argument, 0, 'G'},
- {"font-smoothing-threshold", required_argument, 0, 'B'},
- {"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 */
- {0, 0, 0, 0}
- };
+ struct option long_options[] = {
+ {"start", required_argument, 0, 's'},
+ {"end", required_argument, 0, 'e'},
+ {"x-grid", required_argument, 0, 'x'},
+ {"y-grid", required_argument, 0, 'y'},
+ {"vertical-label", required_argument, 0, 'v'},
+ {"width", required_argument, 0, 'w'},
+ {"height", required_argument, 0, 'h'},
+ {"full-size-mode", no_argument, 0, 'D'},
+ {"interlaced", no_argument, 0, 'i'},
+ {"upper-limit", required_argument, 0, 'u'},
+ {"lower-limit", required_argument, 0, 'l'},
+ {"rigid", no_argument, 0, 'r'},
+ {"base", required_argument, 0, 'b'},
+ {"logarithmic", no_argument, 0, 'o'},
+ {"color", required_argument, 0, 'c'},
+ {"font", required_argument, 0, 'n'},
+ {"title", required_argument, 0, 't'},
+ {"imginfo", required_argument, 0, 'f'},
+ {"imgformat", required_argument, 0, 'a'},
+ {"lazy", no_argument, 0, 'z'},
+ {"zoom", required_argument, 0, 'm'},
+ {"no-legend", no_argument, 0, 'g'},
+ {"force-rules-legend", no_argument, 0, 'F'},
+ {"only-graph", no_argument, 0, 'j'},
+ {"alt-y-grid", no_argument, 0, 'Y'},
+ {"no-minor", no_argument, 0, 'I'},
+ {"slope-mode", no_argument, 0, 'E'},
+ {"alt-autoscale", no_argument, 0, 'A'},
+ {"alt-autoscale-min", no_argument, 0, 'J'},
+ {"alt-autoscale-max", no_argument, 0, 'M'},
+ {"no-gridfit", no_argument, 0, 'N'},
+ {"units-exponent", required_argument, 0, 'X'},
+ {"units-length", required_argument, 0, 'L'},
+ {"units", required_argument, 0, LONGOPT_UNITS_SI},
+ {"step", required_argument, 0, 'S'},
+ {"tabwidth", required_argument, 0, 'T'},
+ {"font-render-mode", required_argument, 0, 'R'},
+ {"graph-render-mode", required_argument, 0, 'G'},
+ {"font-smoothing-threshold", required_argument, 0, 'B'},
+ {"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 */
+ {0, 0, 0, 0}
+ };
optind = 0;
opterr = 0; /* initialize getopt */
int option_index = 0;
int opt;
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:",
long_options, &option_index);
case LONGOPT_UNITS_SI:
if (im->extra_flags & FORCE_UNITS) {
rrd_set_error("--units can only be used once!");
+ setlocale(LC_NUMERIC,old_locale);
return;
}
if (strcmp(optarg, "si") == 0)
im->forceleftspace = 1;
break;
case 'T':
+ old_locale = setlocale(LC_NUMERIC,"C");
im->tabwidth = atof(optarg);
+ setlocale(LC_NUMERIC,old_locale);
break;
case 'S':
+ old_locale = setlocale(LC_NUMERIC,"C");
im->step = atoi(optarg);
+ setlocale(LC_NUMERIC,old_locale);
break;
case 'N':
im->gridfit = 0;
im->draw_y_grid = 0;
break;
};
-
+ old_locale=setlocale(LC_NUMERIC,"C");
if (sscanf(optarg, "%lf:%d", &im->ygridstep, &im->ylabfact) == 2) {
+ setlocale(LC_NUMERIC,old_locale);
if (im->ygridstep <= 0) {
rrd_set_error("grid step must be > 0");
return;
return;
}
} else {
+ setlocale(LC_NUMERIC,old_locale);
rrd_set_error("invalid y-grid format");
return;
}
im->ylegend[150] = '\0';
break;
case 'u':
+ old_locale=setlocale(LC_NUMERIC,"C");
im->maxval = atof(optarg);
+ setlocale(LC_NUMERIC,old_locale);
break;
case 'l':
+ old_locale=setlocale(LC_NUMERIC,"C");
im->minval = atof(optarg);
+ setlocale(LC_NUMERIC,old_locale);
break;
case 'b':
im->base = atol(optarg);
char prop[15];
double size = 1;
char font[1024] = "";
-
+ old_locale = setlocale(LC_NUMERIC,"C");
if (sscanf(optarg, "%10[A-Z]:%lf:%1000s", prop, &size, font) >= 2) {
int sindex, propidx;
-
+
+ setlocale(LC_NUMERIC,old_locale);
if ((sindex = text_prop_conv(prop)) != -1) {
for (propidx = sindex; propidx < TEXT_PROP_LAST;
propidx++) {
rrd_set_error("invalid fonttag '%s'", prop);
return;
}
- } else {
+ } else {
+ setlocale(LC_NUMERIC,old_locale);
rrd_set_error("invalid text property format");
return;
}
break;
}
case 'm':
+ old_locale=setlocale(LC_NUMERIC,"C");
im->zoom = atof(optarg);
+ setlocale(LC_NUMERIC,old_locale);
if (im->zoom <= 0.0) {
rrd_set_error("zoom factor must be > 0");
return;
double param;
char func[30];
int n;
+ char *old_locale;
n = 0;
+ old_locale = setlocale(LC_NUMERIC,"C");
sscanf(str, "%le,%29[A-Z]%n", ¶m, func, &n);
+ setlocale(LC_NUMERIC,old_locale);
if (n == (int) strlen(str)) { /* matched */
;
} else {
/* NaN < -INF < finite_values < INF */
int vdef_percent_compar(
- const void *a, const void *b)
+ const void *a,
+ const void *b)
{
/* Equality is not returned; this doesn't hurt except
* (maybe) for a little performance.