X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=fish%2Ffish.c;h=fcafb5caa0f24e9a18234f3345a996f192e6622f;hp=a5fc337d2f5ef59cba5e2373c3b7386eacd6b4b1;hb=4581eb2523eeb4d094d53af0555cb7e0f760ae2d;hpb=0b2748bb2729bea0d6f6b794e7f6e0cfb8d36bcc diff --git a/fish/fish.c b/fish/fish.c index a5fc337..fcafb5c 100644 --- a/fish/fish.c +++ b/fish/fish.c @@ -354,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"); @@ -518,6 +523,8 @@ issue_command (const char *cmd, char *argv[]) else if (strcasecmp (cmd, "alloc") == 0 || strcasecmp (cmd, "allocate") == 0) return do_alloc (cmd, argc, argv); + else if (strcasecmp (cmd, "echo") == 0) + return do_echo (cmd, argc, argv); else if (strcasecmp (cmd, "edit") == 0 || strcasecmp (cmd, "vi") == 0 || strcasecmp (cmd, "emacs") == 0) @@ -538,6 +545,8 @@ list_builtin_commands (void) printf ("%-20s %s\n", "alloc", "allocate an image"); printf ("%-20s %s\n", + "echo", "display a line of text"); + printf ("%-20s %s\n", "edit", "edit a file in the image"); /* actions are printed after this (see list_commands) */ @@ -565,6 +574,11 @@ display_builtin_command (const char *cmd) " M or MB number of megabytes\n" " G or GB number of gigabytes\n" " sects number of 512 byte sectors\n"); + else if (strcasecmp (cmd, "echo") == 0) + printf ("echo - display a line of text\n" + " echo [ ...]\n" + "\n" + " This echos the parameters to the terminal.\n"); else if (strcasecmp (cmd, "edit") == 0 || strcasecmp (cmd, "vi") == 0 || strcasecmp (cmd, "emacs") == 0)