fish: simplify output of 'supported'

Print each line at once, making use of the padding features of printf
instead of doing it manually.
This commit is contained in:
Pino Toscano
2014-05-20 13:31:07 +02:00
committed by Richard W.M. Jones
parent a21dfc483c
commit 697b0d4678

View File

@@ -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. */