1998-07-31 06:09:42 +08:00
|
|
|
#include "system.h"
|
1996-02-21 04:55:04 +08:00
|
|
|
|
1998-09-28 06:03:52 +08:00
|
|
|
#include "rpmlib.h"
|
1996-02-21 04:55:04 +08:00
|
|
|
|
1998-03-05 00:53:24 +08:00
|
|
|
int main(int argc, char ** argv)
|
1996-02-21 04:55:04 +08:00
|
|
|
{
|
|
|
|
Header h;
|
1998-11-19 05:41:05 +08:00
|
|
|
FD_t fdi, fdo;
|
1996-02-21 04:55:04 +08:00
|
|
|
|
1996-07-08 06:12:06 +08:00
|
|
|
if (argc == 1) {
|
1998-11-19 05:41:05 +08:00
|
|
|
fdi = fdDup(0);
|
1996-07-08 06:12:06 +08:00
|
|
|
} else {
|
1998-11-19 05:41:05 +08:00
|
|
|
fdi = fdOpen(argv[1], O_RDONLY, 0644);
|
1996-02-21 04:55:04 +08:00
|
|
|
}
|
|
|
|
|
1998-11-19 05:41:05 +08:00
|
|
|
if (fdFileno(fdi) < 0) {
|
1998-09-28 06:03:52 +08:00
|
|
|
fprintf(stderr, _("cannot open %s: %s\n"), argv[1], strerror(errno));
|
1996-02-21 04:55:04 +08:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
1998-11-19 05:41:05 +08:00
|
|
|
h = headerRead(fdi, HEADER_MAGIC_YES);
|
1996-02-21 04:55:04 +08:00
|
|
|
if (!h) {
|
1998-09-28 06:03:52 +08:00
|
|
|
fprintf(stderr, _("headerRead error: %s\n"), strerror(errno));
|
1996-02-21 04:55:04 +08:00
|
|
|
exit(1);
|
|
|
|
}
|
1998-11-19 05:41:05 +08:00
|
|
|
fdClose(fdi);
|
1996-02-21 04:55:04 +08:00
|
|
|
|
1998-11-19 05:41:05 +08:00
|
|
|
fdo = fdDup(1);
|
|
|
|
headerDump(h, stdout, fdo, rpmTagTable);
|
1996-11-19 02:02:36 +08:00
|
|
|
headerFree(h);
|
1998-03-05 00:53:24 +08:00
|
|
|
|
|
|
|
return 0;
|
1996-02-21 04:55:04 +08:00
|
|
|
}
|