1 /* guestfish - the filesystem shell
2 * Copyright (C) 2009 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.
35 "guestfish: guest filesystem shell\n"
36 "guestfish lets you edit virtual machine filesystems\n"
37 "Copyright (C) 2009 Red Hat Inc.\n"
39 " guestfish [--options] [cmd]\n"
40 "or for interactive use:\n"
42 "or from a shell script:\n"
48 " -h|--cmd-help List available commands\n"
49 " -h|--cmd-help cmd Display detailed help on 'cmd'\n"
50 "For more information, see the manual page guestfish(1).\n");
54 main (int argc, char *argv[])
56 static const char *options = "h::?";
57 static struct option long_options[] = {
58 { "cmd-help", 2, 0, 'h' },
59 { "help", 0, 0, '?' },
65 c = getopt_long (argc, argv, options, long_options, NULL);
71 display_command (optarg);
72 else if (argv[optind] && argv[optind][0] != '-')
73 display_command (argv[optind++]);
83 fprintf (stderr, "guestfish: unexpected command line option 0x%x\n", c);
108 pod2text (const char *heading, const char *str)
112 fp = popen ("pod2text", "w");
114 /* pod2text failed, maybe not found, so let's just print the
115 * source instead, since that's better than doing nothing.
117 printf ("%s\n\n%s\n", heading, str);
120 fputs ("=head1 ", fp);