# lib/formats.c File Reference

`#include "system.h"`
`#include <rpmlib.h>`
`#include <rpmmacro.h>`
`#include "rpmpgp.h"`
`#include "manifest.h"`
`#include "misc.h"`
`#include "debug.h"`

Go to the source code of this file.

## Functions

static char * | triggertypeFormat (int_32 type, const void *data, char *formatPrefix, int padding, int element)
static char * | permsFormat (int_32 type, const void *data, char *formatPrefix, int padding, int element)
static char * | fflagsFormat (int_32 type, const void *data, char *formatPrefix, int padding, int element)
static char * | armorFormat (int_32 type, const void *data, char *formatPrefix, int padding, int element)
static char * | base64Format (int_32 type, const void *data, char *formatPrefix, int padding, int element)
static char * | depflagsFormat (int_32 type, const void *data, char *formatPrefix, int padding, int element)
static int | fsnamesTag (Header h, int_32 *type, void **data, int_32 *count, int *freeData)
static int | instprefixTag (Header h, rpmTagType *type, const void **data, int_32 *count, int *freeData)
static int | fssizesTag (Header h, rpmTagType *type, const void **data, int_32 *count, int *freeData)
static int | triggercondsTag (Header h, rpmTagType *type, const void **data, int_32 *count, int *freeData)
static int | triggertypeTag (Header h, rpmTagType *type, const void **data, int_32 *count, int *freeData)
static int | filenamesTag (Header h, rpmTagType *type, const void **data, int_32 *count, int *freeData)
static int | i18nTag (Header h, int_32 tag, rpmTagType *type, const void **data, int_32 *count, int *freeData)
static int | summaryTag (Header h, rpmTagType *type, const void **data, int_32 *count, int *freeData)
static int | descriptionTag (Header h, rpmTagType *type, const void **data, int_32 *count, int *freeData)
static int | groupTag (Header h, rpmTagType *type, const void **data, int_32 *count, int *freeData)

## Variables

int | _nl_msg_cat_cntr
static const char * | language = "LANGUAGE"
static const char * | _macro_i18ndomains
const struct headerSprintfExtension_s | rpmHeaderFormats []
| Table of query format extensions.

## Detailed Description

Definition in file formats.c.

## Function Documentation

static char* armorFormat | ( | int_32 | type,
|  | const void * | data,
|  | char * | formatPrefix,
|  | int | padding,
|  | int | element
| ) | `[static]`

Parameters:

  | type | tag type
  | data | tag value
  | formatPrefix |
  | padding |
  | element | (unused)

Returns:
  formatted string

Definition at line 118 of file formats.c.

References _, _free(), PGPARMOR_PUBKEY, PGPARMOR_SIGNATURE, pgpArmorTbl, pgpValStr(), RPM_BIN_TYPE, RPM_CHAR_TYPE, RPM_I18NSTRING_TYPE, RPM_INT16_TYPE, RPM_INT32_TYPE, RPM_INT8_TYPE, RPM_NULL_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, RPMVERSION, stpcpy(), xmalloc(), and xstrdup().

static char* base64Format | ( | int_32 | type,
|  | const void * | data,
|  | char * | formatPrefix,
|  | int | padding,
|  | int | element
| ) | `[static]`

Parameters:

  | type | tag type
  | data | tag value
  | formatPrefix |
  | padding |
  | element | (unused)

Returns:
  formatted string

Definition at line 204 of file formats.c.

References _, _free(), RPM_BIN_TYPE, stpcpy(), xmalloc(), and xstrdup().

static char* depflagsFormat | ( | int_32 | type,
|  | const void * | data,
|  | char * | formatPrefix,
|  | int | padding,
|  | int | element
| ) | `[static]`

Parameters:

  | type | tag type
  | data | tag value
  | formatPrefix |
  | padding |
  | element | (unused)

Returns:
  formatted string

Definition at line 272 of file formats.c.

References _, RPM_INT32_TYPE, RPMSENSE_EQUAL, RPMSENSE_GREATER, RPMSENSE_LESS, xmalloc(), and xstrdup().

Referenced by triggercondsTag().

static int descriptionTag | ( | Header | h,
|  | rpmTagType * | type,
|  | const void ** | data,
|  | int_32 * | count,
|  | int * | freeData
| ) | `[static]`

Parameters:

  | h | header

Return values:

  | type | address of tag type
  | data | address of tag value pointer
  | count | address of no. of data items
  | freedata | address of data-was-malloc'ed indicator

Returns:
  0 on success

Definition at line 692 of file formats.c.

References i18nTag(), and RPMTAG_DESCRIPTION.

static char* fflagsFormat | ( | int_32 | type,
|  | const void * | data,
|  | char * | formatPrefix,
|  | int | padding,
|  | int | element
| ) | `[static]`

Parameters:

  | type | tag type
  | data | tag value
  | formatPrefix |
  | padding |
  | element | (unused)

