Code

da82e48b203be609ca879f356535ee5fb5517412
[pkg-rrdtool.git] / doc / librrd.txt
1 LIBRRD(1)                           rrdtool                          LIBRRD(1)
5 N\bNA\bAM\bME\bE
6        librrd - RRD library functions
8 D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
9        l\bli\bib\bbr\brr\brd\bd contains most of the functionality in R\bRR\bRD\bDT\bTo\boo\bol\bl.  The command line
10        utilities and language bindings are often just wrappers around the code
11        contained in l\bli\bib\bbr\brr\brd\bd.
13        This manual page documents the l\bli\bib\bbr\brr\brd\bd API.
15        N\bNO\bOT\bTE\bE:\b: This document is a work in progress, and should be considered
16        incomplete as long as this warning persists.  For more information
17        about the l\bli\bib\bbr\brr\brd\bd functions, always consult the source code.
19 U\bUT\bTI\bIL\bLI\bIT\bTY\bY F\bFU\bUN\bNC\bCT\bTI\bIO\bON\bNS\bS
20        _\br\br_\br\br_\bd\bd_\b_\b__\br\br_\ba\ba_\bn\bn_\bd\bd_\bo\bo_\bm\bm_\b(\b(_\b)\b)
21            Generates random numbers just like _\br_\ba_\bn_\bd_\bo_\bm_\b(_\b).  This further ensures
22            that the random number generator is seeded exactly once per pro-
23            cess.
25        r\brr\brd\bd_\b_a\bad\bdd\bd_\b_p\bpt\btr\br(\b(v\bvo\boi\bid\bd *\b**\b**\b*d\bde\bes\bst\bt,\b, s\bsi\biz\bze\be_\b_t\bt *\b*d\bde\bes\bst\bt_\b_s\bsi\biz\bze\be,\b, v\bvo\boi\bid\bd *\b*s\bsr\brc\bc)\b)
26            Dynamically resize the array pointed to by "dest".  "dest_size" is
27            a pointer to the current size of "dest".  Upon successful _\br_\be_\ba_\bl_\b-
28            _\bl_\bo_\bc_\b(_\b), the "dest_size" is incremented by 1 and the "src" pointer is
29            stored at the end of the new "dest".  Returns 1 on success, 0 on
30            failure.
32                type **arr = NULL;
33                type *elem = "whatever";
34                size_t arr_size = 0;
35                if (!rrd_add_ptr(&arr, &arr_size, elem))
36                    handle_failure();
38        r\brr\brd\bd_\b_a\bad\bdd\bd_\b_s\bst\btr\brd\bdu\bup\bp(\b(c\bch\bha\bar\br *\b**\b**\b*d\bde\bes\bst\bt,\b, s\bsi\biz\bze\be_\b_t\bt *\b*d\bde\bes\bst\bt_\b_s\bsi\biz\bze\be,\b, c\bch\bha\bar\br *\b*s\bsr\brc\bc)\b)
39            Like "rrd_add_ptr", except adds a "strdup" of the source string.
41                char **arr = NULL;
42                size_t arr_size = NULL;
43                char *str  = "example text";
44                if (!rrd_add_strdup(&arr, &arr_size, str))
45                    handle_failure();
47        r\brr\brd\bd_\b_f\bfr\bre\bee\be_\b_p\bpt\btr\brs\bs(\b(v\bvo\boi\bid\bd *\b**\b**\b*s\bsr\brc\bc,\b, s\bsi\biz\bze\be_\b_t\bt *\b*c\bcn\bnt\bt)\b)
48            Free an array of pointers allocated by "rrd_add_ptr" or
49            "rrd_add_strdup".  Also frees the array pointer itself.  On return,
50            the source pointer will be NULL and the count will be zero.
52                /* created as above */
53                rrd_free_ptrs(&arr, &arr_size);
54                /* here, arr == NULL && arr_size == 0 */
58 1.3.99909060808                   2009-04-20                         LIBRRD(1)