git.annexia.org
/
libguestfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Introduce regression tests for various qemu failures.
[libguestfs.git]
/
fish
/
fish.c
diff --git
a/fish/fish.c
b/fish/fish.c
index
90740d5
..
25483a1
100644
(file)
--- a/
fish/fish.c
+++ b/
fish/fish.c
@@
-1,5
+1,5
@@
/* guestfish - the filesystem interactive shell
/* 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
*
* 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,11
+727,17
@@
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, "more") == 0 ||
strcasecmp (cmd, "less") == 0)
r = do_more (cmd, argc, argv);
+ else if (strcasecmp (cmd, "time") == 0)
+ r = do_time (cmd, argc, argv);
else
r = run_action (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) {
if (pipecmd) {
- fflush (stdout);
close (1);
dup2 (stdout_saved_fd, 1);
close (stdout_saved_fd);
close (1);
dup2 (stdout_saved_fd, 1);
close (stdout_saved_fd);
@@
-760,6
+766,8
@@
list_builtin_commands (void)
"lcd", _("local change directory"));
printf ("%-20s %s\n",
"glob", _("expand wildcards in command"));
"lcd", _("local change directory"));
printf ("%-20s %s\n",
"glob", _("expand wildcards in command"));
+ printf ("%-20s %s\n",
+ "time", _("measure time taken to run command"));
/* actions are printed after this (see list_commands) */
}
/* actions are printed after this (see list_commands) */
}
@@
-845,6
+853,12
@@
display_builtin_command (const char *cmd)
strcasecmp (cmd, "q") == 0)
printf (_("quit - quit guestfish\n"
" quit\n"));
strcasecmp (cmd, "q") == 0)
printf (_("quit - quit guestfish\n"
" quit\n"));
+ else if (strcasecmp (cmd, "time") == 0)
+ printf (_("time - measure time taken to run command\n"
+ " time <command> [<args> ...]\n"
+ "\n"
+ " This runs <command> as usual, and prints the elapsed\n"
+ " time afterwards.\n"));
else
fprintf (stderr, _("%s: command not known, use -h to list all commands\n"),
cmd);
else
fprintf (stderr, _("%s: command not known, use -h to list all commands\n"),
cmd);