[Pkg-libvirt-commits] [libguestfs] 17/156: fish: simplify output of 'supported'

Hilko Bengen bengen at moszumanska.debian.org
Sat Aug 30 08:25:38 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch master
in repository libguestfs.

commit f3e079b5f597aa143a27dc8cbd40876498ba2d17
Author: Pino Toscano <ptoscano at redhat.com>
Date:   Tue May 20 13:31:07 2014 +0200

    fish: simplify output of 'supported'
    
    Print each line at once, making use of the padding features of printf
    instead of doing it manually.
    
    (cherry picked from commit 697b0d46782e1c4eb4bc927e54012e0ff8205b2d)
---
 fish/supported.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/fish/supported.c b/fish/supported.c
index 651e3aa..b49011a 100644
--- a/fish/supported.c
+++ b/fish/supported.c
@@ -49,20 +49,11 @@ run_supported (const char *cmd, size_t argc, char *argv[])
   }
 
   for (i = 0; groups[i] != NULL; ++i) {
-    size_t l = strlen (groups[i]);
-    size_t j;
-    for (j = 0; j < len-l; ++j)
-      putchar (' ');
-    printf ("%s", groups[i]);
-    putchar (' ');
-
     char *gg[] = { groups[i], NULL };
     int r = guestfs_available (g, gg);
-    if (r == 0)
-      printf ("%s", _("yes"));
-    else
-      printf ("%s", _("no"));
-    putchar ('\n');
+    const char *str = r == 0 ? _("yes") : _("no");
+
+    printf ("%*s %s\n", (int) len, groups[i], str);
   }
 
   /* Restore error handler. */

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list