From: oetiker Date: Tue, 19 Nov 2002 22:33:09 +0000 (+0000) Subject: added g as valid string format value X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=bdc919b5c5713db4cf3647eefe538c906f5bfeb1;p=rrdtool-all.git added g as valid string format value git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@168 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/program/doc/rrdgraph-old.pod b/program/doc/rrdgraph-old.pod index b464c426..eb0456f9 100644 --- a/program/doc/rrdgraph-old.pod +++ b/program/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/program/doc/rrdgraph_graph.src b/program/doc/rrdgraph_graph.src index 5b163d40..aa116f59 100644 --- a/program/doc/rrdgraph_graph.src +++ b/program/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/program/src/rrd_graph.c b/program/src/rrd_graph.c index 8d21d707..b8952250 100644 --- a/program/src/rrd_graph.c +++ b/program/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++; }