X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=fish%2Ffish.c;h=894e351da30d103d48da5586e5f76dd68afd9cc0;hp=c8e9506599ccf1c6b7bbb094009e91ab8092b683;hb=df189925e4a0e6f80b0aebbd78201db09a63daf3;hpb=edd99a3f7903f6f80d3f73643cd6ee114dbdd553 diff --git a/fish/fish.c b/fish/fish.c index c8e9506..894e351 100644 --- a/fish/fish.c +++ b/fish/fish.c @@ -100,13 +100,14 @@ usage (void) " -n|--no-sync Don't autosync\n" " -r|--ro Mount read-only\n" " -v|--verbose Verbose messages\n" + " -V|--version Display version and exit\n" "For more information, see the manpage guestfish(1).\n"); } int main (int argc, char *argv[]) { - static const char *options = "a:h::m:nrv?"; + static const char *options = "a:h::m:nrv?V"; static struct option long_options[] = { { "add", 1, 0, 'a' }, { "cmd-help", 2, 0, 'h' }, @@ -115,6 +116,7 @@ main (int argc, char *argv[]) { "no-sync", 0, 0, 'n' }, { "ro", 0, 0, 'r' }, { "verbose", 0, 0, 'v' }, + { "version", 0, 0, 'V' }, { 0, 0, 0, 0 } }; struct mp *mps = NULL; @@ -200,6 +202,10 @@ main (int argc, char *argv[]) guestfs_set_verbose (g, verbose); break; + case 'V': + printf ("guestfish %s\n", PACKAGE_VERSION); + exit (0); + case '?': usage (); exit (0); @@ -348,6 +354,11 @@ script (int prompt) while (*buf && isspace (*buf)) buf++; + if (!*buf) continue; + + /* If the next character is '#' then this is a comment. */ + if (*buf == '#') continue; + /* Get the command (cannot be quoted). */ len = strcspn (buf, " \t");