summaryrefslogtreecommitdiff
path: root/rpmdb/tfalloc.c
blob: 122b3eddb7e17bba4ae38d1605a8a25660eaf9c2 (plain)
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
#include "system.h"
#include <rpmlib.h>
#include "rpmio_internal.h"
#include "falloc.h"
#include "debug.h"

#define	RPMDBFN	"/var/lib/rpm/packages.rpm"
static const char * rpmdbfn = RPMDBFN;

int main(int argc, char *argv[])
{
    int lasto = 0;
    FD_t fd;


    fd = fadOpen(rpmdbfn, O_RDONLY, 0644);
    if (fd == NULL) {
	fprintf(stderr, "fadOpen(%s) failed\n", rpmdbfn);
	exit(1);
    }
fprintf(stderr, "%s: size %d(0x%08x)\n", rpmdbfn, fadGetFileSize(fd), (unsigned) fadGetFileSize(fd));

    while ((lasto = fadNextOffset(fd, lasto)) > 0) {
fprintf(stderr, "%10d\n", lasto);
    }

    (void) Fclose(fd);

    return 0;
}