From be8ab6a72db260fc025f6084e419e0ada46159f4 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 11 Jan 2008 21:42:48 +0000 Subject: 2008-01-11 Joel Sherrill * libmisc/shell/shell.c: When stdin or stdout is NULL, just use existing one. --- cpukit/libmisc/shell/shell.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'cpukit/libmisc/shell/shell.c') 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", -- cgit v1.2.3