added suppor fo INSTPREFIX virtual tag (for backwards compatibility)
authorewt <devnull@localhost>
Sun, 8 Feb 1998 07:06:07 +0000 (07:06 +0000)
committerewt <devnull@localhost>
Sun, 8 Feb 1998 07:06:07 +0000 (07:06 +0000)
CVS patchset: 1992
CVS date: 1998/02/08 07:06:07

lib/formats.c

index 71afd72..5c47a44 100644 (file)
@@ -19,11 +19,14 @@ static int fsnamesTag(Header h, int_32 * type, void ** data, int_32 * count,
                      int * freeData);
 static int fssizesTag(Header h, int_32 * type, void ** data, int_32 * count,
                      int * freeData);
+static int instprefixTag(Header h, int_32 * type, void ** data, int_32 * count,
+                     int * freeData);
 static char * permsString(int mode);
 
 const struct headerSprintfExtension rpmHeaderFormats[] = {
     { HEADER_EXT_TAG, "RPMTAG_FSSIZES", { fssizesTag } },
     { HEADER_EXT_TAG, "RPMTAG_FSNAMES", { fsnamesTag } },
+    { HEADER_EXT_TAG, "RPMTAG_INSTALLPREFIX", { instprefixTag } },
     { HEADER_EXT_FORMAT, "depflags", { depflagsFormat } },
     { HEADER_EXT_FORMAT, "fflags", { fflagsFormat } },
     { HEADER_EXT_FORMAT, "perms", { permsFormat } },
@@ -178,6 +181,24 @@ static int fsnamesTag(Header h, int_32 * type, void ** data, int_32 * count,
     return 0; 
 }
 
+static int instprefixTag(Header h, int_32 * type, void ** data, int_32 * count,
+                     int * freeData) {
+    char ** array;
+
+    if (headerGetEntry(h, RPMTAG_INSTALLPREFIX, type, data, count)) {
+       *freeData = 0;
+       return 0;
+    } else if (headerGetEntry(h, RPMTAG_INSTPREFIXES, type, (void **) &array, 
+                             count)) {
+       *((char **) data) = strdup(array[0]);
+       *freeData = 1;
+       free(array);
+       return 0;
+    } 
+
+    return 1;
+}
+
 static int fssizesTag(Header h, int_32 * type, void ** data, int_32 * count,
                      int * freeData) {
     char ** filenames;