rpmdb/hdrfmt.c File Reference

#include "system.h"
#include "rpmio_internal.h"
#include <rpmbc.h>
#include <rpmcb.h>
#include <rpmmacro.h>
#include <rpmtag.h>
#include <rpmlib.h>
#include <rpmfi.h>
#include <rpmevr.h>
#include "legacy.h"
#include "argv.h"
#include "misc.h"
#include "debug.h"
Include dependency graph for hdrfmt.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  sprintfTag_s
struct  sprintfToken_s
struct  headerSprintfArgs_s

Defines

#define _RPMTAG_INTERNAL
#define _RPMEVR_INTERNAL
#define PARSER_BEGIN   0
#define PARSER_IN_ARRAY   1
#define PARSER_IN_EXPR   2

Typedefs

typedef struct sprintfTag_ssprintfTag
typedef struct sprintfToken_ssprintfToken
typedef struct
headerSprintfArgs_s
headerSprintfArgs

Functions

static char * intFormat (HE_t he, const char *fmt)
 Convert tag data representation.
static char * octFormat (HE_t he)
 Return octal formatted data.
static char * hexFormat (HE_t he)
 Return hex formatted data.
static char * decFormat (HE_t he)
 Return decimal formatted data.
static char * realDateFormat (HE_t he, const char *strftimeFormat)
 Return strftime formatted data.
static char * dateFormat (HE_t he)
 Return date formatted data.
static char * dayFormat (HE_t he)
 Return day formatted data.
static char * shescapeFormat (HE_t he)
 Return shell escape formatted data.
static char * rpmPermsString (int mode)
static char * triggertypeFormat (HE_t he)
 Identify type of trigger.
static char * permsFormat (HE_t he)
 Format file permissions for display.
static char * fflagsFormat (HE_t he)
 Format file flags for display.
static char * armorFormat (HE_t he)
 Wrap a pubkey in ascii armor for display.
static char * base64Format (HE_t he)
 Encode binary data in base64 for display.
static size_t xmlstrlen (const char *s)
 Return length of string represented with xml characters substituted.
static char * xmlstrcpy (char *t, const char *s)
 Copy source string to target, substituting for xml characters.
static char * xmlFormat (HE_t he)
 Wrap tag data in simple header xml markup.
static size_t yamlstrlen (const char *s, int lvl)
 Return length of string represented with yaml indentation.
static char * yamlstrcpy (char *t, const char *s, int lvl)
 Copy source string to target, indenting for yaml.
static char * yamlFormat (HE_t he)
 Wrap tag data in simple header yaml markup.
static char * pgpsigFormat (HE_t he)
 Display signature fingerprint and time.
static char * depflagsFormat (HE_t he)
 Format dependency flags for display.
static int instprefixTag (Header h, HE_t he)
 Retrieve install prefixes.
static int triggercondsTag (Header h, HE_t he)
 Retrieve trigger info.
static int triggertypeTag (Header h, HE_t he)
 Retrieve trigger type info.
static int i18nTag (Header h, HE_t he)
 Retrieve i18n text.
static int localeTag (Header h, HE_t he)
 Retrieve text and convert to locale.
static int summaryTag (Header h, HE_t he)
 Retrieve summary text.
static int descriptionTag (Header h, HE_t he)
 Retrieve description text.
static int changelognameTag (Header h, HE_t he)
static int changelogtextTag (Header h, HE_t he)
static int groupTag (Header h, HE_t he)
 Retrieve group text.
static int dbinstanceTag (Header h, HE_t he)
 Retrieve db instance from header.