Returns:
  formatted string

Definition at line 75 of file formats.c.

References _, RPM_INT32_TYPE, RPMFILE_CONFIG, RPMFILE_DOC, RPMFILE_GHOST, RPMFILE_MISSINGOK, RPMFILE_NOREPLACE, RPMFILE_SPECFILE, xmalloc(), and xstrdup().

static int filenamesTag | ( | Header | h,
|  | rpmTagType * | type,
|  | const void ** | data,
|  | int_32 * | count,
|  | int * | freeData
| ) | `[static]`

Parameters:

  | h | header

Return values:

  | type | address of tag type
  | data | address of tag value pointer
  | count | address of no. of data items
  | freedata | address of data-was-malloc'ed indicator

Returns:
  0 on success

Definition at line 551 of file formats.c.

References RPM_STRING_ARRAY_TYPE, and rpmBuildFileList().

static int fsnamesTag | ( | Header | h,
|  | int_32 * | type,
|  | void ** | data,
|  | int_32 * | count,
|  | int * | freeData
| ) | `[static]`

Parameters:

  | h | header

Return values:

  | type | address of tag type
  | data | address of tag value pointer
  | count | address of no. of data items
  | freedata | address of data-was-malloc'ed indicator

Returns:
  0 on success

Definition at line 310 of file formats.c.

References RPM_STRING_ARRAY_TYPE, and rpmGetFilesystemList().

static int fssizesTag | ( | Header | h,
|  | rpmTagType * | type,
|  | const void ** | data,
|  | int_32 * | count,
|  | int * | freeData
| ) | `[static]`

Parameters:

  | h | header

Return values:

  | type | address of tag type
  | data | address of tag value pointer
  | count | address of no. of data items
  | freedata | address of data-was-malloc'ed indicator

Returns:
  0 on success

Definition at line 372 of file formats.c.

References _free(), headerGetEntryMinMemory(), RPM_INT32_TYPE, rpmBuildFileList(), rpmGetFilesystemList(), rpmGetFilesystemUsage(), RPMTAG_FILESIZES, and xcalloc().

static int groupTag | ( | Header | h,
|  | rpmTagType * | type,
|  | const void ** | data,
|  | int_32 * | count,
|  | int * | freeData
| ) | `[static]`

Parameters:

  | h | header

Return values:

  | type | address of tag type
  | data | address of tag value pointer
  | count | address of no. of data items
  | freedata | address of data-was-malloc'ed indicator

Returns:
  0 on success

Definition at line 709 of file formats.c.

References i18nTag(), and RPMTAG_GROUP.

static int i18nTag | ( | Header | h,
|  | int_32 | tag,
|  | rpmTagType * | type,
|  | const void ** | data,
|  | int_32 * | count,
|  | int * | freeData
| ) | `[static]`

Parameters:

  | h | header
  | tag | tag

Return values:

  | type | address of tag type
  | data | address of tag value pointer
  | count | address of no. of data items
  | freedata | address of data-was-malloc'ed indicator

Returns:
  0 on success

Definition at line 588 of file formats.c.

References _free(), _macro_i18ndomains, _nl_msg_cat_cntr, alloca(), dgettext, getenv(), headerGetEntryMinMemory(), headerNVR(), language, RPM_STRING_TYPE, rpmExpand(), setenv(), tagName(), unsetenv(), and xstrdup().

Referenced by descriptionTag(), groupTag(), and summaryTag().

static int instprefixTag | ( | Header | h,
|  | rpmTagType * | type,
|  | const void ** | data,
|  | int_32 * | count,
|  | int * | freeData
| ) | `[static]`

Parameters:

  | h | header

Return values:

  | type | address of tag type
  | data | address of tag value pointer
  | count | address of no. of data items
  | freedata | address of data-was-malloc'ed indicator

Returns:
  0 on success

Definition at line 339 of file formats.c.

References headerFreeData(), headerGetEntryMinMemory(), RPM_STRING_TYPE, RPMTAG_INSTALLPREFIX, RPMTAG_INSTPREFIXES, and xstrdup().

static char* permsFormat | ( | int_32 | type,
|  | const void * | data,
|  | char * | formatPrefix,
|  | int | padding,
|  | int | element
| ) | `[static]`

Parameters:

  | type | tag type
  | data | tag value
  | formatPrefix |
  | padding |
  | element | (unused)

Returns:
  formatted string

Definition at line 45 of file formats.c.

References _, _free(), RPM_INT32_TYPE, rpmPermsString(), xmalloc(), and xstrdup().

static int summaryTag | ( | Header | h,
|  | rpmTagType * | type,
|  | const void ** | data,
|  | int_32 * | count,
|  | int * | freeData
| ) | `[static]`

Parameters:

  | h | header

Return values:

  | type | address of tag type
  | data | address of tag value pointer
  | count | address of no. of data items
  | freedata | address of data-was-malloc'ed indicator

