X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=fish%2Ffish.c;h=353c8b2b9f8821feb6a38011c52d8c7b46732b89;hp=59348c3be7fecf2c810c9bffb1d58af0cd30f4fd;hb=625d0bd56189450f48b6308371bf08ee6312d59f;hpb=8863ecde5dba262c0736da7505a9fa3655ed42f6 diff --git a/fish/fish.c b/fish/fish.c index 59348c3..353c8b2 100644 --- a/fish/fish.c +++ b/fish/fish.c @@ -1,5 +1,5 @@ /* guestfish - the filesystem interactive shell - * Copyright (C) 2009 Red Hat Inc. + * Copyright (C) 2009 Red Hat Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -727,13 +727,19 @@ issue_command (const char *cmd, char *argv[], const char *pipecmd) else if (strcasecmp (cmd, "more") == 0 || strcasecmp (cmd, "less") == 0) r = do_more (cmd, argc, argv); + else if (strcasecmp (cmd, "reopen") == 0) + r = do_reopen (cmd, argc, argv); else if (strcasecmp (cmd, "time") == 0) r = do_time (cmd, argc, argv); else r = run_action (cmd, argc, argv); + /* Always flush stdout after every command, so that messages, results + * etc appear immediately. + */ + fflush (stdout); + if (pipecmd) { - fflush (stdout); close (1); dup2 (stdout_saved_fd, 1); close (stdout_saved_fd); @@ -763,6 +769,10 @@ list_builtin_commands (void) printf ("%-20s %s\n", "glob", _("expand wildcards in command")); printf ("%-20s %s\n", + "more", _("view a file in the pager")); + printf ("%-20s %s\n", + "reopen", _("close and reopen libguestfs handle")); + printf ("%-20s %s\n", "time", _("measure time taken to run command")); /* actions are printed after this (see list_commands) */ @@ -825,6 +835,10 @@ display_builtin_command (const char *cmd) " Glob runs with wildcards expanded in any\n" " command args. Note that the command is run repeatedly\n" " once for each expanded argument.\n")); + else if (strcasecmp (cmd, "help") == 0) + printf (_("help - display a list of commands or help on a command\n" + " help cmd\n" + " help\n")); else if (strcasecmp (cmd, "more") == 0 || strcasecmp (cmd, "less") == 0) printf (_("more - view a file in the pager\n" @@ -840,15 +854,18 @@ display_builtin_command (const char *cmd) "\n" " NOTE: This will not work reliably for large files\n" " (> 2 MB) or binary files containing \\0 bytes.\n")); - else if (strcasecmp (cmd, "help") == 0) - printf (_("help - display a list of commands or help on a command\n" - " help cmd\n" - " help\n")); else if (strcasecmp (cmd, "quit") == 0 || strcasecmp (cmd, "exit") == 0 || strcasecmp (cmd, "q") == 0) printf (_("quit - quit guestfish\n" " quit\n")); + else if (strcasecmp (cmd, "reopen") == 0) + printf (_("reopen - close and reopen the libguestfs handle\n" + " reopen\n" + "\n" + "Close and reopen the libguestfs handle. It is not necessary to use\n" + "this normally, because the handle is closed properly when guestfish\n" + "exits. However this is occasionally useful for testing.\n")); else if (strcasecmp (cmd, "time") == 0) printf (_("time - measure time taken to run command\n" " time [ ...]\n"