blob: c6b14695c362bbd9cd16f2fb50c06b5d899c1585 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
/* $Id: rpmeval.c 271130 2010-10-16 11:12:45Z peroyvind $ */
#include <stdint.h>
#ifdef HAVE_RPM_RPMLIB_H
#include <rpm/rpmlib.h>
#else
#include <rpm/rpmio.h>
#include <rpm/rpmtag.h>
#endif
#include <rpm/rpmmacro.h>
int main(int argc, char **argv)
{
rpmRC rc;
char *results;
if (argc != 3) {
fprintf(stdout, "Not enough arguments: %d\n", argc);
return 1;
}
if (rc = rpmReadConfigFiles(NULL, NULL)) {
fprintf(stderr, "Cannot load configuration\n");
return rc;
}
if (rc = rpmLoadMacroFile(rpmGlobalMacroContext, argv[1]
#ifndef RPMDBI_LABEL
,2
#endif
)) {
fprintf(stderr, "Cannot read %s\n", argv[1]);
return rc;
}
results = rpmExpand(argv[2], NULL);
fprintf(stdout, "%s\n", results);
return 0;
}
|