From 76ae5226bee0a119ea0866e784d97ef6203c5f0c Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 10 Aug 2008 22:02:19 +0000 Subject: Misc NSH enhancements git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@813 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/examples/nsh/nsh_proccmds.c | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'nuttx/examples/nsh/nsh_proccmds.c') diff --git a/nuttx/examples/nsh/nsh_proccmds.c b/nuttx/examples/nsh/nsh_proccmds.c index 7cd14e437..4140c277d 100644 --- a/nuttx/examples/nsh/nsh_proccmds.c +++ b/nuttx/examples/nsh/nsh_proccmds.c @@ -42,6 +42,7 @@ #include #include +#include #include #include "nsh.h" @@ -162,3 +163,43 @@ void cmd_ps(FAR void *handle, int argc, char **argv) nsh_output(handle, "PID PRI SCHD TYPE NP STATE NAME\n"); sched_foreach(ps_task, handle); } + +/**************************************************************************** + * Name: cmd_sleep + ****************************************************************************/ + +#ifndef CONFIG_DISABLE_SIGNALS +void cmd_sleep(FAR void *handle, int argc, char **argv) +{ + char *endptr; + long secs; + + secs = strtol(argv[1], &endptr, 0); + if (!secs || endptr == argv[1] || *endptr != '\0') + { + nsh_output(handle, g_fmtarginvalid, argv[0]); + return; + } + sleep(secs); +} +#endif + +/**************************************************************************** + * Name: cmd_usleep + ****************************************************************************/ + +#ifndef CONFIG_DISABLE_SIGNALS +void cmd_usleep(FAR void *handle, int argc, char **argv) +{ + char *endptr; + long usecs; + + usecs = strtol(argv[1], &endptr, 0); + if (!usecs || endptr == argv[1] || *endptr != '\0') + { + nsh_output(handle, g_fmtarginvalid, argv[0]); + return; + } + usleep(usecs); +} +#endif -- cgit v1.2.3