]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Improve alternatives listing in example solver
authorMichael Schroeder <mls@suse.de>
Fri, 20 May 2016 13:00:19 +0000 (15:00 +0200)
committerMichael Schroeder <mls@suse.de>
Fri, 20 May 2016 13:00:19 +0000 (15:00 +0200)
examples/solv/solv.c

index e12a6869ef882f7d3e6e9c4866f79d123bf9a55b..814f7e17c46580df4a8ce2bb4771732cd1027c14 100644 (file)
@@ -767,7 +767,17 @@ rerunsolver:
   acnt = solver_alternatives_count(solv);
   if (acnt)
     {
-      printf("Have %d alternatives\n\n", acnt);
+      if (acnt == 1)
+        printf("Have one alternative:\n");
+      else
+        printf("Have %d alternatives:\n", acnt);
+      for (i = 1; i <= acnt; i++)
+       {
+         Id id, from;
+         int atype = solver_get_alternative(solv, i, &id, &from, 0, 0, 0);
+         printf("  - %s\n", solver_alternative2str(solv, atype, id, from));
+       }
+      printf("\n");
       answer = yesno("OK to continue (y/n/a)? ", 'a');
     }
   else