hush: more style fixes.

This commit is contained in:
Denis Vlasenko 2007-04-13 19:56:56 +00:00
parent f03dbeda90
commit fbf6dea5a2

View File

@ -104,7 +104,11 @@ typedef enum {
/* The descrip member of this structure is only used to make debugging
* output pretty */
static const struct {int mode; int default_fd; const char *descrip;} redir_table[] = {
static const struct {
int mode;
int default_fd;
const char *descrip;
} redir_table[] = {
{ 0, 0, "()" },
{ O_RDONLY, 0, "<" },
{ O_CREAT|O_TRUNC|O_WRONLY, 1, ">" },
@ -2661,7 +2665,8 @@ static int parse_file_outer(FILE *f)
* we don't fight over who gets the foreground */
static void setup_job_control(void)
{
static pid_t shell_pgrp;
/*static --why?? */ pid_t shell_pgrp;
/* Loop until we are in the foreground. */
while (tcgetpgrp(shell_terminal) != (shell_pgrp = getpgrp()))
kill(- shell_pgrp, SIGTTIN);
@ -2689,7 +2694,7 @@ int hush_main(int argc, char **argv)
{
int opt;
FILE *input;
char **e = environ;
char **e;
#if ENABLE_FEATURE_EDITING
line_input_state = new_line_input_t(FOR_SHELL);
@ -2720,10 +2725,10 @@ int hush_main(int argc, char **argv)
/* initialize our shell local variables with the values
* currently living in the environment */
if (e) {
for (; *e; e++)
set_local_var(*e, 2); /* without call putenv() */
}
e = environ;
if (e)
while (*e)
set_local_var(*e++, 2); /* without call putenv() */
last_return_code = EXIT_SUCCESS;
@ -2742,13 +2747,10 @@ int hush_main(int argc, char **argv)
while ((opt = getopt(argc, argv, "c:xif")) > 0) {
switch (opt) {
case 'c':
{
global_argv = argv+optind;
global_argc = argc-optind;
opt = parse_string_outer(optarg, FLAG_PARSE_SEMICOLON);
goto final_return;
}
break;
case 'i':
interactive++;
break;
@ -2765,13 +2767,13 @@ int hush_main(int argc, char **argv)
#endif
}
}
/* A shell is interactive if the `-i' flag was given, or if all of
/* A shell is interactive if the '-i' flag was given, or if all of
* the following conditions are met:
* no -c command
* no arguments remaining or the -s flag given
* standard input is a terminal
* standard output is a terminal
* Refer to Posix.2, the description of the `sh' utility. */
* Refer to Posix.2, the description of the 'sh' utility. */
if (argv[optind] == NULL && input == stdin
&& isatty(STDIN_FILENO) && isatty(STDOUT_FILENO)
) {
@ -2802,7 +2804,7 @@ int hush_main(int argc, char **argv)
#if ENABLE_FEATURE_CLEAN_UP
fclose(input);
if (cwd && cwd != bb_msg_unknown)
if (cwd != bb_msg_unknown)
free((char*)cwd);
{
struct variables *cur, *tmp;