1996-02-21 04:55:04 +08:00
|
|
|
#include <errno.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <unistd.h>
|
1996-06-19 02:41:17 +08:00
|
|
|
#include <string.h>
|
1996-02-21 04:55:04 +08:00
|
|
|
|
|
|
|
#include "header.h"
|
|
|
|
|
|
|
|
void main(int argc, char ** argv)
|
|
|
|
{
|
|
|
|
Header h;
|
|
|
|
int fd;
|
|
|
|
|
|
|
|
if (argc != 2) {
|
|
|
|
fprintf(stderr, "dump <filespec>\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
fd = open(argv[1], O_RDONLY);
|
|
|
|
if (fd < 0) {
|
|
|
|
fprintf(stderr, "cannot open %s: %s\n", argv[1], strerror(errno));
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
h = readHeader(fd);
|
|
|
|
if (!h) {
|
|
|
|
fprintf(stderr, "readHeader error: %s\n", strerror(errno));
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
close(fd);
|
|
|
|
|
|
|
|
dumpHeader(h, stdout, 1);
|
|
|
|
freeHeader(h);
|
|
|
|
}
|
|
|
|
|
|
|
|
|