[rrd-users] Re: librrd / C API Documentation

Tobias Oetiker oetiker at ee.ethz.ch
Thu Sep 8 10:59:25 MEST 2005


Today Andreas Maus wrote:
> PITFALLS AND COMMON PROBLEMS:
>
> A lot of obscure problems arise if you forget about the variables optind and opterr.
> These variables are declared in the getopt headerfile (used for parsing the options)
> as _global_ ! So you have to set these variables back to 0 _before_ you call any
> rrd_* function in your program.
>
> Final code snippet:
>
> So finally your update of a rrd-database from your C program would look like:
>
> [... snipp ...]
>
> /* Code that fills rrd_argv and sets rrd_argc to the correct values */
> optind=0;opterr=0;
> rrd_clear_error();
> rrd_ret=rrd_update(rrd_argc,rrd_argv);
>
> if (rrd_test_error()!=0)
> {
>   /* Handle error condition */
>
> }
>
> [... snipp ...]

Andreas,

note that setting optind and opterr is not necessary anymore with
the latest rrdtool versions ...

cheers
tobi

-- 
 ______    __   _
/_  __/_  / /  (_) Oetiker @ ISG.EE, ETL F24.2, ETH, CH-8092 Zurich
 / // _ \/ _ \/ /  System Manager, Time Lord, Coder, Designer, Coach
/_/ \.__/_.__/_/   http://people.ee.ethz.ch/oetiker +41(0)44-632-5286

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



More information about the rrd-users mailing list