diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2009-10-30 09:33:26 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2009-10-30 09:33:26 +0200 |
commit | 0dcf65119a0f7f96e460eaf7ef6aa970e9ee2f14 (patch) | |
tree | f5cae7335123fa282b1727756591541994d4b19d /lib/formats.c | |
parent | 491cf5e3442af05b79b33e346f60e565f343513f (diff) | |
download | rpm-0dcf65119a0f7f96e460eaf7ef6aa970e9ee2f14.tar.gz rpm-0dcf65119a0f7f96e460eaf7ef6aa970e9ee2f14.tar.bz2 rpm-0dcf65119a0f7f96e460eaf7ef6aa970e9ee2f14.zip |
Add file verifyflags format extension
Diffstat (limited to 'lib/formats.c')
-rw-r--r-- | lib/formats.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/formats.c b/lib/formats.c index e984a007c..8e7cb4c30 100644 --- a/lib/formats.c +++ b/lib/formats.c @@ -655,6 +655,41 @@ static char * fstateFormat(rpmtd td, char * formatPrefix) return val; } +static char * vflagsFormat(rpmtd td, char * formatPrefix) +{ + char * val = NULL; + char buf[15]; + + if (rpmtdClass(td) != RPM_NUMERIC_CLASS) { + val = xstrdup(_("(not a number)")); + } else { + uint64_t vflags = rpmtdGetNumber(td); + buf[0] = '\0'; + if (vflags & RPMVERIFY_FILEDIGEST) + strcat(buf, "5"); + if (vflags & RPMVERIFY_FILESIZE) + strcat(buf, "S"); + if (vflags & RPMVERIFY_LINKTO) + strcat(buf, "L"); + if (vflags & RPMVERIFY_MTIME) + strcat(buf, "T"); + if (vflags & RPMVERIFY_RDEV) + strcat(buf, "D"); + if (vflags & RPMVERIFY_USER) + strcat(buf, "U"); + if (vflags & RPMVERIFY_GROUP) + strcat(buf, "G"); + if (vflags & RPMVERIFY_MODE) + strcat(buf, "M"); + if (vflags & RPMVERIFY_CAPS) + strcat(buf, "P"); + + strcat(formatPrefix, "s"); + rasprintf(&val, formatPrefix, buf); + } + + return val; +} void *rpmHeaderFormatFuncByName(const char *fmt) { const struct headerFormatFunc_s * ext; @@ -702,5 +737,6 @@ static const struct headerFormatFunc_s rpmHeaderFormats[] = { { RPMTD_FORMAT_SHESCAPE, "shescape", shescapeFormat }, { RPMTD_FORMAT_ARRAYSIZE, "arraysize", arraysizeFormat }, { RPMTD_FORMAT_FSTATE, "fstate", fstateFormat }, + { RPMTD_FORMAT_VFLAGS, "vflags", vflagsFormat }, { -1, NULL, NULL } }; |