aboutsummaryrefslogtreecommitdiffstats
path: root/libibex/dumpindex.c
blob: 92f4b088458ad82dfa70e227d0a7bbd1a2f1ca39 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
  Dump the hash tables from an ibex file.
 */

#include <stdio.h>
#include <stdlib.h>

#include "ibex_internal.h"

extern void ibex_hash_dump(struct _IBEXIndex *index);

int main(int argc, char **argv)
{
    ibex *ib;

    if (argc != 2) {
        printf("Usage: %s ibexfile\n", argv[0]);
        return 1;
    }
    ib = ibex_open(argv[1], O_RDONLY, 0);
    if (ib == NULL) {
        perror("Opening ibex file\n");
        return 1;
    }

    ibex_hash_dump(ib->words->wordindex);
    ibex_hash_dump(ib->words->nameindex);

    ibex_close(ib);

    return 0;
}