1 /* guestfish - the filesystem interactive shell
2 * Copyright (C) 2010 Red Hat Inc.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 do_supported (const char *cmd, int argc, char *argv[])
33 /* As a side-effect this also checks that we've called 'launch'. */
34 groups = guestfs_available_all_groups (g);
38 /* Temporarily replace the error handler so that messages don't get
39 * printed to stderr while we are issuing commands.
41 guestfs_error_handler_cb old_error_cb;
42 void *old_error_cb_data;
43 old_error_cb = guestfs_get_error_handler (g, &old_error_cb_data);
44 guestfs_set_error_handler (g, NULL, NULL);
46 /* Work out the max string length of any group name. */
49 for (i = 0; groups[i] != NULL; ++i) {
50 size_t l = strlen (groups[i]);
55 for (i = 0; groups[i] != NULL; ++i) {
56 size_t l = strlen (groups[i]);
58 for (j = 0; j < len-l; ++j)
60 printf ("%s", groups[i]);
63 char *gg[] = { groups[i], NULL };
64 int r = guestfs_available (g, gg);
66 printf ("%s", _("yes"));
68 printf ("%s", _("no"));
72 /* Free groups list. */
73 for (i = 0; groups[i] != NULL; ++i)
77 /* Restore error handler. */
78 guestfs_set_error_handler (g, old_error_cb, old_error_cb_data);