home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 February
/
CHIP_2_98.iso
/
misc
/
src
/
rpm
/
tools
/
dump.c
next >
Wrap
C/C++ Source or Header
|
1997-09-17
|
611b
|
38 lines
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include "header.h"
#include "rpmlib.h"
void main(int argc, char ** argv)
{
Header h;
int fd;
if (argc == 1) {
fd = 0;
} else {
fd = open(argv[1], O_RDONLY, 0644);
}
if (fd < 0) {
fprintf(stderr, "cannot open %s: %s\n", argv[1], strerror(errno));
exit(1);
}
h = headerRead(fd, HEADER_MAGIC_YES);
if (!h) {
fprintf(stderr, "headerRead error: %s\n", strerror(errno));
exit(1);
}
close(fd);
headerDump(h, stdout, 1, rpmTagTable);
headerFree(h);
}