[rrd-developers] Re: Calling rrd functions from within "C"

Nikolaos Abatzis nabatzis at blackboard.com
Thu Dec 14 18:18:51 MET 2000

Here is the problem and the solution.

RRD functions WRONGLY assume that they are called from the command line and
use getopt to parse arguments. Getopt uses a static int named "optind" to
keep track which argument is checking as an option. So if in your program
you use getopt to parse any arguments you must RESET "optind" by setting it
to 0 before calling the rrd_* function that will call it again.

A fix would be to have wrapper functions that check the arguments and call
rrd_* utils with the proper arguments. RRD_* functions would have to accept
varying numbers of arguments, something posible in C and the whole problem
is fixed.

Nikolaos Abatzis
Blackboard Inc.

Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-developers
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

More information about the rrd-developers mailing list