Main Page Modules Data Structures File List Data Fields Globals Related Pages

# lib/formats.c File Reference

More...

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

Go to the source code of this file.

## Functions
char * | triggertypeFormat (int_32 type, const void *data, char *formatPrefix, int padding, int element)
| Identify type of trigger. More...
char * | permsFormat (int_32 type, const void *data, char *formatPrefix, int padding, int element)
| Format file permissions for display. More...
char * | fflagsFormat (int_32 type, const void *data, char *formatPrefix, int padding, int element)
| Format file flags for display. More...
char * | armorFormat (int_32 type, const void *data, char *formatPrefix, int padding, int element)
| Wrap a pubkey in ascii armor for display. More...
char * | base64Format (int_32 type, const void *data, char *formatPrefix, int padding, int element)
| Encode binary data in base64 for display. More...
char * | pgpsigFormat (int_32 type, const void *data, char *formatPrefix, int padding, int element)
| Display signature fingerprint and time. More...
char * | depflagsFormat (int_32 type, const void *data, char *formatPrefix, int padding, int element)
| Format dependency flags for display. More...
int | fsnamesTag (Header h, int_32 *type, void **data, int_32 *count, int *freeData)
| Retrieve mounted file system paths. More...
int | instprefixTag (Header h, rpmTagType *type, const void **data, int_32 *count, int *freeData)
| Retrieve install prefixes. More...
int | fssizesTag (Header h, rpmTagType *type, const void **data, int_32 *count, int *freeData)
| Retrieve mounted file system space. More...
int | triggercondsTag (Header h, rpmTagType *type, const void **data, int_32 *count, int *freeData)
| Retrieve trigger info. More...
int | triggertypeTag (Header h, rpmTagType *type, const void **data, int_32 *count, int *freeData)
| Retrieve trigger type info. More...
int | filenamesTag (Header h, rpmTagType *type, const void **data, int_32 *count, int *freeData)
| Retrieve file paths. More...
int | i18nTag (Header h, int_32 tag, rpmTagType *type, const void **data, int_32 *count, int *freeData)
| Retrieve i18n text. More...
int | summaryTag (Header h, rpmTagType *type, const void **data, int_32 *count, int *freeData)
| Retrieve summary text. More...
int | descriptionTag (Header h, rpmTagType *type, const void **data, int_32 *count, int *freeData)
| Retrieve description text. More...
int | groupTag (Header h, rpmTagType *type, const void **data, int_32 *count, int *freeData)
| Retrieve group text. More...
## Variables
int | _nl_msg_cat_cntr
const char * | language = "LANGUAGE"
const char * | _macro_i18ndomains
const struct headerSprintfExtension_s | rpmHeaderFormats []
| Table of query format extensions. More...

## Detailed Description

Definition in file formats.c.

## Function Documentation

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

  | Wrap a pubkey in ascii armor for display. Todo: Permit selectable display formats (i.e. binary). Parameters:
  type | tag type
  data | tag value
  formatPrefix |
  padding |
  element | (unused)
Returns: formatted string Definition at line 139 of file formats.c. References _, _free, b64crc, b64decode, b64encode, int_32, PGPARMOR_PUBKEY, PGPARMOR_SIGNATURE, 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, stpcpy, xmalloc, and xstrdup.

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

  | Encode binary data in base64 for display. Todo: Permit selectable display formats (i.e. binary). Parameters:
  type | tag type
  data | tag value
  formatPrefix |
  padding |
  element | (unused)
Returns: formatted string Definition at line 229 of file formats.c. References _, _free, b64encode, int_32, RPM_BIN_TYPE, stpcpy, xmalloc, and xstrdup.

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

  | Format dependency flags for display. Parameters:
  type | tag type
  data | tag value
  formatPrefix |
  padding |
  element | (unused)
Returns: formatted string Definition at line 376 of file formats.c. References _, int_32, RPM_INT32_TYPE, RPMSENSE_EQUAL, RPMSENSE_GREATER, RPMSENSE_LESS, xmalloc, and xstrdup. Referenced by triggercondsTag.

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

  | Retrieve description text. 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 833 of file formats.c. References i18nTag, int_32, RPMTAG_DESCRIPTION, and rpmTagType.

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

  | Format file flags for display. Parameters:
  type | tag type
  data | tag value
  formatPrefix |
  padding |
  element | (unused)
