1998-07-31 06:09:42 +08:00
|
|
|
#include "system.h"
|
2005-01-18 07:58:09 +08:00
|
|
|
const char *__progname;
|
1996-02-21 04:55:04 +08:00
|
|
|
|
2007-11-23 18:47:48 +08:00
|
|
|
#include "rpmdb/header_internal.h"
|
2000-12-13 04:03:45 +08:00
|
|
|
#include "debug.h"
|
1996-02-21 04:55:04 +08:00
|
|
|
|
2007-09-18 11:53:37 +08:00
|
|
|
int main(int argc, char *argv[])
|
1996-02-21 04:55:04 +08:00
|
|
|
{
|
|
|
|
Header h;
|
1998-11-20 02:10:28 +08:00
|
|
|
FD_t fdi;
|
1996-02-21 04:55:04 +08:00
|
|
|
|
1999-09-26 23:04:03 +08:00
|
|
|
setprogname(argv[0]); /* Retrofit glibc __progname */
|
1996-07-08 06:12:06 +08:00
|
|
|
if (argc == 1) {
|
1999-11-30 22:49:45 +08:00
|
|
|
fdi = Fopen("-", "r.ufdio");
|
1996-07-08 06:12:06 +08:00
|
|
|
} else {
|
1999-11-05 05:26:08 +08:00
|
|
|
fdi = Fopen(argv[1], "r.ufdio");
|
1996-02-21 04:55:04 +08:00
|
|
|
}
|
|
|
|
|
2001-06-18 06:18:03 +08:00
|
|
|
if (Ferror(fdi)) {
|
|
|
|
fprintf(stderr, _("cannot open %s: %s\n"),
|
|
|
|
(argc == 1 ? "<stdin>" : argv[1]), Fstrerror(fdi));
|
1999-11-02 22:33:14 +08:00
|
|
|
exit(EXIT_FAILURE);
|
1996-02-21 04:55:04 +08:00
|
|
|
}
|
|
|
|
|
1998-11-19 05:41:05 +08:00
|
|
|
h = headerRead(fdi, HEADER_MAGIC_YES);
|
1996-02-21 04:55:04 +08:00
|
|
|
if (!h) {
|
2001-06-18 06:18:03 +08:00
|
|
|
fprintf(stderr, _("headerRead error: %s\n"), Fstrerror(fdi));
|
1999-11-02 22:33:14 +08:00
|
|
|
exit(EXIT_FAILURE);
|
1996-02-21 04:55:04 +08:00
|
|
|
}
|
1999-10-28 07:18:10 +08:00
|
|
|
Fclose(fdi);
|
1996-02-21 04:55:04 +08:00
|
|
|
|
1998-11-20 02:10:28 +08:00
|
|
|
headerDump(h, stdout, HEADER_DUMP_INLINE, rpmTagTable);
|
2002-07-14 03:08:51 +08:00
|
|
|
h = headerFree(h);
|
1998-03-05 00:53:24 +08:00
|
|
|
|
|
|
|
return 0;
|
1996-02-21 04:55:04 +08:00
|
|
|
}
|