static char * hGetNVRA (Header h)
 Return (malloc'd) header name-version-release.arch string.
static int nvraTag (Header h, HE_t he)
 Retrieve N-V-R.A compound string from header.
static void rpmfiBuildFNames (Header h, rpmTag tagN, const char ***fnp, rpmTagCount *fcp)
 Retrieve file names from header.
static int _fnTag (Header h, HE_t he)
 Retrieve file paths.
static int filepathsTag (Header h, HE_t he)
static int origpathsTag (Header h, HE_t he)
void rpmDisplayQueryTags (FILE *fp, headerTagTableEntry _rpmTagTable, headerSprintfExtension _rpmHeaderFormats)
 Display list of tags that can be used in --queryformat.
static char escapedChar (const char ch)
static HE_t rpmheClean (HE_t he)
 Clean a tag container, free'ing attached malloc's.
static sprintfToken freeFormat (sprintfToken format, size_t num)
 Destroy headerSprintf format array.
static headerSprintfArgs hsaInit (headerSprintfArgs hsa)
 Initialize an hsa iteration.
static sprintfToken hsaNext (headerSprintfArgs hsa)
 Return next hsa iteration item.
static headerSprintfArgs hsaFini (headerSprintfArgs hsa)
 Finish an hsa iteration.
static char * hsaReserve (headerSprintfArgs hsa, size_t need)
 Reserve sufficient buffer space for next output value.
static const char * myTagName (headerTagTableEntry tbl, uint32_t val, uint32_t *typep)
 Return tag name from value.
static uint32_t myTagValue (headerTagTableEntry tbl, const char *name)
 Return tag value from name.
static int findTag (headerSprintfArgs hsa, sprintfToken token, const char *name)
 Search extensions and tags for a name.
static int parseExpression (headerSprintfArgs hsa, sprintfToken token, char *str, char **endPtr)
 Parse a headerSprintf expression.
static int parseFormat (headerSprintfArgs hsa, char *str, sprintfToken *formatPtr, size_t *numTokensPtr, char **endPtr, int state)
 Parse a headerSprintf term.
static int getExtension (headerSprintfArgs hsa, headerTagTagFunction fn, HE_t he, HE_t ec)
 Call a header extension only once, saving results.
static char * formatValue (headerSprintfArgs hsa, sprintfTag tag, uint32_t element)
 Format a single item's value.
static char * singleSprintf (headerSprintfArgs hsa, sprintfToken token, uint32_t element)
 Format a single headerSprintf item.
static HE_t rpmecNew (const headerSprintfExtension exts, int *necp)
 Create an extension cache.
static HE_t rpmecFree (const headerSprintfExtension exts, HE_t ec)
 Destroy an extension cache.
char * headerSprintf (Header h, const char *fmt, headerTagTableEntry tags, headerSprintfExtension exts, errmsg_t *errmsg)
 Return formatted output string from header tags.

Variables

int _hdr_debug
static struct
headerSprintfExtension_s 
_headerDefaultFormats []
headerSprintfExtension headerDefaultFormats = &_headerDefaultFormats[0]
 Supported default header tag output formats.
static const char * language = "LANGUAGE"
static const char * _macro_i18ndomains = "%{?_i18ndomains}"
static struct
headerSprintfExtension_s 
_headerCompoundFormats []
headerSprintfExtension headerCompoundFormats = &_headerCompoundFormats[0]
 Supported default header extension/tag output formats.

Define Documentation

#define _RPMEVR_INTERNAL

Definition at line 18 of file hdrfmt.c.

#define _RPMTAG_INTERNAL

Definition at line 12 of file hdrfmt.c.

#define PARSER_BEGIN   0

Definition at line 1785 of file hdrfmt.c.

Referenced by headerSprintf().

#define PARSER_IN_ARRAY   1

Definition at line 1786 of file hdrfmt.c.

Referenced by parseFormat().

#define PARSER_IN_EXPR   2

Definition at line 1787 of file hdrfmt.c.

Referenced by parseExpression(), and parseFormat().


Function Documentation

static int _fnTag ( Header  h,
HE_t  he 
) [static]

Retrieve file paths.

Parameters:
h header
Return values:
*he tag container
Returns:
0 on success

Definition at line 1639 of file hdrfmt.c.

References rpmDataType_u::argv, _HE_s::c, _HE_s::freeData, _HE_s::p, RPM_STRING_ARRAY_TYPE, rpmfiBuildFNames(), _HE_s::t, and _HE_s::tag.

Referenced by filepathsTag(), and origpathsTag().

static char* armorFormat ( HE_t  he  )  [static]

Wrap a pubkey in ascii armor for display.

Todo:
Permit selectable display formats (i.e. binary).
Parameters:
he tag container
Returns:
formatted string

Definition at line 420 of file hdrfmt.c.

References _, _free(), _HE_s::c, _HE_s::ix, _HE_s::p, pgpArmorWrap(), RPM_BIN_TYPE, RPM_I18NSTRING_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, RPM_UINT16_TYPE, RPM_UINT32_TYPE, RPM_UINT64_TYPE, RPM_UINT8_TYPE, rpmDataType_u::str, _HE_s::t, rpmDataType_u::ui8p, and xstrdup().

static char* base64Format ( HE_t  he  )  [static]

Encode binary data in base64 for display.

Todo:
Permit selectable display formats (i.e. binary).
Parameters:
he tag container
Returns:
formatted string

Definition at line 470 of file hdrfmt.c.

References _, _free(), _HE_s::c, _HE_s::ix, _HE_s::p, rpmDataType_u::ptr, RPM_BIN_TYPE, stpcpy(), _HE_s::t, xcalloc(), and xstrdup().

Referenced by xmlFormat(), and yamlFormat().

static int changelognameTag ( Header  h,
HE_t  he 
) [static]

Definition at line 1412 of file hdrfmt.c.

References localeTag(), and _HE_s::tag.

static int changelogtextTag ( Header  h,
HE_t  he 
) [static]

Definition at line 1419 of file hdrfmt.c.

References localeTag(), and _HE_s::tag.

static char* dateFormat ( HE_t  he  )  [static]

Return date formatted data.

Parameters:
he tag container
Returns:
formatted string

Definition at line 181 of file hdrfmt.c.

References _, and realDateFormat().

static char* dayFormat ( HE_t  he  )  [static]

Return day formatted data.

Parameters:
he tag container
Returns:
formatted string

Definition at line 192 of file hdrfmt.c.

References _, and realDateFormat().

static int dbinstanceTag ( Header  h,
HE_t  he 
) [static]

Retrieve db instance from header.

Parameters:
h header
Return values:
*he tag container
Returns:
0 on success

Definition at line 1447 of file hdrfmt.c.

References _HE_s::c, _HE_s::freeData, headerGetInstance(), _HE_s::p, RPM_UINT32_TYPE, _HE_s::t, _HE_s::tag, rpmDataType_u::ui32p, and xmalloc().

static char* decFormat ( HE_t  he  )  [static]

Return decimal formatted data.

Parameters:
he tag container
Returns:
formatted string

Definition at line 139 of file hdrfmt.c.

References intFormat().

static char* depflagsFormat ( HE_t  he  )  [static]

Format dependency flags for display.

Parameters:
he tag container
Returns:
formatted string

Definition at line 971 of file hdrfmt.c.

References _, alloca(), _HE_s::ix, _HE_s::p, RPM_UINT64_TYPE, RPMSENSE_EQUAL, RPMSENSE_GREATER, RPMSENSE_LESS, RPMSENSE_SENSEMASK, stpcpy(), _HE_s::t, rpmDataType_u::ui64p, and xstrdup().

Referenced by triggercondsTag().

static int descriptionTag ( Header  h,
HE_t  he 
) [static]

Retrieve description text.

Parameters:
h header
Return values:
*he tag container
Returns:
0 on success

Definition at line 1404 of file hdrfmt.c.

References i18nTag(), and _HE_s::tag.

static char escapedChar ( const char  ch  )  [static]

Definition at line 1884 of file hdrfmt.c.

References _hdr_debug.

Referenced by parseFormat().

static char* fflagsFormat ( HE_t  he  )  [static]

Format file flags for display.

Parameters:
he tag container
Returns:
formatted string

Definition at line 380 of file hdrfmt.c.

References _, _HE_s::ix, _HE_s::p, RPM_UINT64_TYPE, RPMFILE_CONFIG, RPMFILE_DOC, RPMFILE_GHOST, RPMFILE_LICENSE, RPMFILE_MISSINGOK, RPMFILE_NOREPLACE, RPMFILE_README, RPMFILE_SPECFILE, _HE_s::t, rpmDataType_u::ui64p, and xstrdup().

static int filepathsTag ( Header  h,
HE_t  he 
) [static]

Definition at line 1648 of file hdrfmt.c.

References _fnTag(), and _HE_s::tag.

static int findTag ( headerSprintfArgs  hsa,
sprintfToken  token,
const char *  name 
) [static]

Search extensions and tags for a name.

Parameters:
hsa headerSprintf args
token parsed fields
name name to find
Returns:
0 on success, 1 on not found

Definition at line 2132 of file hdrfmt.c.

References alloca(), sprintfToken_s::cond, sprintfTag_s::ext, sprintfTag_s::extNum, headerSprintfArgs_s::exts, sprintfTag_s::fmt, myTagValue(), stpcpy(), sprintfToken_s::tag, sprintfTag_s::tagno, headerSprintfArgs_s::tags, sprintfTag_s::type, sprintfToken_s::type, sprintfToken_s::u, and xstrcasecmp().

Referenced by parseExpression(), and parseFormat().

static char* formatValue ( headerSprintfArgs  hsa,
sprintfTag  tag,
uint32_t  element 
) [static]
static sprintfToken freeFormat ( sprintfToken  format,
size_t  num 
) [static]

Destroy headerSprintf format array.

Parameters:
format sprintf format array
num number of elements
Returns:
NULL always

Definition at line 1925 of file hdrfmt.c.

References _free(), sprintfToken_s::array, sprintfToken_s::cond, sprintfTag_s::he, rpmheClean(), sprintfToken_s::tag, and sprintfToken_s::u.

Referenced by headerSprintf(), parseExpression(), and parseFormat().

static int getExtension ( headerSprintfArgs  hsa,
headerTagTagFunction  fn,
HE_t  he,
HE_t  ec 
) [static]

Call a header extension only once, saving results.

Parameters:
hsa headerSprintf args
fn function
Return values:
he tag container
ec extension cache
Returns:
1 on success, 0 on failure

Definition at line 2606 of file hdrfmt.c.

References _HE_s::avail, _HE_s::freeData, headerSprintfArgs_s::h, and rpmheClean().

Referenced by formatValue(), and singleSprintf().

static int groupTag ( Header  h,
HE_t  he 
) [static]

Retrieve group text.

Parameters:
h header
Return values:
*he tag container
Returns:
0 on success

Definition at line 1432 of file hdrfmt.c.

References i18nTag(), and _HE_s::tag.

static char* hexFormat ( HE_t  he  )  [static]

Return hex formatted data.

Parameters:
he tag container
Returns:
formatted string

Definition at line 128 of file hdrfmt.c.

References intFormat().

static char* hGetNVRA ( Header  h  )  [static]

Return (malloc'd) header name-version-release.arch string.

Parameters:
h header
Returns:
name-version-release.arch string

Definition at line 1469 of file hdrfmt.c.

References _free(), headerNEVRA(), stpcpy(), and xmalloc().

Referenced by nvraTag().

static headerSprintfArgs hsaFini ( headerSprintfArgs  hsa  )  [static]

Finish an hsa iteration.

Parameters:
hsa headerSprintf args
Returns:
headerSprintf args

Definition at line 2029 of file hdrfmt.c.

References headerFini(), headerSprintfArgs_s::hi, and headerSprintfArgs_s::i.

Referenced by headerSprintf().

static headerSprintfArgs hsaInit ( headerSprintfArgs  hsa  )  [static]

Initialize an hsa iteration.

Parameters:
hsa headerSprintf args
Returns:
headerSprintf args

Definition at line 1966 of file hdrfmt.c.

References sprintfToken_s::array, headerSprintfArgs_s::format, headerSprintfArgs_s::h, headerInit(), headerSprintfArgs_s::hi, headerSprintfArgs_s::i, sprintfToken_s::tag, sprintfTag_s::tagno, sprintfToken_s::type, and sprintfToken_s::u.

Referenced by headerSprintf().

static sprintfToken hsaNext ( headerSprintfArgs  hsa  )  [static]

Return next hsa iteration item.

Parameters:
hsa headerSprintf args
Returns:
next sprintfToken (or NULL)

Definition at line 1992 of file hdrfmt.c.

References sprintfToken_s::array, _HE_s::avail, headerSprintfArgs_s::format, sprintfTag_s::he, headerNext(), headerSprintfArgs_s::hi, headerSprintfArgs_s::i, headerSprintfArgs_s::numTokens, rpmheClean(), _HE_s::tag, sprintfToken_s::tag, sprintfTag_s::tagno, sprintfToken_s::type, and sprintfToken_s::u.

Referenced by headerSprintf().

static char* hsaReserve ( headerSprintfArgs  hsa,
size_t  need 
) [static]

Reserve sufficient buffer space for next output value.

Parameters:
hsa headerSprintf args
need no. of bytes to reserve
Returns:
pointer to reserved space

Definition at line 2048 of file hdrfmt.c.

References headerSprintfArgs_s::alloced, headerSprintfArgs_s::val, headerSprintfArgs_s::vallen, and xrealloc().

Referenced by formatValue(), headerSprintf(), and singleSprintf().

static int i18nTag ( Header  h,
HE_t  he 
) [static]

Retrieve i18n text.

Parameters:
h header
Return values:
*he tag container
Returns:
0 on success

Definition at line 1241 of file hdrfmt.c.

References _free(), alloca(), _HE_s::c, dgettext, _HE_s::freeData, getenv(), headerGet(), HEADERGET_NOEXTENSION, _HE_s::p, rpmDataType_u::ptr, RPM_STRING_TYPE, rpmExpand(), setenv(), rpmDataType_u::str, _HE_s::t, _HE_s::tag, tagName(), unsetenv(), xstrdup(), and xstrtolocale().

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

static int instprefixTag ( Header  h,
HE_t  he 
) [static]

Retrieve install prefixes.

Parameters:
h header
Return values:
*he tag container
Returns:
0 on success

Definition at line 1021 of file hdrfmt.c.

References _free(), rpmDataType_u::argv, _HE_s::c, _HE_s::freeData, headerGet(), _HE_s::p, rpmDataType_u::ptr, RPM_STRING_TYPE, rpmDataType_u::str, _HE_s::t, _HE_s::tag, and xstrdup().

static char* intFormat ( HE_t  he,
const char *  fmt 
) [static]

Convert tag data representation.

Parameters:
he tag container
fmt output radix (NULL or "" assumes d)
Returns:
formatted string

Definition at line 42 of file hdrfmt.c.

References _, alloca(), rpmDataType_u::argv, _HE_s::c, _HE_s::ix, _HE_s::p, RPM_BIN_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, RPM_UINT16_TYPE, RPM_UINT32_TYPE, RPM_UINT64_TYPE, RPM_UINT8_TYPE, rpmDataType_u::str, _HE_s::t, rpmDataType_u::ui16p, rpmDataType_u::ui32p, rpmDataType_u::ui64p, rpmDataType_u::ui8p, and xstrdup().

Referenced by decFormat(), formatValue(), hexFormat(), and octFormat().

static int localeTag ( Header  h,
HE_t  he 
) [static]
static const char* myTagName ( headerTagTableEntry  tbl,
uint32_t  val,
uint32_t *  typep 
) [static]

Return tag name from value.

Parameters:
tbl tag table
val tag value to find
Return values:
*typep tag type (or NULL)
Returns:
tag name, NULL on not found

Definition at line 2068 of file hdrfmt.c.

References rpmTagTable, tagName(), tagType(), and xtolower().

Referenced by singleSprintf().

static uint32_t myTagValue ( headerTagTableEntry  tbl,
const char *  name 
) [static]

Return tag value from name.

Parameters:
tbl tag table
name tag name to find
Returns:
tag value, 0 on not found

Definition at line 2107 of file hdrfmt.c.

References rpmTagTable, tagValue(), and xstrcasecmp().

Referenced by findTag().

static int nvraTag ( Header  h,
HE_t  he 
) [static]

Retrieve N-V-R.A compound string from header.

Parameters:
h header
Return values:
*he tag container
Returns:
0 on success

Definition at line 1521 of file hdrfmt.c.

References _HE_s::c, _HE_s::freeData, hGetNVRA(), _HE_s::p, RPM_STRING_TYPE, rpmDataType_u::str, and _HE_s::t.

static char* octFormat ( HE_t  he  )  [static]

Return octal formatted data.

Parameters:
he tag container
Returns:
formatted string

Definition at line 117 of file hdrfmt.c.

References intFormat().

static int origpathsTag ( Header  h,
HE_t  he 
) [static]

Definition at line 1655 of file hdrfmt.c.

References _fnTag(), and _HE_s::tag.

static int parseExpression ( headerSprintfArgs  hsa,
sprintfToken  token,
char *  str,
char **  endPtr 
) [static]

Parse a headerSprintf expression.

Parameters:
hsa headerSprintf args
token 
str 
Return values:
*endPtr 
Returns:
0 on success

Definition at line 2495 of file hdrfmt.c.

References _, _hdr_debug, sprintfToken_s::cond, headerSprintfArgs_s::errmsg, findTag(), freeFormat(), parseFormat(), PARSER_IN_EXPR, sprintfToken_s::type, and sprintfToken_s::u.

Referenced by parseFormat().

static int parseFormat ( headerSprintfArgs  hsa,
char *  str,
sprintfToken formatPtr,
size_t *  numTokensPtr,
char **  endPtr,
int  state 
) [static]

Parse a headerSprintf term.

Parameters:
hsa headerSprintf args
str 
Return values:
*formatPtr 
*numTokensPtr 
*endPtr 
Parameters:
state 
Returns:
0 on success

Definition at line 2217 of file hdrfmt.c.

References _, _hdr_debug, sprintfToken_s::array, sprintfTag_s::arrayCount, headerSprintfArgs_s::errmsg, escapedChar(), findTag(), sprintfTag_s::format, freeFormat(), sprintfTag_s::justOne, next, sprintfTag_s::pad, parseExpression(), PARSER_IN_ARRAY, PARSER_IN_EXPR, sprintfToken_s::string, sprintfToken_s::tag, sprintfTag_s::type, sprintfToken_s::type, sprintfToken_s::u, xcalloc(), and xisdigit().

Referenced by headerSprintf(), and parseExpression().

static char* permsFormat ( HE_t  he  )  [static]

Format file permissions for display.

Parameters:
he tag container
Returns:
formatted string

Definition at line 359 of file hdrfmt.c.

References _, _HE_s::ix, _HE_s::p, RPM_UINT64_TYPE, rpmPermsString(), _HE_s::t, rpmDataType_u::ui64p, and xstrdup().

static char* pgpsigFormat ( HE_t  he  )  [static]

Display signature fingerprint and time.

Parameters:
he tag container
Returns:
formatted string

Definition at line 866 of file hdrfmt.c.

References _, _HE_s::ix, _HE_s::p, pgpDigFree(), pgpDigNew(), pgpGetSignature(), pgpGrab(), PGPHASHALGO_MD5, PGPHASHALGO_SHA1, pgpHexStr(), pgpLen(), pgpPrtPkts(), PGPPUBKEYALGO_DSA, PGPPUBKEYALGO_RSA, PGPTAG_SIGNATURE, RPM_BIN_TYPE, snprintf(), stpcpy(), _HE_s::t, rpmDataType_u::ui8p, xrealloc(), and xstrdup().

static char* realDateFormat ( HE_t  he,
const char *  strftimeFormat 
) [static]

Return strftime formatted data.

Parameters:
he tag container
strftimeFormat strftime(3) format
Returns:
formatted string

Definition at line 151 of file hdrfmt.c.

References _, _HE_s::p, RPM_UINT64_TYPE, _HE_s::t, rpmDataType_u::ui64p, and xstrdup().

Referenced by dateFormat(), and dayFormat().

void rpmDisplayQueryTags ( FILE *  fp,
headerTagTableEntry  _rpmTagTable,
headerSprintfExtension  _rpmHeaderFormats 
)

Display list of tags that can be used in --queryformat.

Parameters:
fp file handle to use for display (NULL uses stdout)
_rpmTagTable rpm tag table (NULL uses rpmTagTable)
_rpmHeaderFormats rpm tag extensions & formats (NULL uses headerCompoundFormats)

Definition at line 1718 of file hdrfmt.c.

References RPM_ARRAY_RETURN_TYPE, RPM_ASN1_RETURN_TYPE, RPM_MAPPING_RETURN_TYPE, RPM_MASK_TYPE, RPM_MAX_TYPE, RPM_OPAQUE_RETURN_TYPE, RPM_OPENPGP_RETURN_TYPE, RPM_PROBE_RETURN_TYPE, RPM_TREE_RETURN_TYPE, RPM_X509_RETURN_TYPE, rpmIsVerbose, rpmTagTable, tagValue(), and ttype.

Referenced by rpmcliAllArgCallback().

static HE_t rpmecFree ( const headerSprintfExtension  exts,
HE_t  ec 
) [static]

Destroy an extension cache.

Parameters:
exts headerSprintf extensions
ec extension cache
Returns:
NULL always

Definition at line 3027 of file hdrfmt.c.

References _free(), and rpmheClean().

Referenced by headerSprintf().

static HE_t rpmecNew ( const headerSprintfExtension  exts,
int *  necp 
) [static]

Create an extension cache.

Parameters:
exts headerSprintf extensions
Return values:
*necp no. of elements (or NULL)
Returns:
new extension cache

Definition at line 3001 of file hdrfmt.c.

References xcalloc().

Referenced by headerSprintf().

static void rpmfiBuildFNames ( Header  h,
rpmTag  tagN,
const char ***  fnp,
rpmTagCount fcp 
) [static]

Retrieve file names from header.

The representation of file names in package headers changed in rpm-4.0. Originally, file names were stored as an array of absolute paths. In rpm-4.0, file names are stored as separate arrays of dirname's and basename's, * with a dirname index to associate the correct dirname with each basname.

This function is used to retrieve file names independent of how the file names are represented in the package header.

Parameters:
h header
tagN RPMTAG_BASENAMES | PMTAG_ORIGBASENAMES
Return values:
*fnp array of file names
*fcp number of files

Definition at line 1552 of file hdrfmt.c.

References _free(), alloca(), rpmDataType_u::argv, _HE_s::c, headerGet(), _HE_s::p, rpmDataType_u::ptr, stpcpy(), _HE_s::tag, rpmDataType_u::ui32p, urlPath(), and xmalloc().

Referenced by _fnTag().

static HE_t rpmheClean ( HE_t  he  )  [static]

Clean a tag container, free'ing attached malloc's.

Parameters:
he tag container

Definition at line 1907 of file hdrfmt.c.

References _free(), _HE_s::freeData, _HE_s::p, and rpmDataType_u::ptr.

Referenced by formatValue(), freeFormat(), getExtension(), hsaNext(), rpmecFree(), and singleSprintf().

static char* rpmPermsString ( int  mode  )  [static]

Definition at line 277 of file hdrfmt.c.

References S_ISLNK, S_ISSOCK, and xstrdup().

static char* shescapeFormat ( HE_t  he  )  [static]

Return shell escape formatted data.

Parameters:
he tag container
Returns:
formatted string

Definition at line 203 of file hdrfmt.c.

References _, _HE_s::p, RPM_STRING_TYPE, RPM_UINT32_TYPE, RPM_UINT64_TYPE, snprintf(), rpmDataType_u::str, _HE_s::t, rpmDataType_u::ui32p, rpmDataType_u::ui64p, xmalloc(), and xstrdup().

static char* singleSprintf ( headerSprintfArgs  hsa,
sprintfToken  token,
uint32_t  element 
) [static]
static int summaryTag ( Header  h,
HE_t  he 
) [static]

Retrieve summary text.

Parameters:
h header
Return values:
*he tag container
Returns:
0 on success

Definition at line 1390 of file hdrfmt.c.

References i18nTag(), and _HE_s::tag.

static int triggercondsTag ( Header  h,
HE_t  he 
) [static]

Retrieve trigger info.

Parameters:
h header
Return values:
*he tag container
Returns:
0 on success

Definition at line 1047 of file hdrfmt.c.

References _free(), alloca(), rpmDataType_u::argv, _HE_s::c, depflagsFormat(), _HE_s::freeData, headerGet(), _HE_s::p, rpmDataType_u::ptr, RPM_STRING_ARRAY_TYPE, RPM_UINT32_TYPE, RPMSENSE_SENSEMASK, _HE_s::t, _HE_s::tag, rpmDataType_u::ui32p, xmalloc(), xrealloc(), and xstrdup().

static char* triggertypeFormat ( HE_t  he  )  [static]

Identify type of trigger.

Parameters:
he tag container
Returns:
formatted string

Definition at line 330 of file hdrfmt.c.

References _, _HE_s::ix, _HE_s::p, RPM_UINT64_TYPE, _HE_s::t, rpmDataType_u::ui64p, and xstrdup().

static int triggertypeTag ( Header  h,
HE_t  he 
) [static]

Retrieve trigger type info.

Parameters:
h header
Return values:
*he tag container
Returns:
0 on success

Definition at line 1154 of file hdrfmt.c.

References _free(), alloca(), rpmDataType_u::argv, _HE_s::c, _HE_s::freeData, headerGet(), _HE_s::p, rpmDataType_u::ptr, RPM_STRING_ARRAY_TYPE, _HE_s::t, _HE_s::tag, rpmDataType_u::ui32p, xmalloc(), and xstrdup().

static char* xmlFormat ( HE_t  he  )  [static]
static char* xmlstrcpy ( char *  t,
const char *  s 
) [static]

Copy source string to target, substituting for xml characters.

Parameters:
t target xml string
s source string
Returns:
target xml string

Definition at line 546 of file hdrfmt.c.

References stpcpy().

Referenced by xmlFormat().

static size_t xmlstrlen ( const char *  s  )  [static]

Return length of string represented with xml characters substituted.

Parameters:
s string
Returns:
length of xml string

Definition at line 522 of file hdrfmt.c.

Referenced by xmlFormat().

static char* yamlFormat ( HE_t  he  )  [static]
static char* yamlstrcpy ( char *  t,
const char *  s,
int  lvl 
) [static]

Copy source string to target, indenting for yaml.

Parameters:
t target yaml string
s source string
lvl indentation level
Returns:
target yaml string

Definition at line 697 of file hdrfmt.c.

References indent.

Referenced by yamlFormat().

static size_t yamlstrlen ( const char *  s,
int  lvl 
) [static]

Return length of string represented with yaml indentation.

Parameters:
s string
lvl indentation level
Returns:
length of yaml string

Definition at line 670 of file hdrfmt.c.

References indent.

Referenced by yamlFormat().


Variable Documentation

Definition at line 20 of file header.c.

struct headerSprintfExtension_s _headerCompoundFormats[] [static]

Definition at line 1663 of file hdrfmt.c.

struct headerSprintfExtension_s _headerDefaultFormats[] [static]
Initial value:
 {
    { HEADER_EXT_FORMAT, "octal",
        { .fmtFunction = octFormat } },
    { HEADER_EXT_FORMAT, "oct",
        { .fmtFunction = octFormat } },
    { HEADER_EXT_FORMAT, "hex",
        { .fmtFunction = hexFormat } },
    { HEADER_EXT_FORMAT, "decimal",
        { .fmtFunction = decFormat } },
    { HEADER_EXT_FORMAT, "dec",
        { .fmtFunction = decFormat } },
    { HEADER_EXT_FORMAT, "date",
        { .fmtFunction = dateFormat } },
    { HEADER_EXT_FORMAT, "day",
        { .fmtFunction = dayFormat } },
    { HEADER_EXT_FORMAT, "shescape",
        { .fmtFunction = shescapeFormat } },
    { HEADER_EXT_LAST, NULL, { NULL } }
}

Definition at line 254 of file hdrfmt.c.

const char* _macro_i18ndomains = "%{?_i18ndomains}" [static]

Definition at line 1233 of file hdrfmt.c.

const char* language = "LANGUAGE" [static]

Definition at line 1230 of file hdrfmt.c.

Generated on Tue Mar 9 11:43:30 2010 for rpm by  doxygen 1.6.3