summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/shell/shell.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-01-11 21:42:48 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-01-11 21:42:48 +0000
commitbe8ab6a72db260fc025f6084e419e0ada46159f4 (patch)
tree68b898de5eefd6728f0efe13ccf9efd7c092130f /cpukit/libmisc/shell/shell.c
parent2008-01-11 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-be8ab6a72db260fc025f6084e419e0ada46159f4.tar.bz2
2008-01-11 Joel Sherrill <joel.sherrill@oarcorp.com>
* libmisc/shell/shell.c: When stdin or stdout is NULL, just use existing one.
Diffstat (limited to 'cpukit/libmisc/shell/shell.c')
-rw-r--r--cpukit/libmisc/shell/shell.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/cpukit/libmisc/shell/shell.c b/cpukit/libmisc/shell/shell.c
index 78c916ecbe..2cbbff924c 100644
--- a/cpukit/libmisc/shell/shell.c
+++ b/cpukit/libmisc/shell/shell.c
@@ -68,7 +68,7 @@ rtems_shell_env_t *rtems_shell_init_env(
if ( !shell_env ) {
shell_env = malloc(sizeof(rtems_shell_env_t));
if ( !shell_env )
- return NULL;
+ return NULL;
*shell_env = rtems_global_shell_env;
shell_env->taskname = NULL;
}
@@ -397,7 +397,10 @@ rtems_boolean rtems_shell_main_loop(
fileno(stdout);
- if (strcmp(shell_env->output, "stdout") != 0) {
+fprintf( stderr,
+ "-%s-%s-\n", shell_env->input, shell_env->output );
+
+ if (shell_env->output && strcmp(shell_env->output, "stdout") != 0) {
if (strcmp(shell_env->output, "stderr") == 0) {
stdout = stderr;
} else if (strcmp(shell_env->output, "/dev/null") == 0) {
@@ -414,7 +417,7 @@ rtems_boolean rtems_shell_main_loop(
}
}
- if (strcmp(shell_env_arg->input, "stdin") != 0) {
+ if (shell_env->input && strcmp(shell_env_arg->input, "stdin") != 0) {
FILE *input = fopen(shell_env_arg->input, "r");
if (!input) {
fprintf(stderr, "shell: open input %s failed: %s\n",