diff options
author | Richard Jones <rjones@trick.home.annexia.org> | 2009-06-04 14:59:16 +0100 |
---|---|---|
committer | Richard Jones <rjones@trick.home.annexia.org> | 2009-06-04 15:06:27 +0100 |
commit | b6adf09c4d2cc3f1d0285950c151b1fd7688ec67 (patch) | |
tree | 7ff59df24162a39824e65bf5e4fd0b4dafcad13a /fish | |
parent | 2ef06eacc2be08b0268c98a4d157176aff9356e0 (diff) | |
download | libguestfs-b6adf09c4d2cc3f1d0285950c151b1fd7688ec67.tar.gz libguestfs-b6adf09c4d2cc3f1d0285950c151b1fd7688ec67.tar.xz libguestfs-b6adf09c4d2cc3f1d0285950c151b1fd7688ec67.zip |
Generated code for the 'sleep' command.
Diffstat (limited to 'fish')
-rw-r--r-- | fish/cmds.c | 21 | ||||
-rw-r--r-- | fish/completion.c | 1 |
2 files changed, 22 insertions, 0 deletions
diff --git a/fish/cmds.c b/fish/cmds.c index bb982d46..8e8e08ac 100644 --- a/fish/cmds.c +++ b/fish/cmds.c @@ -137,6 +137,7 @@ void list_commands (void) printf ("%-20s %s\n", "sfdisk-disk-geometry", "display the disk geometry from the partition table"); printf ("%-20s %s\n", "sfdisk-kernel-geometry", "display the kernel geometry"); printf ("%-20s %s\n", "sfdisk-l", "display the partition table"); + printf ("%-20s %s\n", "sleep", "sleep for some seconds"); printf ("%-20s %s\n", "stat", "get file information"); printf ("%-20s %s\n", "statvfs", "get file system statistics"); printf ("%-20s %s\n", "strings", "print the printable strings in a file"); @@ -552,6 +553,9 @@ void display_command (const char *cmd) if (strcasecmp (cmd, "e2fsck_f") == 0 || strcasecmp (cmd, "e2fsck-f") == 0) pod2text ("e2fsck-f - check an ext2/ext3 filesystem", " e2fsck-f <device>\n\nThis runs C<e2fsck -p -f device>, ie. runs the ext2/ext3\nfilesystem checker on C<device>, noninteractively (C<-p>),\neven if the filesystem appears to be clean (C<-f>).\n\nThis command is only needed because of C<resize2fs>\n(q.v.). Normally you should use C<fsck>."); else + if (strcasecmp (cmd, "sleep") == 0) + pod2text ("sleep - sleep for some seconds", " sleep <secs>\n\nSleep for C<secs> seconds."); + else display_builtin_command (cmd); } @@ -2698,6 +2702,20 @@ static int run_e2fsck_f (const char *cmd, int argc, char *argv[]) return r; } +static int run_sleep (const char *cmd, int argc, char *argv[]) +{ + int r; + int secs; + if (argc != 1) { + fprintf (stderr, "%s should have 1 parameter(s)\n", cmd); + fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd); + return -1; + } + secs = atoi (argv[0]); + r = guestfs_sleep (g, secs); + return r; +} + int run_action (const char *cmd, int argc, char *argv[]) { if (strcasecmp (cmd, "launch") == 0 || strcasecmp (cmd, "run") == 0) @@ -3087,6 +3105,9 @@ int run_action (const char *cmd, int argc, char *argv[]) if (strcasecmp (cmd, "e2fsck_f") == 0 || strcasecmp (cmd, "e2fsck-f") == 0) return run_e2fsck_f (cmd, argc, argv); else + if (strcasecmp (cmd, "sleep") == 0) + return run_sleep (cmd, argc, argv); + else { fprintf (stderr, "%s: unknown command\n", cmd); return -1; diff --git a/fish/completion.c b/fish/completion.c index 287c5aad..95c3e5d5 100644 --- a/fish/completion.c +++ b/fish/completion.c @@ -175,6 +175,7 @@ static const char *const commands[] = { "resize2fs", "find", "e2fsck-f", + "sleep", NULL }; |