diff options
Diffstat (limited to 'shell/lash.c')
-rw-r--r-- | shell/lash.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/shell/lash.c b/shell/lash.c index 83baee2..c5aaf1d 100644 --- a/shell/lash.c +++ b/shell/lash.c @@ -1498,6 +1498,8 @@ static void free_memory(void) remove_job(&job_list, job_list.fg); } } +#else +void free_memory(void); #endif #ifdef CONFIG_LASH_JOB_CONTROL @@ -1528,7 +1530,7 @@ static void setup_job_control(void) /* Put ourselves in our own process group. */ setsid(); shell_pgrp = getpid (); - setpgid (shell_pgrp, shell_pgrp); + setpgid(shell_pgrp, shell_pgrp); /* Grab control of the terminal. */ tcsetpgrp(shell_terminal, shell_pgrp); @@ -1577,7 +1579,7 @@ int lash_main(int argc_l, char **argv_l) argv = argv+optind; break; case 'i': - interactive = TRUE; + interactive++; break; default: bb_show_usage(); @@ -1591,18 +1593,18 @@ int lash_main(int argc_l, char **argv_l) * standard output is a terminal * Refer to Posix.2, the description of the `sh' utility. */ if (argv[optind]==NULL && input==stdin && - isatty(STDIN_FILENO) && isatty(STDOUT_FILENO)) { - interactive=TRUE; + isatty(STDIN_FILENO) && isatty(STDOUT_FILENO)) + { + interactive++; } setup_job_control(); - if (interactive==TRUE) { - //printf( "optind=%d argv[optind]='%s'\n", optind, argv[optind]); + if (interactive) { /* Looks like they want an interactive shell */ -#ifndef CONFIG_FEATURE_SH_EXTRA_QUIET - printf( "\n\n%s Built-in shell (lash)\n", BB_BANNER); - printf( "Enter 'help' for a list of built-in commands.\n\n"); -#endif - } else if (local_pending_command==NULL) { + if (!ENABLE_FEATURE_SH_EXTRA_QUIET) { + printf( "\n\n%s Built-in shell (lash)\n", BB_BANNER); + printf( "Enter 'help' for a list of built-in commands.\n\n"); + } + } else if (!local_pending_command && argv[optind]) { //printf( "optind=%d argv[optind]='%s'\n", optind, argv[optind]); input = bb_xfopen(argv[optind], "r"); /* be lazy, never mark this closed */ @@ -1614,15 +1616,10 @@ int lash_main(int argc_l, char **argv_l) if (!cwd) cwd = bb_msg_unknown; -#ifdef CONFIG_FEATURE_CLEAN_UP - atexit(free_memory); -#endif + if (ENABLE_FEATURE_CLEAN_UP) atexit(free_memory); -#ifdef CONFIG_FEATURE_COMMAND_EDITING - cmdedit_set_initial_prompt(); -#else - PS1 = NULL; -#endif + if (ENABLE_FEATURE_COMMAND_EDITING) cmdedit_set_initial_prompt(); + else PS1 = NULL; return (busy_loop(input)); } |