From: root Date: Thu, 15 Feb 1996 22:44:04 +0000 (+0000) Subject: change to test new copyHeader code X-Git-Tag: tznext/4.11.0.1.tizen20130304~11672 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1efa980d28535a131268521f61851b09e98194f6;p=tools%2Flibrpm-tizen.git change to test new copyHeader code CVS patchset: 288 CVS date: 1996/02/15 22:44:04 --- diff --git a/lib/test.c b/lib/test.c index cc94336..8910413 100644 --- a/lib/test.c +++ b/lib/test.c @@ -1,13 +1,15 @@ +#include +#include +#include +#include + #include "header.h" #include "rpmlib.h" -#include - void main(int argc, char **argv) { -#if 0 - Header h; - FILE *f; + Header h, h2, h3, h4; + int fd; char *sa[] = {"one", "two", "three"}; int_32 i32 = 400; int_32 i32a[] = {100, 200, 300}; @@ -19,19 +21,39 @@ void main(int argc, char **argv) addEntry(h, RPMTAG_NAME, STRING_TYPE, "MarcEwing", 1); addEntry(h, RPMTAG_VERSION, STRING_TYPE, "1.1", 1); - addEntry(h, RPMTAG_VERSION, STRING_TYPE, sa, 3); + addEntry(h, RPMTAG_VERSION, STRING_ARRAY_TYPE, sa, 3); addEntry(h, RPMTAG_SIZE, INT32_TYPE, &i32, 1); addEntry(h, RPMTAG_SIZE, INT16_TYPE, &i16, 1); addEntry(h, RPMTAG_SIZE, INT16_TYPE, i16a, 3); addEntry(h, RPMTAG_VENDOR, CHAR_TYPE, ca, strlen(ca)); addEntry(h, RPMTAG_SIZE, INT32_TYPE, i32a, 3); - f = fopen("test.out", "w"); - writeHeader(f, h); - fclose(f); + printf("Original = %d\n", sizeofHeader(h)); + fd = open("test.out", O_WRONLY|O_CREAT); + writeHeader(fd, h); + close(fd); + h2 = copyHeader(h); + printf("Copy = %d\n", sizeofHeader(h2)); + fd = open("test.out", O_RDONLY); + h3 = readHeader(fd); + close(fd); + + printf("From disk = %d\n", sizeofHeader(h3)); + h4 = copyHeader(h3); + printf("Copy of disk = %d\n", sizeofHeader(h4)); + + printf("=====================\n"); + printf("Original\n"); dumpHeader(h, stdout, 1); -#endif + printf("=====================\n"); + printf("From disk\n"); + dumpHeader(h3, stdout, 1); + printf("=====================\n"); + printf("Copy of disk\n"); + dumpHeader(h4, stdout, 1); +#if 0 convertDB(""); +#endif }