~ubuntu-branches/ubuntu/edgy/rpm/edgy

« back to all changes in this revision

Viewing changes to tools/dump.c

  • Committer: Bazaar Package Importer
  • Author(s): Joey Hess
  • Date: 2002-01-22 20:56:57 UTC
  • Revision ID: james.westby@ubuntu.com-20020122205657-l74j50mr9z8ofcl5
Tags: upstream-4.0.3
ImportĀ upstreamĀ versionĀ 4.0.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "system.h"
 
2
 
 
3
#include <rpmlib.h>
 
4
#include "header_internal.h"
 
5
#include "debug.h"
 
6
 
 
7
int main(int argc, char ** argv)
 
8
{
 
9
    Header h;
 
10
    FD_t fdi;
 
11
 
 
12
    setprogname(argv[0]);       /* Retrofit glibc __progname */
 
13
    if (argc == 1) {
 
14
        fdi = Fopen("-", "r.ufdio");
 
15
    } else {
 
16
        fdi = Fopen(argv[1], "r.ufdio");
 
17
    }
 
18
 
 
19
    if (Ferror(fdi)) {
 
20
        fprintf(stderr, _("cannot open %s: %s\n"),
 
21
                (argc == 1 ? "<stdin>" : argv[1]), Fstrerror(fdi));
 
22
        exit(EXIT_FAILURE);
 
23
    }
 
24
 
 
25
    h = headerRead(fdi, HEADER_MAGIC_YES);
 
26
    if (!h) {
 
27
        fprintf(stderr, _("headerRead error: %s\n"), Fstrerror(fdi));
 
28
        exit(EXIT_FAILURE);
 
29
    }
 
30
    Fclose(fdi);
 
31
  
 
32
    headerDump(h, stdout, HEADER_DUMP_INLINE, rpmTagTable);
 
33
    h = headerFree(h);
 
34
 
 
35
    return 0;
 
36
}