Returns: formatted string Definition at line 85 of file formats.c. References _, int_32, RPM_INT32_TYPE, RPMFILE_CONFIG, RPMFILE_DOC, RPMFILE_GHOST, RPMFILE_LICENSE, RPMFILE_MISSINGOK, RPMFILE_NOREPLACE, RPMFILE_README, RPMFILE_SPECFILE, xmalloc, and xstrdup.

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

  | Retrieve file paths. 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 683 of file formats.c. References int_32, RPM_STRING_ARRAY_TYPE, rpmBuildFileList, and rpmTagType.

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

  | Retrieve mounted file system paths. 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 420 of file formats.c. References int_32, RPM_STRING_ARRAY_TYPE, and rpmGetFilesystemList.

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

  | Retrieve mounted file system space. 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 490 of file formats.c. References _free, HGE_t, int_32, RPM_INT32_TYPE, rpmBuildFileList, rpmGetFilesystemList, rpmGetFilesystemUsage, RPMTAG_FILESIZES, rpmTagType, uint_32, and xcalloc.

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

  | Retrieve group text. 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 853 of file formats.c. References i18nTag, int_32, RPMTAG_GROUP, and rpmTagType.

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

  | Retrieve i18n text. 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 723 of file formats.c. References _free, _macro_i18ndomains, _nl_msg_cat_cntr, alloca, dgettext, getenv, headerNVR, HGE_t, int_32, language, RPM_STRING_TYPE, rpmExpand, rpmTagType, setenv, tagName, unsetenv, and xstrdup. Referenced by descriptionTag, groupTag, and summaryTag.

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

  | Retrieve install prefixes. 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 452 of file formats.c. References HFD_t, HGE_t, int_32, RPM_STRING_TYPE, RPMTAG_INSTALLPREFIX, RPMTAG_INSTPREFIXES, rpmTagType, and xstrdup.

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

  | Format file permissions for display. Parameters:
  type | tag type
  data | tag value
  formatPrefix |
  padding |
  element | (unused)
Returns: formatted string Definition at line 51 of file formats.c. References _, _free, int_32, RPM_INT32_TYPE, rpmPermsString, xmalloc, and xstrdup.

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

  | Display signature fingerprint and time. Parameters:
  type | tag type
  data | tag value
  formatPrefix |
  padding |
  element | (unused)
Returns: formatted string Definition at line 276 of file formats.c. References _, pgpDigParams_s::hash_algo, int_32, pgpFreeDig, pgpGrab, PGPHASHALGO_MD5, PGPHASHALGO_SHA1, pgpHexStr, pgpLen, pgpNewDig, pgpPrtPkts, PGPPUBKEYALGO_DSA, PGPPUBKEYALGO_RSA, pgpTag, PGPTAG_SIGNATURE, pgpDigParams_s::pubkey_algo, RPM_BIN_TYPE, pgpDig_s::signature, pgpDigParams_s::signid, stpcpy, pgpDigParams_s::time, xmalloc, and xstrdup.

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

  | Retrieve summary text. 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 813 of file formats.c. References i18nTag, int_32, RPMTAG_SUMMARY, and rpmTagType.

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

  | Retrieve trigger info. 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 _free, depflagsFormat, HFD_t, HGE_t, int_32, RPM_INT32_TYPE, RPM_STRING_ARRAY_TYPE, RPMSENSE_SENSEMASK, RPMTAG_TRIGGERFLAGS, RPMTAG_TRIGGERINDEX, RPMTAG_TRIGGERNAME, RPMTAG_TRIGGERSCRIPTS, RPMTAG_TRIGGERVERSION, rpmTagType, xmalloc, xrealloc, and xstrdup.

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

  | Identify type of trigger. Parameters:
  type | tag type
  data | tag value
  formatPrefix | (unused)
  padding | (unused)
  element | (unused)
Returns: formatted string Definition at line 25 of file formats.c. References _, int_32, RPM_INT32_TYPE, RPMSENSE_TRIGGERIN, and xstrdup.

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

  | Retrieve trigger type info. 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 627 of file formats.c. References HFD_t, HGE_t, int_32, RPM_STRING_ARRAY_TYPE, RPMSENSE_TRIGGERIN, RPMSENSE_TRIGGERUN, RPMTAG_TRIGGERFLAGS, RPMTAG_TRIGGERINDEX, RPMTAG_TRIGGERSCRIPTS, rpmTagType, xmalloc, and xstrdup.

## Variable Documentation

const char* _macro_i18ndomains`[static]`

| Initial value:
                    "%{?_i18ndomains:%{_i18ndomains}}"
Definition at line 710 of file formats.c. Referenced by i18nTag.

int _nl_msg_cat_cntr

| Definition at line 704 of file formats.c. Referenced by i18nTag.

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

| Definition at line 707 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, "pgpsig", { pgpsigFormat } },
        { 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 865 of file formats.c.