[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

How to program with librpm (test program crashes)



Hello.
I am trying to learn to program with librpm. Im using RedHat 9's rpm
packages.
The devel package, aside from the fact that doesnt include the api, it
seems to have the same header files that other devel packages, but files
like signature.h are not included.
Why is that so?
I just wrote this test app, and crashes on rpmReadSignature . Is that
function deprecated? it doesnt say so on the API docs.
here is the program (small) if you could point me out. Maybe I shouldnt
be usign those functions 
NOTE: I am using RedHat RPM Guide book
--------- Start Here -------------
#include <stdio.h>
#include <stdlib.h>

#include <rpm/rpmlib.h>

int main(int argc, char *argv[])
{
		FD_t fd;
		struct rpmlead lead;
		Header header;
		rpmRC rc;
		
		int status = rpmReadConfigFiles( NULL, NULL);
		
		if(status) {
				printf("Error reading RC files.\n");
				exit(-1);
		} else {
				printf("Read RC OK\n");
		}
		
		rpmSetVerbosity(RPMMESS_NORMAL);
		
		rpmShowRC(stdout);
		
		
		fd = Fopen("mldonkey-2.5-3.i586.rpm","r");
		readLead(fd,&lead);
		header=headerRead(fd, (lead.major >=3) ? HEADER_MAGIC_YES :
HEADER_MAGIC_NO);
		rc=rpmReadSignature(fd, &header, lead.signature_type);
		
		exit(0);
}
---- End Here----

Of course, this doesnt do anything usefull, and its only intended to
help me learn librpm with c.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []