7 #include <rpm/rpmtag.h>
8 #include <rpm/rpmlib.h> /* rpmGetFilesystem*() */
10 #include <rpm/rpmmacro.h> /* XXX for %_i18ndomains */
11 #include <rpm/rpmfi.h>
12 #include <rpm/rpmstring.h>
14 #include "rpmio/digest.h"
15 #include "lib/manifest.h"
20 * Define header tag output formats.
23 struct headerFormatFunc_s {
24 rpmtdFormats fmt; /*!< Value of extension */
25 const char *name; /*!< Name of extension. */
26 void *func; /*!< Pointer to formatter function. */
29 struct headerTagFunc_s {
30 rpmTag tag; /*!< Tag of extension. */
31 void *func; /*!< Pointer to formatter function. */
34 /* forward declarations */
35 static const struct headerFormatFunc_s rpmHeaderFormats[];
36 static const struct headerTagFunc_s rpmHeaderTagExtensions[];
38 void *rpmHeaderFormatFuncByName(const char *fmt);
39 void *rpmHeaderFormatFuncByValue(rpmtdFormats fmt);
40 void *rpmHeaderTagFunc(rpmTag tag);
43 * barebones string representation with no extra formatting
44 * @param td tag data container
45 * @param formatPrefix sprintf format string
46 * @param padding no. additional bytes needed by format string
47 * @return formatted string
49 static char * stringFormat(rpmtd td, char *formatPrefix, size_t padding)
51 const char *str = NULL;
52 char *val = NULL, *buf = NULL;
55 switch (rpmtdType(td)) {
58 need = 10 + padding + 20; /* we can do better, just for now ... */
60 strcat(formatPrefix, "hhd");
61 sprintf(val, formatPrefix, *rpmtdGetChar(td));
64 need = 10 + padding + 20; /* we can do better, just for now ... */
66 strcat(formatPrefix, "hd");
67 sprintf(val, formatPrefix, *rpmtdGetUint16(td));
70 need = 10 + padding + 20; /* we can do better, just for now ... */
72 strcat(formatPrefix, "d");
73 sprintf(val, formatPrefix, *rpmtdGetUint32(td));
76 case RPM_STRING_ARRAY_TYPE:
77 case RPM_I18NSTRING_TYPE:
78 str = rpmtdGetString(td);
79 val = xmalloc(strlen(str) + padding + 1);
80 strcat(formatPrefix, "s");
81 sprintf(val, formatPrefix, str);
84 buf = pgpHexStr(td->data, td->count);
85 val = xmalloc(strlen(buf) + padding + 1);
86 strcat(formatPrefix, "s");
87 sprintf(val, formatPrefix, buf);
91 val = xstrdup("(unknown type)");
99 * @param td tag data container
100 * @param formatPrefix sprintf format string
101 * @param padding no. additional bytes needed by format string
102 * @return formatted string
104 static char * octalFormat(rpmtd td, char * formatPrefix, size_t padding)
108 if (rpmtdType(td) != RPM_INT32_TYPE) {
109 val = xstrdup(_("(not a number)"));
111 val = xmalloc(20 + padding);
112 strcat(formatPrefix, "o");
113 sprintf(val, formatPrefix, *rpmtdGetUint32(td));
121 * @param td tag data container
122 * @param formatPrefix sprintf format string
123 * @param padding no. additional bytes needed by format string
124 * @return formatted string
126 static char * hexFormat(rpmtd td, char * formatPrefix, size_t padding)
130 if (rpmtdType(td) != RPM_INT32_TYPE) {
131 val = xstrdup(_("(not a number)"));
133 val = xmalloc(20 + padding);
134 strcat(formatPrefix, "x");
135 sprintf(val, formatPrefix, *rpmtdGetUint32(td));
142 * @param td tag data container
143 * @param formatPrefix sprintf format string
144 * @param padding no. additional bytes needed by format string
145 * @return formatted string
147 static char * realDateFormat(rpmtd td, char * formatPrefix, size_t padding,
148 const char * strftimeFormat)
152 if (rpmtdType(td) != RPM_INT32_TYPE) {
153 val = xstrdup(_("(not a number)"));
158 val = xmalloc(50 + padding);
159 strcat(formatPrefix, "s");
161 /* this is important if sizeof(rpm_time_t) ! sizeof(time_t) */
162 { rpm_time_t *rt = rpmtdGetUint32(td);
163 time_t dateint = *rt;
164 tstruct = localtime(&dateint);
168 (void) strftime(buf, sizeof(buf) - 1, strftimeFormat, tstruct);
169 sprintf(val, formatPrefix, buf);
177 * @param td tag data container
178 * @param formatPrefix sprintf format string
179 * @param padding no. additional bytes needed by format string
180 * @return formatted string
182 static char * dateFormat(rpmtd td, char * formatPrefix, size_t padding)
184 return realDateFormat(td, formatPrefix, padding, _("%c"));
189 * @param td tag data container
190 * @param formatPrefix sprintf format string
191 * @param padding no. additional bytes needed by format string
192 * @return formatted string
194 static char * dayFormat(rpmtd td, char * formatPrefix, size_t padding)
196 return realDateFormat(td, formatPrefix, padding, _("%a %b %d %Y"));
200 * Return shell escape formatted data.
201 * @param td tag data container
202 * @param formatPrefix sprintf format string
203 * @param padding no. additional bytes needed by format string
204 * @return formatted string
206 static char * shescapeFormat(rpmtd td, char * formatPrefix, size_t padding)
208 char * result, * dst, * src;
210 if (rpmtdType(td) == RPM_INT32_TYPE) {
211 result = xmalloc(padding + 20);
212 strcat(formatPrefix, "d");
213 sprintf(result, formatPrefix, *rpmtdGetUint32(td));
216 strcat(formatPrefix, "s");
217 rasprintf(&buf, formatPrefix, rpmtdGetString(td));
219 result = dst = xmalloc(strlen(buf) * 4 + 3);
221 for (src = buf; *src != '\0'; src++) {
241 * Identify type of trigger.
242 * @param td tag data container
243 * @param formatPrefix sprintf format string
244 * @param padding no. additional bytes needed by format string
245 * @return formatted string
247 static char * triggertypeFormat(rpmtd td, char * formatPrefix, size_t padding)
249 const uint32_t * item = rpmtdGetUint32(td);
252 if (rpmtdType(td) != RPM_INT32_TYPE)
253 val = xstrdup(_("(not a number)"));
254 else if (*item & RPMSENSE_TRIGGERPREIN)
255 val = xstrdup("prein");
256 else if (*item & RPMSENSE_TRIGGERIN)
258 else if (*item & RPMSENSE_TRIGGERUN)
260 else if (*item & RPMSENSE_TRIGGERPOSTUN)
261 val = xstrdup("postun");
268 * Format file permissions for display.
269 * @param td tag data container
270 * @param formatPrefix sprintf format string
271 * @param padding no. additional bytes needed by format string
272 * @return formatted string
274 static char * permsFormat(rpmtd td, char * formatPrefix, size_t padding)
279 if (rpmtdType(td) != RPM_INT32_TYPE) {
280 val = xstrdup(_("(not a number)"));
282 val = xmalloc(15 + padding);
283 strcat(formatPrefix, "s");
284 buf = rpmPermsString(*rpmtdGetUint32(td));
285 sprintf(val, formatPrefix, buf);
293 * Format file flags for display.
294 * @param td tag data container
295 * @param formatPrefix sprintf format string
296 * @param padding no. additional bytes needed by format string
297 * @return formatted string
299 static char * fflagsFormat(rpmtd td, char * formatPrefix, size_t padding)
304 if (rpmtdType(td) != RPM_INT32_TYPE) {
305 val = xstrdup(_("(not a number)"));
307 rpm_flag_t *rf = rpmtdGetUint32(td);
308 rpmfileAttrs anint = *rf;
310 if (anint & RPMFILE_DOC)
312 if (anint & RPMFILE_CONFIG)
314 if (anint & RPMFILE_SPECFILE)
316 if (anint & RPMFILE_MISSINGOK)
318 if (anint & RPMFILE_NOREPLACE)
320 if (anint & RPMFILE_GHOST)
322 if (anint & RPMFILE_LICENSE)
324 if (anint & RPMFILE_README)
327 val = xmalloc(5 + padding);
328 strcat(formatPrefix, "s");
329 sprintf(val, formatPrefix, buf);
336 * Wrap a pubkey in ascii armor for display.
337 * @todo Permit selectable display formats (i.e. binary).
338 * @param td tag data container
339 * @param formatPrefix sprintf format string
340 * @param padding no. additional bytes needed by format string
341 * @return formatted string
343 static char * armorFormat(rpmtd td, char * formatPrefix, size_t padding)
346 const unsigned char * s;
347 unsigned char * bs = NULL;
352 switch (rpmtdType(td)) {
355 /* XXX HACK ALERT: element field abused as no. bytes of binary data. */
357 atype = PGPARMOR_SIGNATURE; /* XXX check pkt for signature */
359 case RPM_STRING_TYPE:
360 case RPM_STRING_ARRAY_TYPE:
361 enc = rpmtdGetString(td);
362 if (b64decode(enc, (void **)&bs, &ns))
363 return xstrdup(_("(not base64)"));
365 atype = PGPARMOR_PUBKEY; /* XXX check pkt for pubkey */
372 case RPM_I18NSTRING_TYPE:
374 return xstrdup(_("(invalid type)"));
378 /* XXX this doesn't use padding directly, assumes enough slop in retval. */
379 val = pgpArmorWrap(atype, s, ns);
380 if (atype == PGPARMOR_PUBKEY) {
387 * Encode binary data in base64 for display.
388 * @todo Permit selectable display formats (i.e. binary).
389 * @param td tag data container
390 * @param formatPrefix sprintf format string
391 * @param padding no. additional bytes needed by format string
392 * @return formatted string
394 static char * base64Format(rpmtd td, char * formatPrefix, size_t padding)
398 if (rpmtdType(td) != RPM_BIN_TYPE) {
399 val = xstrdup(_("(not a blob)"));
403 /* XXX HACK ALERT: element field abused as no. bytes of binary data. */
404 size_t ns = td->count;
407 if ((enc = b64encode(td->data, ns, -1)) != NULL) {
411 val = t = xmalloc(nt + padding + 1);
424 * Wrap tag data in simple header xml markup.
425 * @param td tag data container
426 * @param formatPrefix sprintf format string
427 * @param padding no. additional bytes needed by format string
428 * @return formatted string
430 static char * xmlFormat(rpmtd td, char * formatPrefix, size_t padding)
432 const char *xtag = NULL;
437 unsigned long anint = 0;
440 switch (rpmtdType(td)) {
441 case RPM_I18NSTRING_TYPE:
442 case RPM_STRING_TYPE:
443 case RPM_STRING_ARRAY_TYPE:
444 s = rpmtdGetString(td);
449 /* XXX HACK ALERT: array count abused as no. bytes of binary data. */
450 size_t ns = td->count;
451 if ((s = b64encode(td->data, ns, 0)) == NULL) {
452 return xstrdup(_("(encoding failed)"));
459 /* XXX unused, remove ? */
460 anint = *((const uint8_t *) data);
464 anint = *rpmtdGetUint16(td);
467 anint = *rpmtdGetUint32(td);
471 return xstrdup(_("(invalid xml type)"));
477 rasprintf(&s, "%lu", anint);
485 t = rstrscat(NULL, "\t<", xtag, "/>", NULL);
488 size_t i, s_size = strlen(s);
490 for (i=0; i<s_size; i++) {
492 case '<': rstrcat(&new_s, "<"); break;
493 case '>': rstrcat(&new_s, ">"); break;
494 case '&': rstrcat(&new_s, "&"); break;
504 t = rstrscat(NULL, "\t<", xtag, ">", new_s, "</", xtag, ">", NULL);
508 /* XXX s was malloc'd */
509 if (!strcmp(xtag, "base64") || !strcmp(xtag, "integer"))
512 nb += strlen(t)+padding;
514 strcat(formatPrefix, "s");
515 xx = snprintf(val, nb, formatPrefix, t);
523 * Display signature fingerprint and time.
524 * @param td tag data container
525 * @param formatPrefix sprintf format string
526 * @param padding no. additional bytes needed by format string
527 * @return formatted string
529 static char * pgpsigFormat(rpmtd td, char * formatPrefix, size_t padding)
533 if (rpmtdType(td) != RPM_BIN_TYPE) {
534 val = xstrdup(_("(not a blob)"));
536 const uint8_t * pkt = td->data;
538 unsigned int v = *pkt;
546 plen = pgpLen(pkt+1, &hlen);
548 tag = (v >> 2) & 0xf;
549 plen = (1 << (v & 0x3));
550 hlen = pgpGrab(pkt+1, plen);
553 pktlen = 1 + plen + hlen;
556 if (pktlen == 0 || tag != PGPTAG_SIGNATURE) {
557 val = xstrdup(_("(not an OpenPGP signature)"));
559 pgpDig dig = pgpNewDig();
560 pgpDigParams sigp = &dig->signature;
562 char *tempstr = NULL;
564 (void) pgpPrtPkts(pkt, pktlen, dig, 0);
569 val = t = xrealloc(val, nb + 1);
571 switch (sigp->pubkey_algo) {
572 case PGPPUBKEYALGO_DSA:
573 t = stpcpy(t, "DSA");
575 case PGPPUBKEYALGO_RSA:
576 t = stpcpy(t, "RSA");
579 (void) snprintf(t, nb - (t - val), "%d", sigp->pubkey_algo);
583 if (t + 5 >= val + nb)
586 switch (sigp->hash_algo) {
587 case PGPHASHALGO_MD5:
588 t = stpcpy(t, "MD5");
590 case PGPHASHALGO_SHA1:
591 t = stpcpy(t, "SHA1");
594 (void) snprintf(t, nb - (t - val), "%d", sigp->hash_algo);
598 if (t + strlen (", ") + 1 >= val + nb)
603 /* this is important if sizeof(int32_t) ! sizeof(time_t) */
604 { time_t dateint = pgpGrab(sigp->time, sizeof(sigp->time));
605 struct tm * tstruct = localtime(&dateint);
607 (void) strftime(t, (nb - (t - val)), "%c", tstruct);
610 if (t + strlen (", Key ID ") + 1 >= val + nb)
612 t = stpcpy(t, ", Key ID ");
613 tempstr = pgpHexStr(sigp->signid, sizeof(sigp->signid));
614 if (t + strlen (tempstr) > val + nb)
616 t = stpcpy(t, tempstr);
619 dig = pgpFreeDig(dig);
627 * Format dependency flags for display.
628 * @param td tag data container
629 * @param formatPrefix sprintf format string
630 * @param padding no. additional bytes needed by format string
631 * @return formatted string
633 static char * depflagsFormat(rpmtd td, char * formatPrefix, size_t padding)
639 if (rpmtdType(td) != RPM_INT32_TYPE) {
640 val = xstrdup(_("(not a number)"));
642 rpm_flag_t *rf = rpmtdGetUint32(td);
646 if (anint & RPMSENSE_LESS)
648 if (anint & RPMSENSE_GREATER)
650 if (anint & RPMSENSE_EQUAL)
653 val = xmalloc(5 + padding);
654 strcat(formatPrefix, "s");
655 sprintf(val, formatPrefix, buf);
662 * Retrieve mounted file system paths.
664 * @retval td tag data container
665 * @return 0 on success
667 static int fsnamesTag(Header h, rpmtd td)
671 if (rpmGetFilesystemList(&list, &(td->count)))
674 td->type = RPM_STRING_ARRAY_TYPE;
682 * Retrieve install prefixes.
684 * @retval td tag data container
685 * @return 0 on success
687 static int instprefixTag(Header h, rpmtd td)
689 struct rpmtd_s prefixes;
690 int flags = HEADERGET_MINMEM;
692 if (headerGet(h, RPMTAG_INSTALLPREFIX, td, flags)) {
694 } else if (headerGet(h, RPMTAG_INSTPREFIXES, &prefixes, flags)) {
695 /* only return the first prefix of the array */
696 td->type = RPM_STRING_TYPE;
697 td->data = rpmtdToString(&prefixes);
699 rpmtdFreeData(&prefixes);
707 * Retrieve mounted file system space.
709 * @retval td tag data container
710 * @return 0 on success
712 static int fssizesTag(Header h, rpmtd td)
714 HGE_t hge = (HGE_t)headerGetEntryMinMemory;
715 const char ** filenames;
716 rpm_off_t * filesizes;
718 rpm_count_t numFiles;
720 if (!hge(h, RPMTAG_FILESIZES, NULL, (rpm_data_t *) &filesizes, &numFiles)) {
725 rpmfiBuildFNames(h, RPMTAG_BASENAMES, &filenames, &numFiles);
728 if (rpmGetFilesystemList(NULL, &(td->count)))
731 td->type = RPM_INT32_TYPE;
734 if (filenames == NULL) {
735 usages = xcalloc((td->count), sizeof(usages));
741 if (rpmGetFilesystemUsage(filenames, filesizes, numFiles, &usages, 0))
746 filenames = _free(filenames);
752 * Retrieve trigger info.
754 * @retval td tag data container
755 * @return 0 on success
757 static int triggercondsTag(Header h, rpmtd td)
759 /* XXX out of service for now.. */
761 HGE_t hge = (HGE_t)headerGetEntryMinMemory;
762 HFD_t hfd = headerFreeData;
763 rpmTagType tnt, tvt, tst;
765 char ** names, ** versions;
766 rpm_count_t numNames, numScripts;
770 char * item, * flagsStr;
775 if (!hge(h, RPMTAG_TRIGGERNAME, &tnt, (rpm_data_t *) &names, &numNames)) {
780 xx = hge(h, RPMTAG_TRIGGERINDEX, NULL, (rpm_data_t *) &indices, NULL);
781 xx = hge(h, RPMTAG_TRIGGERFLAGS, NULL, (rpm_data_t *) &flags, NULL);
782 xx = hge(h, RPMTAG_TRIGGERVERSION, &tvt, (rpm_data_t *) &versions, NULL);
783 xx = hge(h, RPMTAG_TRIGGERSCRIPTS, &tst, (rpm_data_t *) &s, &numScripts);
787 td->data = conds = xmalloc(sizeof(*conds) * numScripts);
788 td->count = numScripts;
789 td->type = RPM_STRING_ARRAY_TYPE;
790 for (i = 0; i < numScripts; i++) {
793 for (j = 0; j < numNames; j++) {
797 item = xmalloc(strlen(names[j]) + strlen(versions[j]) + 20);
798 if (flags[j] & RPMSENSE_SENSEMASK) {
799 buf[0] = '%', buf[1] = '\0';
800 flagsStr = depflagsFormat(RPM_INT32_TYPE, flags, buf, 0, 0);
801 sprintf(item, "%s %s %s", names[j], flagsStr, versions[j]);
802 flagsStr = _free(flagsStr);
804 strcpy(item, names[j]);
807 chptr = xrealloc(chptr, strlen(chptr) + strlen(item) + 5);
808 if (*chptr != '\0') strcat(chptr, ", ");
816 names = hfd(names, tnt);
817 versions = hfd(versions, tvt);
825 * Retrieve trigger type info.
827 * @retval td tag data container
828 * @return 0 on success
830 static int triggertypeTag(Header h, rpmtd td)
832 HGE_t hge = (HGE_t)headerGetEntryMinMemory;
833 HFD_t hfd = headerFreeData;
839 rpm_count_t numScripts, numNames;
843 if (!hge(h, RPMTAG_TRIGGERINDEX, NULL, (rpm_data_t *) &indices, &numNames)) {
848 xx = hge(h, RPMTAG_TRIGGERFLAGS, NULL, (rpm_data_t *) &flags, NULL);
849 xx = hge(h, RPMTAG_TRIGGERSCRIPTS, &tst, (rpm_data_t *) &s, &numScripts);
853 td->data = conds = xmalloc(sizeof(*conds) * numScripts);
854 td->count = numScripts;
855 td->type = RPM_STRING_ARRAY_TYPE;
856 for (i = 0; i < numScripts; i++) {
857 for (j = 0; j < numNames; j++) {
861 if (flags[j] & RPMSENSE_TRIGGERPREIN)
862 conds[i] = xstrdup("prein");
863 else if (flags[j] & RPMSENSE_TRIGGERIN)
864 conds[i] = xstrdup("in");
865 else if (flags[j] & RPMSENSE_TRIGGERUN)
866 conds[i] = xstrdup("un");
867 else if (flags[j] & RPMSENSE_TRIGGERPOSTUN)
868 conds[i] = xstrdup("postun");
870 conds[i] = xstrdup("");
879 * Retrieve file paths.
881 * @retval td tag data container
882 * @return 0 on success
884 static int filenamesTag(Header h, rpmtd td)
886 td->type = RPM_STRING_ARRAY_TYPE;
887 rpmfiBuildFNames(h, RPMTAG_BASENAMES,
888 (const char ***) &(td->data), &(td->count));
894 * Retrieve file classes.
896 * @retval td tag data container
897 * @return 0 on success
899 static int fileclassTag(Header h, rpmtd td)
901 td->type = RPM_STRING_ARRAY_TYPE;
902 rpmfiBuildFClasses(h, (const char ***) &(td->data), &(td->count));
908 * Retrieve file provides.
910 * @retval td tag data container
911 * @return 0 on success
913 static int fileprovideTag(Header h, rpmtd td)
915 td->type = RPM_STRING_ARRAY_TYPE;
916 rpmfiBuildFDeps(h, RPMTAG_PROVIDENAME,
917 (const char ***) &(td->data), &(td->count));
923 * Retrieve file requires.
925 * @retval td tag data container
926 * @return 0 on success
928 static int filerequireTag(Header h, rpmtd td)
930 td->type = RPM_STRING_ARRAY_TYPE;
931 rpmfiBuildFDeps(h, RPMTAG_REQUIRENAME,
932 (const char ***) &(td->data), &(td->count));
937 /* I18N look aside diversions */
939 #if defined(ENABLE_NLS)
940 extern int _nl_msg_cat_cntr; /* XXX GNU gettext voodoo */
942 static const char * const language = "LANGUAGE";
944 static const char * const _macro_i18ndomains = "%{?_i18ndomains}";
947 * Retrieve i18n text.
950 * @retval td tag data container
951 * @return 0 on success
953 static int i18nTag(Header h, rpmTag tag, rpmtd td)
955 char * dstring = rpmExpand(_macro_i18ndomains, NULL);
958 td->type = RPM_STRING_TYPE;
963 if (dstring && *dstring) {
965 const char * langval;
971 xx = headerNVR(h, &n, NULL, NULL);
972 rasprintf(&msgkey, "%s(%s)", n, rpmTagGetName(tag));
974 /* change to en_US for msgkey -> msgid resolution */
975 langval = getenv(language);
976 (void) setenv(language, "en_US", 1);
977 #if defined(ENABLE_NLS)
982 for (domain = dstring; domain != NULL; domain = de) {
983 de = strchr(domain, ':');
984 if (de) *de++ = '\0';
985 msgid = dgettext(domain, msgkey);
986 if (msgid != msgkey) break;
989 /* restore previous environment for msgid -> msgstr resolution */
991 (void) setenv(language, langval, 1);
994 #if defined(ENABLE_NLS)
998 if (domain && msgid) {
999 td->data = dgettext(domain, msgid);
1000 td->data = xstrdup(td->data); /* XXX xstrdup has side effects. */
1004 dstring = _free(dstring);
1010 dstring = _free(dstring);
1012 rc = headerGet(h, tag, td, HEADERGET_DEFAULT);
1013 /* XXX fix the mismatch between headerGet and tag format returns */
1018 * Retrieve summary text.
1020 * @retval td tag data container
1021 * @return 0 on success
1023 static int summaryTag(Header h, rpmtd td)
1025 return i18nTag(h, RPMTAG_SUMMARY, td);
1029 * Retrieve description text.
1031 * @retval td tag data container
1032 * @return 0 on success
1034 static int descriptionTag(Header h, rpmtd td)
1036 return i18nTag(h, RPMTAG_DESCRIPTION, td);
1040 * Retrieve group text.
1042 * @retval td tag data container
1043 * @return 0 on success
1045 static int groupTag(Header h, rpmtd td)
1047 return i18nTag(h, RPMTAG_GROUP, td);
1050 void *rpmHeaderTagFunc(rpmTag tag)
1052 const struct headerTagFunc_s * ext;
1055 for (ext = rpmHeaderTagExtensions; ext->func != NULL; ext++) {
1056 if (ext->tag == tag) {
1064 void *rpmHeaderFormatFuncByName(const char *fmt)
1066 const struct headerFormatFunc_s * ext;
1069 for (ext = rpmHeaderFormats; ext->name != NULL; ext++) {
1070 if (!strcmp(ext->name, fmt)) {
1078 void *rpmHeaderFormatFuncByValue(rpmtdFormats fmt)
1080 const struct headerFormatFunc_s * ext;
1083 for (ext = rpmHeaderFormats; ext->name != NULL; ext++) {
1084 if (fmt == ext->fmt) {
1091 static const struct headerTagFunc_s rpmHeaderTagExtensions[] = {
1092 { RPMTAG_GROUP, groupTag },
1093 { RPMTAG_DESCRIPTION, descriptionTag },
1094 { RPMTAG_SUMMARY, summaryTag },
1095 { RPMTAG_FILECLASS, fileclassTag },
1096 { RPMTAG_FILENAMES, filenamesTag },
1097 { RPMTAG_FILEPROVIDE, fileprovideTag },
1098 { RPMTAG_FILEREQUIRE, filerequireTag },
1099 { RPMTAG_FSNAMES, fsnamesTag },
1100 { RPMTAG_FSSIZES, fssizesTag },
1101 { RPMTAG_INSTALLPREFIX, instprefixTag },
1102 { RPMTAG_TRIGGERCONDS, triggercondsTag },
1103 { RPMTAG_TRIGGERTYPE, triggertypeTag },
1107 static const struct headerFormatFunc_s rpmHeaderFormats[] = {
1108 { RPMTD_FORMAT_STRING, "string", stringFormat },
1109 { RPMTD_FORMAT_ARMOR, "armor", armorFormat },
1110 { RPMTD_FORMAT_BASE64, "base64", base64Format },
1111 { RPMTD_FORMAT_PGPSIG, "pgpsig", pgpsigFormat },
1112 { RPMTD_FORMAT_DEPFLAGS, "depflags", depflagsFormat },
1113 { RPMTD_FORMAT_FFLAGS, "fflags", fflagsFormat },
1114 { RPMTD_FORMAT_PERMS, "perms", permsFormat },
1115 { RPMTD_FORMAT_PERMS, "permissions", permsFormat },
1116 { RPMTD_FORMAT_TRIGGERTYPE, "triggertype", triggertypeFormat },
1117 { RPMTD_FORMAT_XML, "xml", xmlFormat },
1118 { RPMTD_FORMAT_OCTAL, "octal", octalFormat },
1119 { RPMTD_FORMAT_HEX, "hex", hexFormat },
1120 { RPMTD_FORMAT_DATE, "date", dateFormat },
1121 { RPMTD_FORMAT_DAY, "day", dayFormat },
1122 { RPMTD_FORMAT_SHESCAPE, "shescape", shescapeFormat },