X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=fish%2Fcmds.c;h=8e8e08accc5f55e1fead4712a3ec67afe437ec14;hb=dcd8742578a57e0871d6db4797014bbfd854a57b;hp=bb982d4621e8efe6753e98ba0567d388e1332725;hpb=d1a1ab972bb22f4c38a21fcc73f81650aaa03b4e;p=libguestfs.git diff --git a/fish/cmds.c b/fish/cmds.c index bb982d4..8e8e08a 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 \n\nThis runs C, ie. runs the ext2/ext3\nfilesystem checker on C, noninteractively (C<-p>),\neven if the filesystem appears to be clean (C<-f>).\n\nThis command is only needed because of C\n(q.v.). Normally you should use C."); else + if (strcasecmp (cmd, "sleep") == 0) + pod2text ("sleep - sleep for some seconds", " sleep \n\nSleep for C 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;