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.
This commit is contained in:
Chris Johns
2013-12-16 11:59:51 +11:00
parent 24d09194b7
commit 259328a78d
2 changed files with 109 additions and 19 deletions

View File

@@ -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");