Add macro expansion queryformat extension
- unused at the moment but doesn't hurt anything either...
This commit is contained in:
parent
a5dbbd4065
commit
121f73bb49
|
@ -469,6 +469,9 @@ Format dependency comparison operator.
|
|||
\fB:deptype\fR
|
||||
Format dependency type.
|
||||
.TP
|
||||
\fB:expand\fR
|
||||
Perform macro expansion.
|
||||
.TP
|
||||
\fB:fflags\fR
|
||||
Format file flags.
|
||||
.TP
|
||||
|
|
|
@ -690,6 +690,19 @@ static char * vflagsFormat(rpmtd td, char * formatPrefix)
|
|||
|
||||
return val;
|
||||
}
|
||||
|
||||
static char * expandFormat(rpmtd td, char * formatPrefix)
|
||||
{
|
||||
char *val = NULL;
|
||||
if (rpmtdClass(td) != RPM_STRING_CLASS) {
|
||||
val = xstrdup(_("(not a string)"));
|
||||
} else {
|
||||
val = rpmExpand(td->data, NULL);
|
||||
}
|
||||
strcat(formatPrefix, "s");
|
||||
return val;
|
||||
}
|
||||
|
||||
void *rpmHeaderFormatFuncByName(const char *fmt)
|
||||
{
|
||||
const struct headerFormatFunc_s * ext;
|
||||
|
@ -738,5 +751,6 @@ static const struct headerFormatFunc_s rpmHeaderFormats[] = {
|
|||
{ RPMTD_FORMAT_ARRAYSIZE, "arraysize", arraysizeFormat },
|
||||
{ RPMTD_FORMAT_FSTATE, "fstate", fstateFormat },
|
||||
{ RPMTD_FORMAT_VFLAGS, "vflags", vflagsFormat },
|
||||
{ RPMTD_FORMAT_EXPAND, "expand", expandFormat },
|
||||
{ -1, NULL, NULL }
|
||||
};
|
||||
|
|
|
@ -216,6 +216,7 @@ typedef enum rpmtdFormats_e {
|
|||
RPMTD_FORMAT_DEPTYPE = 15, /* dependency types (int types) */
|
||||
RPMTD_FORMAT_FSTATE = 16, /* file states (int types) */
|
||||
RPMTD_FORMAT_VFLAGS = 17, /* file verify flags (int types) */
|
||||
RPMTD_FORMAT_EXPAND = 18, /* macro expansion (string types) */
|
||||
} rpmtdFormats;
|
||||
|
||||
/** \ingroup rpmtd
|
||||
|
|
Loading…
Reference in New Issue