Main Page   Modules   Compound List   File List   Compound Members   File Members   Related Pages  

tools/rpmarchive.c

Go to the documentation of this file.
00001 /* rpmarchive: spit out the main archive portion of a package */
00002 
00003 #include "system.h"
00004 
00005 #include "header.h"
00006 #include "rpmlead.h"
00007 #include "signature.h"
00008 
00009 #include "debug.h"
00010 
00011 int main(int argc, char **argv)
00012 {
00013     FD_t fdi, fdo;
00014     char buffer[1024];
00015     struct rpmlead lead;
00016     Header hd;
00017     int ct;
00018     
00019     setprogname(argv[0]);       /* Retrofit glibc __progname */
00020     if (argc == 1) {
00021         fdi = Fopen("-", "r.ufdio");
00022     } else {
00023         fdi = Fopen(argv[1], "r.ufdio");
00024     }
00025     if (fdi == NULL || Ferror(fdi)) {
00026         perror("input");
00027         exit(EXIT_FAILURE);
00028     }
00029 
00030     readLead(fdi, &lead);
00031     rpmReadSignature(fdi, NULL, lead.signature_type);
00032     hd = headerRead(fdi, (lead.major >= 3) ?
00033                     HEADER_MAGIC_YES : HEADER_MAGIC_NO);
00034 
00035     fdo = Fopen("-", "w.ufdio");
00036     while ((ct = Fread(buffer, sizeof(buffer), 1, fdi))) {
00037         Fwrite(buffer, ct, 1, fdo);
00038     }
00039     
00040     return 0;
00041 }

Generated at Mon May 21 08:53:41 2001 for rpm by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001