[rrd-users] Re: C documentation?

Jason Fesler jfesler at gigo.com
Tue Jun 24 17:20:27 MEST 2003


> I noticed some declarations in rrd.h and I was able to link some code to
> try out calling rrd_create(), but I couldn't find any documentation on
> this (or any of the other rrd_ functions).

the rrd* man pages for the "rrdtool" commands is your best guide;

> My guess is that the first argument is the number of string arguments,
> and the second is an array of character strings.  Can someone confirm
> this?

This is true.  You specifically generate ascii strings, and build up an
argc/argv pair.  The first string in argv would be "create" or "update"
etc.

I snarfed CountArgs and CreateArgs from rrd_tool.c , and used them roughly
like this:

argc = CountArgs (buffer);
      if ((myargv = (char **) malloc ((argc + 1) * sizeof (char *))) == NULL)
        {
          perror ("malloc");
          exit (1);
        }

      if ((argc = CreateArgs ("portstats", buffer, argc, myargv)) < 0)
        {
          fprintf (stderr, "ERROR: creating arguments\n");
          exit (1);
        }
      result = rrd_create (argc - 1, &myargv[1]);
      free (myargv);

--
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://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list