Back to index

openldap  2.4.31
Defines | Functions
mfree.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "mdb.h"
#include "midl.h"

Go to the source code of this file.

Defines

#define _XOPEN_SOURCE   500 /* srandom(), random() */

Functions

int main (int argc, char *argv[])

Define Documentation

#define _XOPEN_SOURCE   500 /* srandom(), random() */

Definition at line 14 of file mfree.c.


Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 21 of file mfree.c.

{
       int rc;
       MDB_env *env;
       MDB_dbi dbi;
       MDB_val key, data;
       MDB_txn *txn;
       MDB_stat mst;
       MDB_cursor *cursor;
       ID i, j, *iptr;

       if (argc != 2) {
              fprintf(stderr, "usage: %s <pathname>\n", argv[0]);
              exit(1);
       }

       rc = mdb_env_create(&env);
       rc = mdb_env_open(env, argv[1], MDB_RDONLY, 0664);
       rc = mdb_txn_begin(env, NULL, MDB_RDONLY, &txn);
       dbi = 0;
       rc = mdb_cursor_open(txn, dbi, &cursor);
       while ((rc = mdb_cursor_get(cursor, &key, &data, MDB_NEXT)) == 0) {
              printf("key: %p %zu, data: %p\n",
                     key.mv_data,  *(ID *) key.mv_data,
                     data.mv_data);
              iptr = data.mv_data;
              j = *iptr++;
              for (i=0; i<j; i++)
                     printf(" %zu\n", iptr[i]);
       }
       mdb_cursor_close(cursor);
       mdb_txn_abort(txn);
       mdb_env_close(env);

       return 0;
}

Here is the call graph for this function: