remove_job(&job_list, job_list.fg);
}
}
+#else
+void free_memory(void);
#endif
#ifdef CONFIG_LASH_JOB_CONTROL
/* 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);
argv = argv+optind;
break;
case 'i':
- interactive = TRUE;
+ interactive++;
break;
default:
bb_show_usage();
* 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 */
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));
}