6 #include "rpmio_internal.h"
8 #include <rpmmacro.h> /* XXX for %_i18ndomains */
19 /*@access pgpDigParams @*/
22 * Identify type of trigger.
23 * @param type tag type
24 * @param data tag value
25 * @param formatPrefix (unused)
26 * @param padding (unused)
27 * @param element (unused)
28 * @return formatted string
30 static /*@only@*/ char * triggertypeFormat(int_32 type, const void * data,
31 /*@unused@*/ char * formatPrefix, /*@unused@*/ int padding,
32 /*@unused@*/ int element)
33 /*@requires maxRead(data) >= 0 @*/
35 const int_32 * item = data;
38 if (type != RPM_INT32_TYPE)
39 val = xstrdup(_("(not a number)"));
40 else if (*item & RPMSENSE_TRIGGERPREIN)
41 val = xstrdup("prein");
42 else if (*item & RPMSENSE_TRIGGERIN)
44 else if (*item & RPMSENSE_TRIGGERUN)
46 else if (*item & RPMSENSE_TRIGGERPOSTUN)
47 val = xstrdup("postun");
54 * Format file permissions for display.
55 * @param type tag type
56 * @param data tag value
59 * @param element (unused)
60 * @return formatted string
62 static /*@only@*/ char * permsFormat(int_32 type, const void * data,
63 char * formatPrefix, int padding, /*@unused@*/ int element)
64 /*@modifies formatPrefix @*/
65 /*@requires maxRead(data) >= 0 @*/
70 if (type != RPM_INT32_TYPE) {
71 val = xstrdup(_("(not a number)"));
73 val = xmalloc(15 + padding);
75 strcat(formatPrefix, "s");
77 buf = rpmPermsString(*((int_32 *) data));
79 sprintf(val, formatPrefix, buf);
88 * Format file flags for display.
89 * @param type tag type
90 * @param data tag value
93 * @param element (unused)
94 * @return formatted string
96 static /*@only@*/ char * fflagsFormat(int_32 type, const void * data,
97 char * formatPrefix, int padding, /*@unused@*/ int element)
98 /*@modifies formatPrefix @*/
99 /*@requires maxRead(data) >= 0 @*/
103 int anint = *((int_32 *) data);
105 if (type != RPM_INT32_TYPE) {
106 val = xstrdup(_("(not a number)"));
110 if (anint & RPMFILE_DOC)
112 if (anint & RPMFILE_CONFIG)
114 if (anint & RPMFILE_SPECFILE)
116 if (anint & RPMFILE_MISSINGOK)
118 if (anint & RPMFILE_NOREPLACE)
120 if (anint & RPMFILE_GHOST)
122 if (anint & RPMFILE_LICENSE)
124 if (anint & RPMFILE_README)
128 val = xmalloc(5 + padding);
130 strcat(formatPrefix, "s");
133 sprintf(val, formatPrefix, buf);
141 * Wrap a pubkey in ascii armor for display.
142 * @todo Permit selectable display formats (i.e. binary).
143 * @param type tag type
144 * @param data tag value
145 * @param formatPrefix (unused)
146 * @param padding (unused)
147 * @param element no. bytes of binary data
148 * @return formatted string
150 static /*@only@*/ char * armorFormat(int_32 type, const void * data,
151 /*@unused@*/ char * formatPrefix, /*@unused@*/ int padding,
156 const unsigned char * s;
163 /* XXX HACK ALERT: element field abused as no. bytes of binary data. */
165 atype = PGPARMOR_SIGNATURE; /* XXX check pkt for signature */
167 case RPM_STRING_TYPE:
168 case RPM_STRING_ARRAY_TYPE:
170 if (b64decode(enc, (void **)&s, &ns))
171 return xstrdup(_("(not base64)"));
172 atype = PGPARMOR_PUBKEY; /* XXX check pkt for pubkey */
179 case RPM_I18NSTRING_TYPE:
181 return xstrdup(_("(invalid type)"));
182 /*@notreached@*/ break;
185 /* XXX this doesn't use padding directly, assumes enough slop in retval. */
186 return pgpArmorWrap(atype, s, ns);
190 * Encode binary data in base64 for display.
191 * @todo Permit selectable display formats (i.e. binary).
192 * @param type tag type
193 * @param data tag value
194 * @param formatPrefix (unused)
197 * @return formatted string
199 static /*@only@*/ char * base64Format(int_32 type, const void * data,
200 /*@unused@*/ char * formatPrefix, int padding, int element)
205 if (type != RPM_BIN_TYPE) {
206 val = xstrdup(_("(not a blob)"));
211 /* XXX HACK ALERT: element field abused as no. bytes of binary data. */
213 size_t nt = ((ns + 2) / 3) * 4;
217 /* Add additional bytes necessary for eol string(s). */
218 if (b64encode_chars_per_line > 0 && b64encode_eolstr != NULL) {
219 lc = (nt + b64encode_chars_per_line - 1) / b64encode_chars_per_line;
220 if (((nt + b64encode_chars_per_line - 1) % b64encode_chars_per_line) != 0)
222 nt += lc * strlen(b64encode_eolstr);
226 val = t = xmalloc(nt + padding + 1);
229 if ((enc = b64encode(data, ns)) != NULL) {
240 * Wrap tag data in simple header xml markup.
241 * @param type tag type
242 * @param data tag value
243 * @param formatPrefix
245 * @param element (unused)
246 * @return formatted string
248 static /*@only@*/ char * xmlFormat(int_32 type, const void * data,
249 char * formatPrefix, int padding,
250 /*@unused@*/ int element)
251 /*@modifies formatPrefix @*/
253 const char * xtag = NULL;
256 const char * s = NULL;
258 unsigned long anint = 0;
261 case RPM_I18NSTRING_TYPE:
262 case RPM_STRING_TYPE:
267 { int cpl = b64encode_chars_per_line;
268 b64encode_chars_per_line = 0;
269 s = base64Format(type, data, formatPrefix, padding, element);
270 b64encode_chars_per_line = cpl;
275 anint = *((uint_8 *) data);
278 anint = *((uint_16 *) data);
281 anint = *((uint_32 *) data);
284 case RPM_STRING_ARRAY_TYPE:
286 return xstrdup(_("(invalid xml type)"));
287 /*@notreached@*/ break;
292 t = memset(alloca(tlen+1), 0, tlen+1);
293 snprintf(t, tlen, "%lu", anint);
298 nb = 2 * strlen(xtag) + sizeof("\t<></>") + strlen(s);
300 te = stpcpy( stpcpy( stpcpy(te, "\t<"), xtag), ">");
302 te = stpcpy( stpcpy( stpcpy(te, "</"), xtag), ">");
304 /* XXX s was malloc'd */
305 if (!strcmp(xtag, "base64"))
311 strcat(formatPrefix, "s");
313 snprintf(val, nb, formatPrefix, t);
320 * Display signature fingerprint and time.
321 * @param type tag type
322 * @param data tag value
323 * @param formatPrefix (unused)
325 * @param element (unused)
326 * @return formatted string
328 static /*@only@*/ char * pgpsigFormat(int_32 type, const void * data,
329 /*@unused@*/ char * formatPrefix, /*@unused@*/ int padding,
330 /*@unused@*/ int element)
331 /*@globals fileSystem @*/
332 /*@modifies fileSystem @*/
336 if (type != RPM_BIN_TYPE) {
337 val = xstrdup(_("(not a blob)"));
339 unsigned char * pkt = (byte *) data;
340 unsigned int pktlen = 0;
342 unsigned int v = *pkt;
346 unsigned int hlen = 0;
351 plen = pgpLen(pkt+1, &hlen);
353 tag = (v >> 2) & 0xf;
354 plen = (1 << (v & 0x3));
355 hlen = pgpGrab(pkt+1, plen);
358 pktlen = 1 + plen + hlen;
361 if (pktlen == 0 || tag != PGPTAG_SIGNATURE) {
362 val = xstrdup(_("(not an OpenPGP signature)"));
364 pgpDig dig = pgpNewDig();
365 pgpDigParams sigp = &dig->signature;
368 (void) pgpPrtPkts(pkt, pktlen, dig, 0);
370 val = t = xmalloc(nb + 1);
373 switch (sigp->pubkey_algo) {
374 case PGPPUBKEYALGO_DSA:
375 t = stpcpy(t, "DSA");
377 case PGPPUBKEYALGO_RSA:
378 t = stpcpy(t, "RSA");
381 sprintf(t, "%d", sigp->pubkey_algo);
386 switch (sigp->hash_algo) {
387 case PGPHASHALGO_MD5:
388 t = stpcpy(t, "MD5");
390 case PGPHASHALGO_SHA1:
391 t = stpcpy(t, "SHA1");
394 sprintf(t, "%d", sigp->hash_algo);
401 /* this is important if sizeof(int_32) ! sizeof(time_t) */
402 { time_t dateint = pgpGrab(sigp->time, sizeof(sigp->time));
403 struct tm * tstruct = localtime(&dateint);
405 (void) strftime(t, (nb - (t - val)), "%c", tstruct);
408 t = stpcpy(t, ", Key ID ");
409 t = stpcpy(t, pgpHexStr(sigp->signid, sizeof(sigp->signid)));
412 dig = pgpFreeDig(dig);
420 * Format dependency flags for display.
421 * @param type tag type
422 * @param data tag value
423 * @param formatPrefix
425 * @param element (unused)
426 * @return formatted string
428 static /*@only@*/ char * depflagsFormat(int_32 type, const void * data,
429 char * formatPrefix, int padding, /*@unused@*/ int element)
430 /*@modifies formatPrefix @*/
431 /*@requires maxRead(data) >= 0 @*/
437 if (type != RPM_INT32_TYPE) {
438 val = xstrdup(_("(not a number)"));
440 anint = *((int_32 *) data);
444 if (anint & RPMSENSE_LESS)
446 if (anint & RPMSENSE_GREATER)
448 if (anint & RPMSENSE_EQUAL)
452 val = xmalloc(5 + padding);
454 strcat(formatPrefix, "s");
457 sprintf(val, formatPrefix, buf);
465 * Retrieve mounted file system paths.
467 * @retval *type tag type
468 * @retval *data tag value
469 * @retval *count no. of data items
470 * @retval *freeData data-was-malloc'ed indicator
471 * @return 0 on success
473 static int fsnamesTag( /*@unused@*/ Header h, /*@out@*/ int_32 * type,
474 /*@out@*/ void ** data, /*@out@*/ int_32 * count,
475 /*@out@*/ int * freeData)
476 /*@globals fileSystem, internalState @*/
477 /*@modifies *type, *data, *count, *freeData,
478 fileSystem, internalState @*/
479 /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
480 /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
485 if (rpmGetFilesystemList(&list, count))
489 if (type) *type = RPM_STRING_ARRAY_TYPE;
490 if (data) *((const char ***) data) = list;
491 if (freeData) *freeData = 0;
497 * Retrieve install prefixes.
499 * @retval *type tag type
500 * @retval *data tag value
501 * @retval *count no. of data items
502 * @retval *freeData data-was-malloc'ed indicator
503 * @return 0 on success
505 static int instprefixTag(Header h, /*@null@*/ /*@out@*/ rpmTagType * type,
506 /*@null@*/ /*@out@*/ const void ** data,
507 /*@null@*/ /*@out@*/ int_32 * count,
508 /*@null@*/ /*@out@*/ int * freeData)
509 /*@modifies *type, *data, *freeData @*/
510 /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
511 /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
513 HGE_t hge = (HGE_t)headerGetEntryMinMemory;
514 HFD_t hfd = headerFreeData;
518 if (hge(h, RPMTAG_INSTALLPREFIX, type, (void **)data, count)) {
519 if (freeData) *freeData = 0;
521 } else if (hge(h, RPMTAG_INSTPREFIXES, &ipt, (void **) &array, count)) {
522 if (type) *type = RPM_STRING_TYPE;
524 if (data) *data = xstrdup(array[0]);
526 if (freeData) *freeData = 1;
527 array = hfd(array, ipt);
535 * Retrieve mounted file system space.
537 * @retval *type tag type
538 * @retval *data tag value
539 * @retval *count no. of data items
540 * @retval *freeData data-was-malloc'ed indicator
541 * @return 0 on success
543 static int fssizesTag(Header h, /*@out@*/ rpmTagType * type,
544 /*@out@*/ const void ** data, /*@out@*/ int_32 * count,
545 /*@out@*/ int * freeData)
546 /*@globals rpmGlobalMacroContext,
547 fileSystem, internalState @*/
548 /*@modifies *type, *data, *count, *freeData, rpmGlobalMacroContext,
549 fileSystem, internalState @*/
550 /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
551 /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
553 HGE_t hge = (HGE_t)headerGetEntryMinMemory;
554 const char ** filenames;
559 if (!hge(h, RPMTAG_FILESIZES, NULL, (void **) &filesizes, &numFiles)) {
564 rpmfiBuildFNames(h, RPMTAG_BASENAMES, &filenames, &numFiles);
568 if (rpmGetFilesystemList(NULL, count))
572 *type = RPM_INT32_TYPE;
575 if (filenames == NULL) {
576 usages = xcalloc((*count), sizeof(usages));
583 if (rpmGetFilesystemUsage(filenames, filesizes, numFiles, &usages, 0))
589 filenames = _free(filenames);
595 * Retrieve trigger info.
597 * @retval *type tag type
598 * @retval *data tag value
599 * @retval *count no. of data items
600 * @retval *freeData data-was-malloc'ed indicator
601 * @return 0 on success
603 /*@-bounds@*/ /* LCL: segfault */
604 static int triggercondsTag(Header h, /*@out@*/ rpmTagType * type,
605 /*@out@*/ const void ** data, /*@out@*/ int_32 * count,
606 /*@out@*/ int * freeData)
607 /*@modifies *type, *data, *count, *freeData @*/
608 /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
609 /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
611 HGE_t hge = (HGE_t)headerGetEntryMinMemory;
612 HFD_t hfd = headerFreeData;
613 rpmTagType tnt, tvt, tst;
614 int_32 * indices, * flags;
615 char ** names, ** versions;
616 int numNames, numScripts;
618 char * item, * flagsStr;
623 if (!hge(h, RPMTAG_TRIGGERNAME, &tnt, (void **) &names, &numNames)) {
628 xx = hge(h, RPMTAG_TRIGGERINDEX, NULL, (void **) &indices, NULL);
629 xx = hge(h, RPMTAG_TRIGGERFLAGS, NULL, (void **) &flags, NULL);
630 xx = hge(h, RPMTAG_TRIGGERVERSION, &tvt, (void **) &versions, NULL);
631 xx = hge(h, RPMTAG_TRIGGERSCRIPTS, &tst, (void **) &s, &numScripts);
635 *data = conds = xmalloc(sizeof(*conds) * numScripts);
637 *type = RPM_STRING_ARRAY_TYPE;
638 for (i = 0; i < numScripts; i++) {
641 for (j = 0; j < numNames; j++) {
643 /*@innercontinue@*/ continue;
645 item = xmalloc(strlen(names[j]) + strlen(versions[j]) + 20);
646 if (flags[j] & RPMSENSE_SENSEMASK) {
647 buf[0] = '%', buf[1] = '\0';
648 flagsStr = depflagsFormat(RPM_INT32_TYPE, flags, buf, 0, j);
649 sprintf(item, "%s %s %s", names[j], flagsStr, versions[j]);
650 flagsStr = _free(flagsStr);
652 strcpy(item, names[j]);
655 chptr = xrealloc(chptr, strlen(chptr) + strlen(item) + 5);
656 if (*chptr != '\0') strcat(chptr, ", ");
664 names = hfd(names, tnt);
665 versions = hfd(versions, tvt);
672 * Retrieve trigger type info.
674 * @retval *type tag type
675 * @retval *data tag value
676 * @retval *count no. of data items
677 * @retval *freeData data-was-malloc'ed indicator
678 * @return 0 on success
680 static int triggertypeTag(Header h, /*@out@*/ rpmTagType * type,
681 /*@out@*/ const void ** data, /*@out@*/ int_32 * count,
682 /*@out@*/ int * freeData)
683 /*@modifies *type, *data, *count, *freeData @*/
684 /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
685 /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
687 HGE_t hge = (HGE_t)headerGetEntryMinMemory;
688 HFD_t hfd = headerFreeData;
690 int_32 * indices, * flags;
694 int numScripts, numNames;
696 if (!hge(h, RPMTAG_TRIGGERINDEX, NULL, (void **) &indices, &numNames)) {
701 xx = hge(h, RPMTAG_TRIGGERFLAGS, NULL, (void **) &flags, NULL);
702 xx = hge(h, RPMTAG_TRIGGERSCRIPTS, &tst, (void **) &s, &numScripts);
706 *data = conds = xmalloc(sizeof(*conds) * numScripts);
708 *type = RPM_STRING_ARRAY_TYPE;
709 for (i = 0; i < numScripts; i++) {
710 for (j = 0; j < numNames; j++) {
712 /*@innercontinue@*/ continue;
714 if (flags[j] & RPMSENSE_TRIGGERPREIN)
715 conds[i] = xstrdup("prein");
716 else if (flags[j] & RPMSENSE_TRIGGERIN)
717 conds[i] = xstrdup("in");
718 else if (flags[j] & RPMSENSE_TRIGGERUN)
719 conds[i] = xstrdup("un");
720 else if (flags[j] & RPMSENSE_TRIGGERPOSTUN)
721 conds[i] = xstrdup("postun");
723 conds[i] = xstrdup("");
724 /*@innerbreak@*/ break;
732 * Retrieve file paths.
734 * @retval *type tag type
735 * @retval *data tag value
736 * @retval *count no. of data items
737 * @retval *freeData data-was-malloc'ed indicator
738 * @return 0 on success
740 static int filenamesTag(Header h, /*@out@*/ rpmTagType * type,
741 /*@out@*/ const void ** data, /*@out@*/ int_32 * count,
742 /*@out@*/ int * freeData)
743 /*@modifies *type, *data, *count, *freeData @*/
744 /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
745 /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
747 *type = RPM_STRING_ARRAY_TYPE;
749 rpmfiBuildFNames(h, RPMTAG_BASENAMES, (const char ***) data, count);
752 *freeData = 0; /* XXX WTFO? */
758 * Retrieve file classes.
760 * @retval *type tag type
761 * @retval *data tag value
762 * @retval *count no. of data items
763 * @retval *freeData data-was-malloc'ed indicator
764 * @return 0 on success
766 static int fileclassTag(Header h, /*@out@*/ rpmTagType * type,
767 /*@out@*/ const void ** data, /*@out@*/ int_32 * count,
768 /*@out@*/ int * freeData)
769 /*@globals fileSystem @*/
770 /*@modifies h, *type, *data, *count, *freeData, fileSystem @*/
771 /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
772 /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
774 *type = RPM_STRING_ARRAY_TYPE;
775 rpmfiBuildFClasses(h, (const char ***) data, count);
781 * Retrieve file provides.
783 * @retval *type tag type
784 * @retval *data tag value
785 * @retval *count no. of data items
786 * @retval *freeData data-was-malloc'ed indicator
787 * @return 0 on success
789 static int fileprovideTag(Header h, /*@out@*/ rpmTagType * type,
790 /*@out@*/ const void ** data, /*@out@*/ int_32 * count,
791 /*@out@*/ int * freeData)
792 /*@globals fileSystem @*/
793 /*@modifies h, *type, *data, *count, *freeData, fileSystem @*/
794 /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
795 /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
797 *type = RPM_STRING_ARRAY_TYPE;
798 rpmfiBuildFDeps(h, RPMTAG_PROVIDENAME, (const char ***) data, count);
804 * Retrieve file requires.
806 * @retval *type tag type
807 * @retval *data tag value
808 * @retval *count no. of data items
809 * @retval *freeData data-was-malloc'ed indicator
810 * @return 0 on success
812 static int filerequireTag(Header h, /*@out@*/ rpmTagType * type,
813 /*@out@*/ const void ** data, /*@out@*/ int_32 * count,
814 /*@out@*/ int * freeData)
815 /*@globals fileSystem @*/
816 /*@modifies h, *type, *data, *count, *freeData, fileSystem @*/
817 /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
818 /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
820 *type = RPM_STRING_ARRAY_TYPE;
821 rpmfiBuildFDeps(h, RPMTAG_REQUIRENAME, (const char ***) data, count);
826 /* I18N look aside diversions */
828 /*@-exportlocal -exportheadervar@*/
830 int _nl_msg_cat_cntr; /* XXX GNU gettext voodoo */
831 /*@=exportlocal =exportheadervar@*/
832 /*@observer@*/ /*@unchecked@*/
833 static const char * language = "LANGUAGE";
835 /*@observer@*/ /*@unchecked@*/
836 static const char * _macro_i18ndomains = "%{?_i18ndomains}";
839 * Retrieve i18n text.
842 * @retval *type tag type
843 * @retval *data tag value
844 * @retval *count no. of data items
845 * @retval *freeData data-was-malloc'ed indicator
846 * @return 0 on success
848 static int i18nTag(Header h, int_32 tag, /*@out@*/ rpmTagType * type,
849 /*@out@*/ const void ** data, /*@out@*/ int_32 * count,
850 /*@out@*/ int * freeData)
851 /*@globals rpmGlobalMacroContext @*/
852 /*@modifies *type, *data, *count, *freeData, rpmGlobalMacroContext @*/
853 /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
854 /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
856 HGE_t hge = (HGE_t)headerGetEntryMinMemory;
857 char * dstring = rpmExpand(_macro_i18ndomains, NULL);
860 *type = RPM_STRING_TYPE;
865 if (dstring && *dstring) {
867 const char * langval;
871 { const char * tn = tagName(tag);
874 (void) headerNVR(h, &n, NULL, NULL);
875 mk = alloca(strlen(n) + strlen(tn) + sizeof("()"));
876 sprintf(mk, "%s(%s)", n, tn);
880 /* change to en_US for msgkey -> msgid resolution */
881 langval = getenv(language);
882 (void) setenv(language, "en_US", 1);
883 /*@i@*/ ++_nl_msg_cat_cntr;
887 for (domain = dstring; domain != NULL; domain = de) {
888 de = strchr(domain, ':');
889 if (de) *de++ = '\0';
890 msgid = /*@-unrecog@*/ dgettext(domain, msgkey) /*@=unrecog@*/;
891 if (msgid != msgkey) break;
895 /* restore previous environment for msgid -> msgstr resolution */
897 (void) setenv(language, langval, 1);
900 /*@i@*/ ++_nl_msg_cat_cntr;
902 if (domain && msgid) {
903 *data = /*@-unrecog@*/ dgettext(domain, msgid) /*@=unrecog@*/;
904 *data = xstrdup(*data); /* XXX xstrdup has side effects. */
908 dstring = _free(dstring);
913 dstring = _free(dstring);
915 rc = hge(h, tag, type, (void **)data, count);
917 if (rc && (*data) != NULL) {
918 *data = xstrdup(*data);
930 * Retrieve summary text.
932 * @retval *type tag type
933 * @retval *data tag value
934 * @retval *count no. of data items
935 * @retval *freeData data-was-malloc'ed indicator
936 * @return 0 on success
938 static int summaryTag(Header h, /*@out@*/ rpmTagType * type,
939 /*@out@*/ const void ** data, /*@out@*/ int_32 * count,
940 /*@out@*/ int * freeData)
941 /*@globals rpmGlobalMacroContext @*/
942 /*@modifies *type, *data, *count, *freeData, rpmGlobalMacroContext @*/
943 /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
944 /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
946 return i18nTag(h, RPMTAG_SUMMARY, type, data, count, freeData);
950 * Retrieve description text.
952 * @retval *type tag type
953 * @retval *data tag value
954 * @retval *count no. of data items
955 * @retval *freeData data-was-malloc'ed indicator
956 * @return 0 on success
958 static int descriptionTag(Header h, /*@out@*/ rpmTagType * type,
959 /*@out@*/ const void ** data, /*@out@*/ int_32 * count,
960 /*@out@*/ int * freeData)
961 /*@globals rpmGlobalMacroContext @*/
962 /*@modifies *type, *data, *count, *freeData, rpmGlobalMacroContext @*/
963 /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
964 /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
966 return i18nTag(h, RPMTAG_DESCRIPTION, type, data, count, freeData);
970 * Retrieve group text.
972 * @retval *type tag type
973 * @retval *data tag value
974 * @retval *count no. of data items
975 * @retval *freeData data-was-malloc'ed indicator
976 * @return 0 on success
978 static int groupTag(Header h, /*@out@*/ rpmTagType * type,
979 /*@out@*/ const void ** data, /*@out@*/ int_32 * count,
980 /*@out@*/ int * freeData)
981 /*@globals rpmGlobalMacroContext @*/
982 /*@modifies *type, *data, *count, *freeData, rpmGlobalMacroContext @*/
983 /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
984 /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
986 return i18nTag(h, RPMTAG_GROUP, type, data, count, freeData);
989 /*@-type@*/ /* FIX: cast? */
990 const struct headerSprintfExtension_s rpmHeaderFormats[] = {
991 { HEADER_EXT_TAG, "RPMTAG_GROUP", { groupTag } },
992 { HEADER_EXT_TAG, "RPMTAG_DESCRIPTION", { descriptionTag } },
993 { HEADER_EXT_TAG, "RPMTAG_SUMMARY", { summaryTag } },
994 { HEADER_EXT_TAG, "RPMTAG_FILECLASS", { fileclassTag } },
995 { HEADER_EXT_TAG, "RPMTAG_FILENAMES", { filenamesTag } },
996 { HEADER_EXT_TAG, "RPMTAG_FILEPROVIDE", { fileprovideTag } },
997 { HEADER_EXT_TAG, "RPMTAG_FILEREQUIRE", { filerequireTag } },
998 { HEADER_EXT_TAG, "RPMTAG_FSSIZES", { fssizesTag } },
999 { HEADER_EXT_TAG, "RPMTAG_FSNAMES", { fsnamesTag } },
1000 { HEADER_EXT_TAG, "RPMTAG_INSTALLPREFIX", { instprefixTag } },
1001 { HEADER_EXT_TAG, "RPMTAG_TRIGGERCONDS", { triggercondsTag } },
1002 { HEADER_EXT_TAG, "RPMTAG_TRIGGERTYPE", { triggertypeTag } },
1003 { HEADER_EXT_FORMAT, "armor", { armorFormat } },
1004 { HEADER_EXT_FORMAT, "base64", { base64Format } },
1005 { HEADER_EXT_FORMAT, "pgpsig", { pgpsigFormat } },
1006 { HEADER_EXT_FORMAT, "depflags", { depflagsFormat } },
1007 { HEADER_EXT_FORMAT, "fflags", { fflagsFormat } },
1008 { HEADER_EXT_FORMAT, "perms", { permsFormat } },
1009 { HEADER_EXT_FORMAT, "permissions", { permsFormat } },
1010 { HEADER_EXT_FORMAT, "triggertype", { triggertypeFormat } },
1011 { HEADER_EXT_FORMAT, "xml", { xmlFormat } },
1012 { HEADER_EXT_MORE, NULL, { (void *) headerDefaultFormats } }