Returns:
  0 on success

Definition at line 675 of file formats.c.

References i18nTag(), and RPMTAG_SUMMARY.

static int triggercondsTag | ( | Header | h,
|  | rpmTagType * | type,
|  | const void ** | data,
|  | int_32 * | count,
|  | int * | freeData
| ) | `[static]`

Parameters:

  | h | header

Return values:

  | type | address of tag type
  | data | address of tag value pointer
  | count | address of no. of data items
  | freedata | address of data-was-malloc'ed indicator

Returns:
  0 on success

Definition at line 426 of file formats.c.

References _free(), depflagsFormat(), headerFreeData(), headerGetEntryMinMemory(), RPM_INT32_TYPE, RPM_STRING_ARRAY_TYPE, RPMSENSE_SENSEMASK, RPMTAG_TRIGGERFLAGS, RPMTAG_TRIGGERINDEX, RPMTAG_TRIGGERNAME, RPMTAG_TRIGGERSCRIPTS, RPMTAG_TRIGGERVERSION, xmalloc(), xrealloc(), and xstrdup().

static char* triggertypeFormat | ( | int_32 | type,
|  | const void * | data,
|  | char * | formatPrefix,
|  | int | padding,
|  | int | element
| ) | `[static]`

Parameters:

  | type | tag type
  | data | tag value
  | formatPrefix | (unused)
  | padding | (unused)
  | element | (unused)

Returns:
  formatted string

Definition at line 21 of file formats.c.

References _, RPM_INT32_TYPE, RPMSENSE_TRIGGERIN, and xstrdup().

static int triggertypeTag | ( | Header | h,
|  | rpmTagType * | type,
|  | const void ** | data,
|  | int_32 * | count,
|  | int * | freeData
| ) | `[static]`

Parameters:

  | h | header

Return values:

  | type | address of tag type
  | data | address of tag value pointer
  | count | address of no. of data items
  | freedata | address of data-was-malloc'ed indicator

Returns:
  0 on success

Definition at line 498 of file formats.c.

References headerFreeData(), headerGetEntryMinMemory(), RPM_STRING_ARRAY_TYPE, RPMSENSE_TRIGGERIN, RPMSENSE_TRIGGERUN, RPMTAG_TRIGGERFLAGS, RPMTAG_TRIGGERINDEX, RPMTAG_TRIGGERSCRIPTS, xmalloc(), and xstrdup().

## Variable Documentation

const char* _macro_i18ndomains`[static]`

Initial value:

                    "%{?_i18ndomains:%{_i18ndomains}}"

Definition at line 576 of file formats.c.

Referenced by i18nTag().

int _nl_msg_cat_cntr

| Definition at line 570 of file formats.c. Referenced by i18nTag().

const char* language = "LANGUAGE"`[static]`

| Definition at line 573 of file formats.c. Referenced by i18nTag().

const struct headerSprintfExtension_s rpmHeaderFormats[]

Initial value:

     {
        { HEADER_EXT_TAG, "RPMTAG_GROUP", { groupTag } },
        { HEADER_EXT_TAG, "RPMTAG_DESCRIPTION", { descriptionTag } },
        { HEADER_EXT_TAG, "RPMTAG_SUMMARY", { summaryTag } },
        { HEADER_EXT_TAG, "RPMTAG_FILENAMES", { filenamesTag } },
        { HEADER_EXT_TAG, "RPMTAG_FSSIZES", { fssizesTag } },
        { HEADER_EXT_TAG, "RPMTAG_FSNAMES", { fsnamesTag } },
        { HEADER_EXT_TAG, "RPMTAG_INSTALLPREFIX", { instprefixTag } },
        { HEADER_EXT_TAG, "RPMTAG_TRIGGERCONDS", { triggercondsTag } },
        { HEADER_EXT_TAG, "RPMTAG_TRIGGERTYPE", { triggertypeTag } },
        { HEADER_EXT_FORMAT, "armor", { armorFormat } },
        { HEADER_EXT_FORMAT, "base64", { base64Format } },

        { HEADER_EXT_FORMAT, "depflags", { depflagsFormat } },
        { HEADER_EXT_FORMAT, "fflags", { fflagsFormat } },
        { HEADER_EXT_FORMAT, "perms", { permsFormat } },
        { HEADER_EXT_FORMAT, "permissions", { permsFormat } },
        { HEADER_EXT_FORMAT, "triggertype", { triggertypeFormat } },
        { HEADER_EXT_MORE, NULL, { (void *) headerDefaultFormats } }
    }

Table of query format extensions.

Note:
  Chains to headerDefaultFormats[].

Definition at line 719 of file formats.c.

Referenced by hdrSprintf(), hdrSubscript(), initrpm(), packageBinaries(), psmStage(), queryHeader(), rpmDisplayQueryTags(), rpmHeaderGetEntry(), and rpmShowProgress().