summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2013-12-16 11:59:51 +1100
committerChris Johns <chrisj@rtems.org>2013-12-16 11:59:51 +1100
commit259328a78d7c0bc7e0bb4c0051caba92d866bd53 (patch)
tree40df3ed164073a95a6eabed245c7f85d3bbf9b4f /cpukit
parentbsp: Move bspstart.c to sh/shared/startup/ (diff)
downloadrtems-259328a78d7c0bc7e0bb4c0051caba92d866bd53.tar.bz2
cpukit/shell: Control help break with SHELL_LINES env variable.
Control the help command break with the SHELL_LINES evironment variable where the numeric value is the number of lines to break on. If the value is 0 the output is not broken. The default is 16 lines. Add shell documentation for the help command.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/libmisc/shell/main_help.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/cpukit/libmisc/shell/main_help.c b/cpukit/libmisc/shell/main_help.c
index c63be493b5..e5ba34790d 100644
--- a/cpukit/libmisc/shell/main_help.c
+++ b/cpukit/libmisc/shell/main_help.c
@@ -12,6 +12,7 @@
#endif
#include <stdio.h>
+#include <stdlib.h>
#include <time.h>
#include <rtems.h>
@@ -79,10 +80,17 @@ static int rtems_shell_help(
char * argv[]
)
{
- int col,line,arg;
+ int col,line,lines,arg;
+ char* lines_env;
rtems_shell_topic_t *topic;
rtems_shell_cmd_t * shell_cmd = rtems_shell_first_cmd;
+ lines_env = getenv("SHELL_LINES");
+ if (lines_env)
+ lines = strtol(lines_env, 0, 0);
+ else
+ lines = 16;
+
if (argc<2) {
printf("help: ('r' repeat last cmd - 'e' edit last cmd)\n"
" TOPIC? The topics are\n");
@@ -106,7 +114,7 @@ static int rtems_shell_help(
}
line = 0;
for (arg = 1;arg<argc;arg++) {
- if (line>16) {
+ if (lines && (line > lines)) {
printf("Press any key to continue...");getchar();
printf("\n");
line = 0;
@@ -127,7 +135,7 @@ static int rtems_shell_help(
while (shell_cmd) {
if (!strcmp(topic->topic,shell_cmd->topic))
line+= rtems_shell_help_cmd(shell_cmd);
- if (line>16) {
+ if (lines && (line > lines)) {
printf("Press any key to continue...");
getchar();
printf("\n");