Ticket #95 (closed defect: wontfix)
xgrid parsing in librrd
| Reported by: | human | Owned by: | oetiker |
|---|---|---|---|
| Priority: | trivial | Milestone: | |
| Component: | rrd_graph | Version: | |
| Keywords: | x-grid | Cc: |
Description
Hi Tobi, i had a problem submitting a x-grid string to the rrd_graph function in a C program. Whatever i tried (except '-x none'), i got "invalid x-grid format" if i used the whole "-x GTM:GST:MTM:MST:LTM:LST:LPR:LFM" string as an argv[] entry. Looking in the source of rrd_graph.c i found that you use "%10[A-Z]..." for the sscanf function. As of the man page of sscanf, that doesn't "strip" whitespaces from the beginning of the string to parse ("... The usual skip of leading white space is suppressed..."). Changing the format string to " %10[A-Z]..." (adding a space at the beginning) solved that issue. Splitting the option into two strings ("-x" and "GTM:GST:MTM:MST:LTM:LST:LPR:LFM") for argv[] to rrd_graph() seems to work too. I will use the second workaround for now, but it would be great to take care of that.
Thanks Mario mjentsch at cogentco dot com



Mario, this is the intended behaviour ... valid formats are
-sARG --long=ARG -s ARG --long ARG
where white space means a split in the argument ...
if you send
"-s ARG" as one argument this is essentially "-s"," ARG" which is just wrong
cheers tobi
--long-option=xyx