From 2256abbc11f3057e032d31aac78a92487cd6f8d9 Mon Sep 17 00:00:00 2001 From: oetiker Date: Tue, 19 Nov 2002 22:33:09 +0000 Subject: [PATCH] added g as valid string format value git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@168 a5681a0c-68f1-0310-ab6d-d61299d08faa --- doc/rrdgraph-old.pod | 2 +- doc/rrdgraph_graph.src | 12 +++++++++--- src/rrd_graph.c | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/doc/rrdgraph-old.pod b/doc/rrdgraph-old.pod index b464c42..eb0456f 100644 --- a/doc/rrdgraph-old.pod +++ b/doc/rrdgraph-old.pod @@ -399,7 +399,7 @@ message but not a I fourtytwo that's always equal to 42. Calculate the chosen consolidation function I over the data-source variable I and C the result to stdout using I. -In the I string there should be a '%lf' or '%le' marker in the +In the I string there should be a '%lf', '%le' or'%lg' marker in the place where the number should be printed. If an additional '%s' is found AFTER the marker, the value will be scaled diff --git a/doc/rrdgraph_graph.src b/doc/rrdgraph_graph.src index 5b163d4..aa116f5 100644 --- a/doc/rrdgraph_graph.src +++ b/doc/rrdgraph_graph.src @@ -85,15 +85,21 @@ B<%%> just prints a literal '%' character =item * -B<%#.#le> (where # is an optional number) prints like 1.2346e+04 +B<%#.#le> prints like 1.2346e+04. Optional numbers # are field width and +decimal precision =item * -B<%#.#lf> prints like 12345.6789 +B<%#.#lf> prints like 12345.6789, with optional field width and precision =item * -B<%s> place this after B<%le> or B<%lf>. This will be replaced by the +B<%#.#lg> prints like 12345.6789, with optional field width and number of +significant digits + +=item * + +B<%s> place this after B<%le>, B<%lf> or B<%lg>. This will be replaced by the appropriate SI magnitude unit and the value will be scaled accordingly (123456 -> 123.456 k) diff --git a/src/rrd_graph.c b/src/rrd_graph.c index 8d21d70..b895225 100644 --- a/src/rrd_graph.c +++ b/src/rrd_graph.c @@ -3064,9 +3064,9 @@ int bad_format(char *fmt) { if (*ptr == '.') ptr++; while (*ptr >= '0' && *ptr <= '9') ptr++; - /* Either 'le' or 'lf' must follow here */ + /* Either 'le', 'lf' or 'lg' must follow here */ if (*ptr++ != 'l') return 1; - if (*ptr == 'e' || *ptr == 'f') ptr++; + if (*ptr == 'e' || *ptr == 'f' || *ptr == 'g') ptr++; else return 1; n++; } -- 2.11.0