aboutsummaryrefslogtreecommitdiffstats
path: root/rpmeval.c
diff options
context:
space:
mode:
authorOlivier Thauvin <nanardon@mandriva.org>2007-02-22 13:01:24 +0000
committerOlivier Thauvin <nanardon@mandriva.org>2007-02-22 13:01:24 +0000
commit87f50a0d0933b3a61e5f48b7683f92cb4478dfd2 (patch)
treef0b06fdaf572f232edb7071a49f24d9abebb3a56 /rpmeval.c
parentf3234ef5dcce7d8998bbc77e3ac9f7f87ef0e952 (diff)
downloadrpm-setup-87f50a0d0933b3a61e5f48b7683f92cb4478dfd2.tar
rpm-setup-87f50a0d0933b3a61e5f48b7683f92cb4478dfd2.tar.gz
rpm-setup-87f50a0d0933b3a61e5f48b7683f92cb4478dfd2.tar.bz2
rpm-setup-87f50a0d0933b3a61e5f48b7683f92cb4478dfd2.tar.xz
rpm-setup-87f50a0d0933b3a61e5f48b7683f92cb4478dfd2.zip
- add regression tests
Diffstat (limited to 'rpmeval.c')
-rw-r--r--rpmeval.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/rpmeval.c b/rpmeval.c
new file mode 100644
index 0000000..c377dec
--- /dev/null
+++ b/rpmeval.c
@@ -0,0 +1,25 @@
+/* $Id$ */
+
+#include <rpm/rpmlib.h>
+#include <rpm/rpmmacro.h>
+
+int main(int argc, char **argv)
+{
+ int rc;
+ char *results;
+ if (argc != 3) {
+ fprintf(stdout, "Not enough argument: %d\n", argc);
+ return 1;
+ }
+ if (rc = rpmReadConfigFiles(NULL, NULL)) {
+ fprintf(stderr, "Cannot load configuration\n");
+ return rc;
+ }
+ if (rc = rpmLoadMacroFile(rpmGlobalMacroContext, argv[1])) {
+ fprintf(stderr, "Cannot read %s\n", argv[1]);
+ return rc;
+ }
+ results = rpmExpand(argv[2], NULL);
+ fprintf(stdout, "%s\n", results);
+ return 0;
+}