Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

# dump.c

Go to the documentation of this file.

    00001 #include "system.h"
    00002
    00003 #include <rpmlib.h>
    00004 #include "header_internal.h"
    00005 #include "debug.h"
    00006
    00007 int main(int argc, char ** argv)
    00008 {
    00009     Header h;
    00010     FD_t fdi;
    00011
    00012     setprogname(argv[0]);       /* Retrofit glibc __progname */
    00013     if (argc == 1) {
    00014         fdi = Fopen("-", "r.ufdio");
    00015     } else {
    00016         fdi = Fopen(argv[1], "r.ufdio");
    00017     }
    00018
    00019     if (Ferror(fdi)) {
    00020         fprintf(stderr, _("cannot open %s: %s\n"),
    00021                 (argc == 1 ? "<stdin>" : argv[1]), Fstrerror(fdi));
    00022         exit(EXIT_FAILURE);
    00023     }
    00024
    00025     h = headerRead(fdi, HEADER_MAGIC_YES);
    00026     if (!h) {
    00027         fprintf(stderr, _("headerRead error: %s\n"), Fstrerror(fdi));
    00028         exit(EXIT_FAILURE);
    00029     }
    00030     Fclose(fdi);
    00031
    00032     headerDump(h, stdout, HEADER_DUMP_INLINE, rpmTagTable);
    00033     h = headerFree(h);
    00034
    00035     return 0;
    00036 }