(It's discussed in the back traffic on this list) You usually have to force/reset the optxxx variables between calls, e.g.:
optind=0; /* reset gnu getopt */ opterr=0; /* no error messages */ -----Burton -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Olivier Smeesters Sent: Tuesday, May 03, 2005 2:35 AM To: [EMAIL PROTECTED] Subject: [rrd-developers] Are multiple calls to rrd lib in the same execution supported ? Hi all, I'm trying to write a wrapper around librrd that would allow me to execute several rrd create/update requests in one single process. The goal is to be able to create/update several RRD files in a single process (single fork/exec). When trying to call rrd_create twice, only the first call is correctly handled. Strangely the parameters of the second call are interpreted in the wrong order. For example: # ./build/obj/rrdctl create test.rrd --start 920804400 DS:speed:COUNTER:600:U:U RRA:AVERAGE:0.5:1:24 RRA:AVERAGE:0.5:6:10 \ create test2.rrd --start 920804401 DS:speed:COUNTER:600:U:U RRA:AVERAGE:0.5:1:24 RRA:AVERAGE:0.5:6:10 Calling "rrd_create with create test.rrd --start 920804400 DS:speed:COUNTER:600:U:U RRA:AVERAGE:0.5:1:24 RRA:AVERAGE:0.5:6:10" Returns 0 Success Calling "rrd_create with create test2.rrd --start 920804401 DS:speed:COUNTER:600:U:U RRA:AVERAGE:0.5:1:24 RRA:AVERAGE:0.5:6:10" Returns 0 Success # ls 920804401 test.rrd Clearly the first file has been created properly but for the second, the parameters are not handled as expected. Looking further deep in the existing rrd_wrapper code, I found the following two lines: > optind=0; /* reset gnu getopt */ > opterr=0; /* no error messages */ I copied them in my code and found that now it works. Was this an expected behaviour ? Any thought about this ? Thanks, Olivier Smeesters -- Olivier Smeesters Software Engineer OCTALIS S.A. Avenue Albert Einstein 2A B - 1348 Louvain la Neuve T: 010 45 68 21 F: 010 45 57 29 www.octalis.com -- Unsubscribe mailto:[EMAIL PROTECTED] Help mailto:[EMAIL PROTECTED] Archive http://lists.ee.ethz.ch/rrd-developers WebAdmin http://lists.ee.ethz.ch/lsg2.cgi -- Unsubscribe mailto:[EMAIL PROTECTED] Help mailto:[EMAIL PROTECTED] Archive http://lists.ee.ethz.ch/rrd-developers WebAdmin http://lists.ee.ethz.ch/lsg2.cgi
