From: Michael Schroeder Date: Tue, 4 Dec 2012 14:15:14 +0000 (+0100) Subject: write trailing "result" line in -r -r mode X-Git-Tag: BASE-SuSE-Code-12_3-Branch~129 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f5c558ad8def6d239bd42a4e18e3c771980159d0;p=thirdparty%2Flibsolv.git write trailing "result" line in -r -r mode --- diff --git a/tools/testsolv.c b/tools/testsolv.c index 47fe7852..981fc1fd 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(" \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;