summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2012-12-04 15:15:14 +0100
committerMichael Schroeder <mls@suse.de>2012-12-04 15:15:14 +0100
commitf5c558ad8def6d239bd42a4e18e3c771980159d0 (patch)
tree81915143b1b64bfbadfeb14597a547dd6ca2f86f
parent3e809fce1e8850d640d4a486f8fb160071bfe89a (diff)
downloadlibsolv-f5c558ad8def6d239bd42a4e18e3c771980159d0.tar.gz
libsolv-f5c558ad8def6d239bd42a4e18e3c771980159d0.tar.bz2
libsolv-f5c558ad8def6d239bd42a4e18e3c771980159d0.zip
write trailing "result" line in -r -r mode
-rw-r--r--tools/testsolv.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/tools/testsolv.c b/tools/testsolv.c
index 47fe785..981fc1f 100644
--- a/tools/testsolv.c
+++ b/tools/testsolv.c
@@ -8,6 +8,18 @@
#include "solverdebug.h"
#include "testcase.h"
+static struct resultflags2str {
+ Id flag;
+ const char *str;
+} resultflags2str[] = {
+ { TESTCASE_RESULT_TRANSACTION, "transaction" },
+ { TESTCASE_RESULT_PROBLEMS, "problems" },
+ { TESTCASE_RESULT_ORPHANED, "orphaned" },
+ { TESTCASE_RESULT_RECOMMENDED, "recommended" },
+ { TESTCASE_RESULT_UNNEEDED, "unneeded" },
+ { 0, 0 }
+};
+
static void
usage(ex)
{
@@ -91,10 +103,22 @@ main(int argc, char **argv)
{
if (writeresult > 1)
{
- char *p = myresult;
+ const char *p;
+ int i;
+
+ printf("result ");
+ p = "%s";
+ for (i = 0; resultflags2str[i].str; i++)
+ if ((resultflags & resultflags2str[i].flag) != 0)
+ {
+ printf(p, resultflags2str[i].str);
+ p = ",%s";
+ }
+ printf(" <inline>\n");
+ p = myresult;
while (*p)
{
- char *p2 = strchr(p, '\n');
+ const char *p2 = strchr(p, '\n');
p2 = p2 ? p2 + 1 : p + strlen(p);
printf("#>%.*s", (int)(p2 - p), p);
p = p2;