summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: efa0ab9)
raw | patch | inline | side by side (parent: efa0ab9)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Fri, 1 Feb 2008 06:52:56 +0000 (06:52 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Fri, 1 Feb 2008 06:52:56 +0000 (06:52 +0000) |
program/src/rrd_graph.c | patch | blob | history |
index 2f20623cb5ee0a3ed4b4f3af911d40efc3e1299b..8c118682f5ecb32245b942e99e570722e2e5a7a1 100644 (file)
--- a/program/src/rrd_graph.c
+++ b/program/src/rrd_graph.c
case 'n':{
char prop[15];
double size = 1;
- char font[1024] = "";
+ int end;
old_locale = setlocale(LC_NUMERIC, "C");
- if (sscanf(optarg, "%10[A-Z]:%lf:%1000s", prop, &size, font) >= 2) {
+ if (sscanf(optarg, "%10[A-Z]:%lf%n", prop, &size, &end) >= 2) {
int sindex, propidx;
setlocale(LC_NUMERIC, old_locale);
if (size > 0) {
im->text_prop[propidx].size = size;
}
- if (strlen(font) > 0) {
- strcpy(im->text_prop[propidx].font, font);
+ if (strlen(prop) > end) {
+ if (prop[end] == ':') {
+ strncpy(im->text_prop[propidx].font,
+ prop + end + 1, 255);
+ im->text_prop[propidx].font[255] = '\0';
+ } else {
+ rrd_set_error
+ ("expected after font size in '%s'",
+ prop);
+ return;
+ }
}
if (propidx == sindex && sindex != 0)
break;