Update of /cvsroot/winbash/winbash
In directory usw-pr-cvs1:/tmp/cvs-serv3155
Modified Files:
bashhist.c bashhist.h error.c execute_cmd.c input.c jobs.c
nojobs.c nt_execute_cmd.c nt_io.c nt_types.h parse.y
print_cmd.c shell.c shell.h subst.c test.c trap.c variables.c
Log Message:
renamed (almost) all members of the thread_env struct and added
some #define's for accessing these member from thr_me. the goal
is to reduce the number of places thr_me is referenced and hence
the number of diffs with the bash mainline. the hope it that this
will make patching to 1.14.7 easier.
Index: bashhist.c
===================================================================
RCS file: /cvsroot/winbash/winbash/bashhist.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- bashhist.c 9 Mar 2002 03:39:12 -0000 1.1.1.1
+++ bashhist.c 10 Mar 2002 21:45:13 -0000 1.2
@@ -150,7 +150,7 @@
{
int result = 0;
- if (thr_me->interactive && history_lines_this_session)
+ if (interactive && history_lines_this_session)
{
char *hf = get_string_value ("HISTFILE");
@@ -220,7 +220,7 @@
# if defined (BANG_HISTORY)
/* History expand the line. If this results in no errors, then
add that line to the history if ADDIT is non-zero. */
- if (!thr_me->history_expansion_inhibited && history_expansion)
+ if (!history_expansion_inhibited && history_expansion)
{
expanded = history_expand (line, &history_value);
@@ -261,7 +261,7 @@
}
# endif /* BANG_HISTORY */
- if (addit && thr_me->remember_on_history && *return_value)
+ if (addit && remember_on_history && *return_value)
maybe_add_history (return_value);
if (!expanded)
Index: bashhist.h
===================================================================
RCS file: /cvsroot/winbash/winbash/bashhist.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- bashhist.h 9 Mar 2002 03:39:12 -0000 1.1.1.1
+++ bashhist.h 10 Mar 2002 21:45:13 -0000 1.2
@@ -21,7 +21,7 @@
#if !defined (__BASHHIST_H__)
#define __BASHHIST_H__
-extern int remember_on_history;
+/* extern int remember_on_history; */
extern int history_lines_this_session;
extern int history_lines_in_file;
extern int history_expansion;
@@ -29,7 +29,7 @@
extern int command_oriented_history;
# if defined (BANG_HISTORY)
-extern int history_expansion_inhibited;
+/* extern int history_expansion_inhibited; */
# endif /* BANG_HISTORY */
extern void load_history ();
Index: error.c
===================================================================
RCS file: /cvsroot/winbash/winbash/error.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- error.c 9 Mar 2002 16:05:41 -0000 1.2
+++ error.c 10 Mar 2002 21:45:13 -0000 1.3
@@ -50,7 +50,7 @@
{
char *name = (char *) NULL;
- if (!thr_me->interactive_shell)
+ if (!interactive_shell)
name = dollar_vars[0];
if (!name && shell_name && *shell_name)
name = base_pathname (shell_name);
Index: execute_cmd.c
===================================================================
RCS file: /cvsroot/winbash/winbash/execute_cmd.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- execute_cmd.c 9 Mar 2002 16:05:41 -0000 1.2
+++ execute_cmd.c 10 Mar 2002 21:45:13 -0000 1.3
@@ -330,7 +330,7 @@
}
#endif /* !__NT_VC__ */
-#define DESCRIBE_PID(pid) if (thr_me->interactive) describe_pid (pid)
+#define DESCRIBE_PID(pid) if (interactive) describe_pid (pid)
/* Execute the command passed in COMMAND, perhaps doing it asynchrounously.
COMMAND is exactly what read_command () places into GLOBAL_COMMAND.
@@ -435,7 +435,7 @@
if (!asynchronous)
#endif /* !_MT */
{
- thr_me->last_command_exit_value = wait_for (paren_pid);
+ last_command_exit_value = wait_for (paren_pid);
#if defined (_MT)
/* Check if the subshell changed our current working directory. If so,
@@ -451,13 +451,13 @@
/* If we have to, invert the return value. */
if (invert)
{
- if (thr_me->last_command_exit_value == EXECUTION_SUCCESS)
+ if (last_command_exit_value == EXECUTION_SUCCESS)
return (EXECUTION_FAILURE);
else
return (EXECUTION_SUCCESS);
}
else
- return (thr_me->last_command_exit_value);
+ return (last_command_exit_value);
}
else
{
@@ -604,9 +604,9 @@
/* NT allows thread handles (bash pids) to be recycled too quickly,
so the last_made_pid may be the same as it was before. Just
set it to -1 and hope no one else needs to use it... */
- pid_t last_pid = thr_me->last_made_pid = -1;
+ pid_t last_pid = last_made_pid = -1;
#else
- pid_t last_pid = thr_me->last_made_pid;
+ pid_t last_pid = last_made_pid;
#endif
if (ignore_return && command->value.Simple)
@@ -630,29 +630,29 @@
/* XXX - this is something to watch out for if there are problems
when the shell is compiled without job control. */
- if (thr_me->already_making_children && pipe_out == NO_PIPE &&
- last_pid != thr_me->last_made_pid)
+ if (already_making_children && pipe_out == NO_PIPE &&
+ last_pid != last_made_pid)
{
stop_pipeline (asynchronous, (COMMAND *) NULL);
if (asynchronous)
{
- DESCRIBE_PID (thr_me->last_made_pid);
+ DESCRIBE_PID (last_made_pid);
}
else
#if !defined (JOB_CONTROL)
/* Do not wait for asynchronous processes started from
startup files. */
- if (thr_me->last_made_pid != thr_me->last_asynchronous_pid)
+ if (last_made_pid != last_asynchronous_pid)
#endif
/* When executing a shell function that executes other
commands, this causes the last simple command in
the function to be waited for twice. */
- exec_result = wait_for (thr_me->last_made_pid);
+ exec_result = wait_for (last_made_pid);
#if !defined (JOB_CONTROL)
else
report_error ("last_made_pid (%d) != last_asynchronous_pid (%d)\n",
- thr_me->last_made_pid, thr_me->last_asynchronous_pid);
+ last_made_pid, last_asynchronous_pid);
#endif
}
}
@@ -660,7 +660,7 @@
if (!ignore_return && exit_immediately_on_error && !invert &&
(exec_result != EXECUTION_SUCCESS))
{
- thr_me->last_command_exit_value = exec_result;
+ last_command_exit_value = exec_result;
run_pending_traps ();
LONGJMP (top_level, EXITPROG);
}
@@ -690,7 +690,7 @@
then the standard input for an asynchronous command is
forced to /dev/null. */
# if defined (JOB_CONTROL)
- if ((!thr_me->interactive_shell || thr_me->subshell_environment || !job_control) &&
+ if ((!interactive_shell || subshell_environment || !job_control) &&
!stdin_redir)
# else
if (!stdin_redir)
@@ -707,7 +707,7 @@
(tc, 1, pipe_in, pipe_out, fds_to_close);
#if defined (JOB_CONTROL)
- if ((!thr_me->interactive_shell || thr_me->subshell_environment || !job_control) &&
+ if ((!interactive_shell || subshell_environment || !job_control) &&
!stdin_redir)
#else
if (!stdin_redir)
@@ -795,7 +795,7 @@
terminate_current_pipeline ();
kill_current_pipeline ();
#endif /* JOB_CONTROL */
- thr_me->last_command_exit_value = EXECUTION_FAILURE;
+ last_command_exit_value = EXECUTION_FAILURE;
/* The unwind-protects installed below will take care
of closing all of the open file descriptors. */
throw_to_top_level ();
@@ -963,9 +963,9 @@
exec_result = EXECUTION_SUCCESS;
}
- thr_me->last_command_exit_value = exec_result;
+ last_command_exit_value = exec_result;
run_pending_traps ();
- return (thr_me->last_command_exit_value);
+ return (last_command_exit_value);
}
#define WEIRD_SYNC_PROBLEM 1 /* (cat a|cat)|cat hangs */
@@ -1021,14 +1021,14 @@
undoing all the work we just did in make_child. */
original_pgrp = -1;
#endif /* JOB_CONTROL */
- thr_me->interactive_shell = 0;
+ interactive_shell = 0;
asynchronous = 0;
}
/* Subshells are neither login nor interactive. */
- thr_me->login_shell = thr_me->interactive = 0;
+ login_shell = interactive = 0;
- thr_me->subshell_environment = 1;
+ subshell_environment = 1;
#if defined (JOB_CONTROL)
/* Delete all traces that there were any jobs running. This is
@@ -1119,7 +1119,7 @@
to do the `shell cleanup' things, such as running traps[0]. */
if (user_subshell && signal_is_trapped (0))
{
- thr_me->last_command_exit_value = return_code;
+ last_command_exit_value = return_code;
return_code = run_exit_trap ();
}
@@ -1135,7 +1135,7 @@
#define REAP() \
do \
{ \
- if (!thr_me->interactive_shell) \
+ if (!interactive_shell) \
reap_dead_jobs (); \
} \
while (0)
@@ -1143,7 +1143,7 @@
#define REAP() \
do \
{ \
- if (!thr_me->interactive_shell) \
+ if (!interactive_shell) \
cleanup_dead_jobs (); \
} \
while (0)
@@ -1192,7 +1192,7 @@
QUIT;
bind_variable (identifier, list->word->word);
execute_command (for_command->action);
- retval = thr_me->last_command_exit_value;
+ retval = last_command_exit_value;
REAP ();
QUIT;
@@ -1217,7 +1217,7 @@
if (lexical_scoping)
{
if (!old_value)
- makunbound (identifier, thr_me->shell_variables);
+ makunbound (identifier, shell_variables);
else
{
SHELL_VAR *new_value;
@@ -1376,7 +1376,7 @@
{
print_select_list (list, list_len, max_elem_len, indices_len);
printf ("%s", prompt);
- fflush (thr_me->stdfile[1]);
+ fflush (stdfile[1]);
QUIT;
if (read_builtin ((WORD_LIST *) NULL) == EXECUTION_FAILURE)
@@ -1491,7 +1491,7 @@
if (lexical_scoping)
{
if (!old_value)
- makunbound (identifier, thr_me->shell_variables);
+ makunbound (identifier, shell_variables);
else
{
SHELL_VAR *new_value;
@@ -1578,7 +1578,7 @@
(case_command->flags & CMD_IGNORE_RETURN))
clauses->action->flags |= CMD_IGNORE_RETURN;
execute_command (clauses->action);
- retval = thr_me->last_command_exit_value;
+ retval = last_command_exit_value;
goto exit_command;
}
@@ -1723,14 +1723,14 @@
result = EXECUTION_SUCCESS;
/* If we're in a function, update the pseudo-line-number information. */
- if (thr_me->variable_context)
+ if (variable_context)
line_number = simple_command->line - function_line_number;
/* Remember what this command line looks like at invocation. */
- thr_me->command_string_index = 0;
+ command_string_index = 0;
print_simple_command (simple_command);
- command_line = (char *)alloca (1 + strlen (thr_me->the_printed_command));
- strcpy (command_line, thr_me->the_printed_command);
+ command_line = (char *)alloca (1 + strlen (the_printed_command));
+ strcpy (command_line, the_printed_command);
first_word_quoted =
simple_command->words ? simple_command->words->word->quoted : 0;
@@ -1912,7 +1912,7 @@
}
else /* in parent */
{
- HANDLE h = find_handle_by_pid(thr_me->last_made_pid);
+ HANDLE h = find_handle_by_pid(last_made_pid);
P (sem_piping_builtin);
V (cs_pipe_builtin);
close_pipes (pipe_in, pipe_out);
@@ -1964,7 +1964,7 @@
do_piping (pipe_in, pipe_out);
- thr_me->subshell_environment = 1;
+ subshell_environment = 1;
if (do_redirections (simple_command->redirects, 1, 0, 0) == 0)
exit (EXECUTION_SUCCESS);
@@ -1993,7 +1993,7 @@
if (do_redirections (simple_command->redirects, 0, 0, 0) != 0)
result = EXECUTION_FAILURE;
else if (old_last_command_subst_pid != last_command_subst_pid)
- result = thr_me->last_command_exit_value;
+ result = last_command_exit_value;
else
result = EXECUTION_SUCCESS;
}
@@ -2037,17 +2037,17 @@
if (builtin == source_builtin)
{
if (subshell == 0)
- begin_unwind_frame ("thr_me->builtin_env");
+ begin_unwind_frame ("builtin_env");
- if (thr_me->temporary_env)
+ if (temporary_env)
{
- thr_me->builtin_env = copy_array (thr_me->temporary_env);
+ builtin_env = copy_array (temporary_env);
if (subshell == 0)
add_unwind_protect (dispose_builtin_env, (char *) NULL);
dispose_used_env_vars ();
}
else
- thr_me->builtin_env = (char **) NULL;
+ builtin_env = (char **) NULL;
}
result = ((*builtin) (words->next));
@@ -2055,7 +2055,7 @@
if (subshell == 0 && builtin == source_builtin)
{
dispose_builtin_env ();
- discard_unwind_frame ("thr_me->builtin_env");
+ discard_unwind_frame ("builtin_env");
}
if (subshell == 0 && builtin == eval_builtin && (flags & CMD_IGNORE_RETURN))
@@ -2098,7 +2098,7 @@
unwind_protect_int (line_number);
}
else
- unwind_protect_int (thr_me->variable_context);
+ unwind_protect_int (variable_context);
unwind_protect_int (loop_level);
unwind_protect_int (return_catch_flag);
@@ -2107,14 +2107,14 @@
/* The temporary environment for a function is supposed to apply to
all commands executed within the function body. */
- if (thr_me->temporary_env)
+ if (temporary_env)
{
- thr_me->function_env = copy_array (thr_me->temporary_env);
+ function_env = copy_array (temporary_env);
add_unwind_protect (dispose_function_env, (char *) NULL);
dispose_used_env_vars ();
}
else
- thr_me->function_env = (char **) NULL;
+ function_env = (char **) NULL;
/* Note the second argument of "1", meaning that we discard
the current value of "$*"! This is apparently the right thing. */
@@ -2135,7 +2135,7 @@
if (fc && (flags & CMD_IGNORE_RETURN))
fc->flags |= CMD_IGNORE_RETURN;
- thr_me->variable_context++;
+ variable_context++;
}
else
fc = tc;
@@ -2180,9 +2180,9 @@
int flags;
{
/* A subshell is neither a login shell nor interactive. */
- thr_me->login_shell = thr_me->interactive = 0;
+ login_shell = interactive = 0;
- thr_me->subshell_environment = 1;
+ subshell_environment = 1;
maybe_make_export_env ();
@@ -2222,9 +2222,9 @@
if (result == EXITPROG)
#if defined (__NT_VC__)
- return thr_me->last_command_exit_value;
+ return last_command_exit_value;
#else /* !__NT_VC__ */
- exit (thr_me->last_command_exit_value);
+ exit (last_command_exit_value);
#endif /* !__NT_VC__ */
else if (result)
#if defined (__NT_VC__)
@@ -2381,7 +2381,7 @@
{
report_error ("%s: restricted: cannot specify `/' in command names",
pathname);
- thr_me->last_command_exit_value = EXECUTION_FAILURE;
+ last_command_exit_value = EXECUTION_FAILURE;
return;
}
#endif /* RESTRICTED_SHELL */
@@ -2491,11 +2491,11 @@
if (async)
{
- old_interactive = thr_me->interactive;
- thr_me->interactive = 0;
+ old_interactive = interactive;
+ interactive = 0;
}
- thr_me->subshell_environment = 1;
+ subshell_environment = 1;
/* This functionality is now provided by close-on-exec of the
file descriptors manipulated by redirection and piping.
@@ -2516,7 +2516,7 @@
}
if (async)
- thr_me->interactive = old_interactive;
+ interactive = old_interactive;
if (!command)
{
@@ -2524,7 +2524,7 @@
exit (EX_NOTFOUND); /* Posix.2 says the exit status is 127 */
}
- exit (shell_execve (command, args, thr_me->export_env));
+ exit (shell_execve (command, args, export_env));
#endif /* !__NT_VC__ */
}
else
@@ -2853,10 +2853,10 @@
if (expandable_redirection_filename (temp))
{
- if (posixly_correct && !thr_me->interactive_shell)
+ if (posixly_correct && !interactive_shell)
disallow_filename_globbing++;
filename = redirection_expand (temp->redirectee.filename);
- if (posixly_correct && !thr_me->interactive_shell)
+ if (posixly_correct && !interactive_shell)
disallow_filename_globbing--;
if (!filename)
@@ -3048,10 +3048,10 @@
case r_input_output:
case r_output_force:
- if (posixly_correct && !thr_me->interactive_shell)
+ if (posixly_correct && !interactive_shell)
disallow_filename_globbing++;
redirectee_word = redirection_expand (redirectee);
- if (posixly_correct && !thr_me->interactive_shell)
+ if (posixly_correct && !interactive_shell)
disallow_filename_globbing--;
if (!redirectee_word)
@@ -3116,8 +3116,8 @@
{
if (remembering)
/* Only setup to undo it if the thing to undo is active. */
- /* if ((fd != thr_me->fd[redirector]) && (fcntl (thr_me->fd[redirector], F_GETFD, 0) != -1)) */
- if ((fd != thr_me->fd[redirector]) /* && IS_OPEN_FD (thr_me->fd[redirector]) */)
+ /* if ((fd != fd[redirector]) && (fcntl (fd[redirector], F_GETFD, 0) != -1)) */
+ if ((fd != thr_me->fd[redirector]) /* && IS_OPEN_FD (fd[redirector]) */)
add_undo_redirect (redirector);
else
add_undo_close_redirect (redirector);
@@ -3347,9 +3347,9 @@
/* if ((already_set || set_unconditionally) && (ok_to_set))
set_it () */
#if !defined (__NT_VC__)
- if (((fcntl (thr_me->fd[redir_fd], F_GETFD, 0) == 1) || set_clexec) &&
- (thr_me->fd[redirector] > 2))
- SET_CLOSE_ON_EXEC (thr_me->fd[redirector]);
+ if (((fcntl (fd[redir_fd], F_GETFD, 0) == 1) || set_clexec) &&
+ (fd[redirector] > 2))
+ SET_CLOSE_ON_EXEC (fd[redirector]);
#endif /* !__NT_VC__ */
}
break;
@@ -3357,7 +3357,7 @@
case r_close_this:
if (for_real)
{
- /* if (remembering && (fcntl (thr_me->fd[redirector], F_GETFD, 0) != -1)) */
+ /* if (remembering && (fcntl (fd[redirector], F_GETFD, 0) != -1)) */
if (remembering && IS_OPEN_FD (thr_me->fd[redirector]))
add_undo_redirect (redirector);
@@ -3366,8 +3366,8 @@
close_buffered_fd (thr_me->fd[redirector]);
thr_me->fd[redirector] = -1;
#else /* !BUFFERED_INPUT */
- close (thr_me->fd[redirector]);
- thr_me->fd[redirector] = -1;
+ close (fd[redirector]);
+ fd[redirector] = -1;
#endif /* !BUFFERED_INPUT */
}
break;
@@ -3393,7 +3393,7 @@
new_fd = dup (fd);
thr_me->fd[new_fd] = new_fd;
#else
- new_fd = fcntl (thr_me->fd[fd], F_DUPFD, SHELL_FD_BASE);
+ new_fd = fcntl (fd[fd], F_DUPFD, SHELL_FD_BASE);
#endif
if (new_fd < 0)
Index: input.c
===================================================================
RCS file: /cvsroot/winbash/winbash/input.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- input.c 9 Mar 2002 03:39:12 -0000 1.1.1.1
+++ input.c 10 Mar 2002 21:45:13 -0000 1.2
@@ -135,7 +135,7 @@
int nfd;
if (fd > 0 && ((bash_input.type == st_bstream && bash_input.location.buffered_fd == fd) ||
- (thr_me->interactive_shell == 0 && default_buffered_input == fd)))
+ (interactive_shell == 0 && default_buffered_input == fd)))
{
#if !defined (_MT)
/* Sync the stream so we can re-read from the new file descriptor. We
Index: jobs.c
===================================================================
RCS file: /cvsroot/winbash/winbash/jobs.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- jobs.c 9 Mar 2002 16:05:41 -0000 1.2
+++ jobs.c 10 Mar 2002 21:45:13 -0000 1.3
@@ -1393,7 +1393,7 @@
if (interrupt_immediately ||
(this_shell_builtin && this_shell_builtin == wait_builtin))
{
- thr_me->last_command_exit_value = EXECUTION_FAILURE;
+ last_command_exit_value = EXECUTION_FAILURE;
restore_sigint_handler ();
interrupt_state++;
QUIT;
@@ -1445,7 +1445,7 @@
if (!job_control)
old_sigint_handler = set_signal_handler (SIGINT, wait_sigint_handler);
- termination_state = thr_me->last_command_exit_value;
+ termination_state = last_command_exit_value;
/* If we say wait_for (), then we have a record of this child somewhere.
If this child and all of its peers are not running, then don't
@@ -2143,7 +2143,7 @@
/* If SIGINT is trapped, set the exit status so
that the trap handler can see it. */
if (signal_is_trapped (SIGINT))
- thr_me->last_command_exit_value = process_exit_status
+ last_command_exit_value = process_exit_status
(jobs[job]->pipe->status);
/* If the signal is trapped, let the trap handler
@@ -2200,7 +2200,7 @@
trap_command = savestring (trap_list[SIGCHLD]);
begin_unwind_frame ("SIGCHLD trap");
- unwind_protect_int (thr_me->last_command_exit_value);
+ unwind_protect_int (last_command_exit_value);
unwind_protect_int (last_made_pid);
unwind_protect_int (interrupt_immediately);
unwind_protect_int (freeze_jobs_list);
Index: nojobs.c
===================================================================
RCS file: /cvsroot/winbash/winbash/nojobs.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- nojobs.c 9 Mar 2002 03:39:12 -0000 1.1.1.1
+++ nojobs.c 10 Mar 2002 21:45:13 -0000 1.2
@@ -130,9 +130,9 @@
{
register int i;
- for (i = 0; i < thr_me->pid_list_size; i++)
- if (thr_me->pid_list[i].pid == pid)
- return (thr_me->pid_list[i].h);
+ for (i = 0; i < pid_list_size; i++)
+ if (pid_list[i].pid == pid)
+ return (pid_list[i].h);
return (INVALID_HANDLE_VALUE);
}
@@ -162,11 +162,11 @@
int slot;
slot = find_proc_slot ();
- thr_me->pid_list[slot].pid = get_next_pid();
- thr_me->pid_list[slot].status = PROC_STILL_ALIVE;
- thr_me->pid_list[slot].h = h;
+ pid_list[slot].pid = get_next_pid();
+ pid_list[slot].status = PROC_STILL_ALIVE;
+ pid_list[slot].h = h;
- return (thr_me->pid_list[slot].pid);
+ return (pid_list[slot].pid);
}
/* recycle a slot in the per-thread pid table so it can be used again */
@@ -181,9 +181,9 @@
return;
/* reinitialize all fields */
- thr_me->pid_list[slot].h = INVALID_HANDLE_VALUE;
- thr_me->pid_list[slot].pid = NO_PID;
- thr_me->pid_list[slot].status = PROC_NULL;
+ pid_list[slot].h = INVALID_HANDLE_VALUE;
+ pid_list[slot].pid = NO_PID;
+ pid_list[slot].status = PROC_NULL;
}
@@ -221,18 +221,18 @@
alloc_pid_list ()
{
register int i;
- int old = thr_me->pid_list_size;
+ int old = pid_list_size;
- thr_me->pid_list_size += 10;
- thr_me->pid_list = (struct proc_status *)
- xrealloc (thr_me->pid_list, thr_me->pid_list_size * sizeof (struct proc_status));
+ pid_list_size += 10;
+ pid_list = (struct proc_status *)
+ xrealloc (pid_list, pid_list_size * sizeof (struct proc_status));
/* None of the newly allocated slots have process id's yet. */
- for (i = old; i < thr_me->pid_list_size; i++) {
- thr_me->pid_list[i].pid = NO_PID;
- thr_me->pid_list[i].status = PROC_NULL;
+ for (i = old; i < pid_list_size; i++) {
+ pid_list[i].pid = NO_PID;
+ pid_list[i].status = PROC_NULL;
#ifdef __NT_VC__
- thr_me->pid_list[i].h = INVALID_HANDLE_VALUE;
+ pid_list[i].h = INVALID_HANDLE_VALUE;
#endif
}
}
@@ -244,11 +244,11 @@
{
register int i;
- for (i = 0; i < thr_me->pid_list_size; i++)
- if (thr_me->pid_list[i].pid == NO_PID)
+ for (i = 0; i < pid_list_size; i++)
+ if (pid_list[i].pid == NO_PID)
return (i);
- if (i == thr_me->pid_list_size)
+ if (i == pid_list_size)
alloc_pid_list ();
return (i);
@@ -262,8 +262,8 @@
{
register int i;
- for (i = 0; i < thr_me->pid_list_size; i++)
- if (thr_me->pid_list[i].pid == pid)
+ for (i = 0; i < pid_list_size; i++)
+ if (pid_list[i].pid == pid)
return (i);
return (NO_PID);
@@ -280,7 +280,7 @@
i = find_index_by_pid (pid);
if (i == NO_PID)
return (PROC_BAD);
- return (thr_me->pid_list[i].status);
+ return (pid_list[i].status);
}
/* Give PID the status value STATUS in the PID_LIST array. */
@@ -296,13 +296,13 @@
return;
if (WIFSIGNALED (status))
- thr_me->pid_list[slot].status = 128 + WTERMSIG (status);
+ pid_list[slot].status = 128 + WTERMSIG (status);
else
- thr_me->pid_list[slot].status = WEXITSTATUS (status);
+ pid_list[slot].status = WEXITSTATUS (status);
#ifdef __NT_VC__
- CloseHandle(thr_me->pid_list[slot].h);
- thr_me->pid_list[slot].h = INVALID_HANDLE_VALUE;
+ CloseHandle(pid_list[slot].h);
+ pid_list[slot].h = INVALID_HANDLE_VALUE;
#endif
}
@@ -313,8 +313,8 @@
int slot;
slot = find_proc_slot ();
- thr_me->pid_list[slot].pid = pid;
- thr_me->pid_list[slot].status = PROC_STILL_ALIVE;
+ pid_list[slot].pid = pid;
+ pid_list[slot].status = PROC_STILL_ALIVE;
}
int
@@ -332,9 +332,9 @@
* the table is freed each time a thread is reaped. Since there
* is a per-thread resource, there is no need to do this clean up.
*/
- for (i = 0; i < thr_me->pid_list_size; i++)
- if (thr_me->pid_list[i].status != PROC_STILL_ALIVE)
- thr_me->pid_list[i].pid = NO_PID;
+ for (i = 0; i < pid_list_size; i++)
+ if (pid_list[i].status != PROC_STILL_ALIVE)
+ pid_list[i].pid = NO_PID;
#endif
}
@@ -373,7 +373,7 @@
/* If this is a login shell we don't wish to be disturbed by
stop signals. */
- if (thr_me->login_shell)
+ if (login_shell)
{
#if defined (SIGTSTP)
set_signal_handler (SIGTSTP, SIG_IGN);
@@ -405,11 +405,11 @@
int bContinue = TRUE;
DWORD dwWhich;
- if (thr_me->pid_list_size) {
+ if (pid_list_size) {
int i,j;
int rc;
- HANDLE* harray = calloc(thr_me->pid_list_size, sizeof (HANDLE));
- pid_t* parray = calloc(thr_me->pid_list_size, sizeof (pid_t));
+ HANDLE* harray = calloc(pid_list_size, sizeof (HANDLE));
+ pid_t* parray = calloc(pid_list_size, sizeof (pid_t));
if (!harray || !parray) {
if (harray) free(harray);
@@ -418,12 +418,12 @@
}
/* build up array of thread handles to wait on */
- for (i = 0, j = 0; i < thr_me->pid_list_size; i++)
- if (thr_me->pid_list[i].pid != NO_PID &&
- thr_me->pid_list[i].status == PROC_STILL_ALIVE &&
- thr_me->pid_list[i].h != INVALID_HANDLE_VALUE) {
- harray[j] = thr_me->pid_list[i].h;
- parray[j] = thr_me->pid_list[i].pid;
+ for (i = 0, j = 0; i < pid_list_size; i++)
+ if (pid_list[i].pid != NO_PID &&
+ pid_list[i].status == PROC_STILL_ALIVE &&
+ pid_list[i].h != INVALID_HANDLE_VALUE) {
+ harray[j] = pid_list[i].h;
+ parray[j] = pid_list[i].pid;
j++;
}
@@ -548,7 +548,7 @@
set_signal_handler (SIGINT, SIG_IGN);
set_signal_handler (SIGQUIT, SIG_IGN);
#endif
- thr_me->last_asynchronous_pid = getpid ();
+ last_asynchronous_pid = getpid ();
}
#if defined (SIGTSTP)
@@ -561,10 +561,10 @@
{
/* In the parent. */
- thr_me->last_made_pid = pid;
+ last_made_pid = pid;
if (async_p)
- thr_me->last_asynchronous_pid = pid;
+ last_asynchronous_pid = pid;
add_pid (pid);
}
@@ -720,52 +720,52 @@
if (thr_me->fd[i] >= 0) SET_CLOSE_ON_EXEC (thr_me->fd[i]);
}
- thr_child->stdfile[0] = fdopen (thr_child->fd[0], "r");
- thr_child->stdfile[1] = fdopen (thr_child->fd[1], "w");
- thr_child->stdfile[2] = fdopen (thr_child->fd[2], "w");
+ thr_child->stdfile_[0] = fdopen (thr_child->fd[0], "r");
+ thr_child->stdfile_[1] = fdopen (thr_child->fd[1], "w");
+ thr_child->stdfile_[2] = fdopen (thr_child->fd[2], "w");
- thr_child->last_made_pid = thr_me->last_made_pid;
- thr_child->last_asynchronous_pid = thr_me->last_asynchronous_pid;
- thr_child->last_command_exit_value = thr_me->last_command_exit_value;
- thr_child->subshell_environment = thr_me->subshell_environment;
+ thr_child->last_made_pid_ = last_made_pid;
+ thr_child->last_asynchronous_pid_ = last_asynchronous_pid;
+ thr_child->last_command_exit_value_ = last_command_exit_value;
+ thr_child->subshell_environment_ = subshell_environment;
- if (thr_me->temporary_env)
- thr_child->temporary_env = copy_array (thr_me->temporary_env);
- if (thr_me->function_env)
- thr_child->function_env = copy_array (thr_me->function_env);
- if (thr_me->builtin_env)
- thr_child->builtin_env = copy_array (thr_me->builtin_env);
+ if (temporary_env)
+ thr_child->temporary_env_ = copy_array (temporary_env);
+ if (function_env)
+ thr_child->function_env_ = copy_array (function_env);
+ if (builtin_env)
+ thr_child->builtin_env_ = copy_array (builtin_env);
- if (thr_me->shell_variables)
- thr_child->shell_variables = copy_hash_table (thr_me->shell_variables, copy_variable);
- if (thr_me->shell_functions)
- thr_child->shell_functions = copy_hash_table (thr_me->shell_functions, copy_variable);
- thr_child->variable_context = thr_me->variable_context;
+ if (shell_variables)
+ thr_child->shell_variables_ = copy_hash_table (shell_variables, copy_variable);
+ if (shell_functions)
+ thr_child->shell_functions_ = copy_hash_table (shell_functions, copy_variable);
+ thr_child->variable_context_ = variable_context;
- if (thr_me->shell_environment)
- thr_child->shell_environment = copy_array (thr_me->shell_environment);
- if (thr_me->export_env)
- thr_child->export_env = copy_array (thr_me->export_env);
+ if (shell_environment)
+ thr_child->shell_environment_ = copy_array (shell_environment);
+ if (export_env)
+ thr_child->export_env_ = copy_array (export_env);
- thr_child->interactive = thr_me->interactive;
- thr_child->login_shell = thr_me->login_shell;
- thr_child->interactive_shell = thr_me->interactive_shell;
- thr_child->shell_level = thr_me->shell_level;
+ thr_child->interactive_ = interactive;
+ thr_child->login_shell_ = login_shell;
+ thr_child->interactive_shell_ = interactive_shell;
+ thr_child->shell_level_ = shell_level;
- thr_child->already_making_children = thr_me->already_making_children;
+ thr_child->already_making_children_ = already_making_children;
- if (thr_me->the_printed_command)
- thr_child->the_printed_command = savestring (thr_me->the_printed_command);
+ if (the_printed_command)
+ thr_child->the_printed_command_ = savestring (the_printed_command);
else
- thr_child->the_printed_command = (char *) NULL;
- thr_child->command_string_index = thr_me->command_string_index;
+ thr_child->the_printed_command_ = (char *) NULL;
+ thr_child->command_string_index_ = command_string_index;
- thr_child->remember_on_history = thr_me->remember_on_history;
- thr_child->no_line_editing = thr_me->no_line_editing;
- thr_child->history_expansion_inhibited = thr_me->history_expansion_inhibited;
+ thr_child->remember_on_history_ = remember_on_history;
+ thr_child->no_line_editing_ = no_line_editing;
+ thr_child->history_expansion_inhibited_ = history_expansion_inhibited;
- thr_child->pid_list_size = 0;
- thr_child->pid_list = NULL;
+ thr_child->pid_list_size_ = 0;
+ thr_child->pid_list_ = NULL;
thr_args->thr_env = thr_child;
@@ -781,10 +781,10 @@
{
pid_t pid = add_pid_w32((HANDLE) hThread);
- thr_me->last_made_pid = pid;
+ last_made_pid = pid;
if (async_p)
- thr_me->last_asynchronous_pid = pid;
+ last_asynchronous_pid = pid;
return pid;
}
@@ -877,11 +877,11 @@
* a job via wait_for_single_pid() and this means leaving the
* pid status in the per-thread pid table for it to be found later.
*/
- if (thr_me->pid_list_size) {
+ if (pid_list_size) {
int i,j;
int rc;
- HANDLE* harray = calloc(thr_me->pid_list_size, sizeof (HANDLE));
- pid_t* parray = calloc(thr_me->pid_list_size, sizeof (HANDLE));
+ HANDLE* harray = calloc(pid_list_size, sizeof (HANDLE));
+ pid_t* parray = calloc(pid_list_size, sizeof (HANDLE));
if (!harray || !parray) {
if (harray) free(harray);
@@ -890,11 +890,11 @@
}
/* build up array of thread handles to wait on */
- for (i = 0, j = 0; i < thr_me->pid_list_size; i++)
- if (thr_me->pid_list[i].pid != NO_PID &&
- thr_me->pid_list[i].status == PROC_STILL_ALIVE) {
- harray[j] = thr_me->pid_list[i].h;
- parray[j] = thr_me->pid_list[i].pid;
+ for (i = 0, j = 0; i < pid_list_size; i++)
+ if (pid_list[i].pid != NO_PID &&
+ pid_list[i].status == PROC_STILL_ALIVE) {
+ harray[j] = pid_list[i].h;
+ parray[j] = pid_list[i].pid;
j++;
}
@@ -985,7 +985,7 @@
/* If we are running a script, ignore SIGINT while we're waiting for
a child to exit. The loop below does some of this, but not all. */
- if (!thr_me->interactive_shell)
+ if (!interactive_shell)
old_sigint_handler = set_signal_handler (SIGINT, wait_sigint_handler);
while ((got_pid = WAITPID (-1, &status, 0)) != pid) /* XXX was pid now -1 */
@@ -1012,7 +1012,7 @@
reap_zombie_children ();
#endif /* _POSIX_VERSION */
- if (!thr_me->interactive_shell)
+ if (!interactive_shell)
{
set_signal_handler (SIGINT, old_sigint_handler);
/* If the job exited because of SIGINT, make sure the shell acts as if
@@ -1040,7 +1040,7 @@
fprintf (stderr, "\n");
}
- if (thr_me->interactive_shell && !thr_me->subshell_environment)
+ if (interactive_shell && !subshell_environment)
{
if (WIFSIGNALED (status) || WIFSTOPPED (status))
set_tty_state ();
@@ -1144,13 +1144,13 @@
int async;
COMMAND *ignore;
{
- thr_me->already_making_children = 0;
+ already_making_children = 0;
}
void
start_pipeline ()
{
- thr_me->already_making_children = 1;
+ already_making_children = 1;
}
/* Print descriptive information about the job with leader pid PID. */
Index: nt_execute_cmd.c
===================================================================
RCS file: /cvsroot/winbash/winbash/nt_execute_cmd.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- nt_execute_cmd.c 9 Mar 2002 03:39:12 -0000 1.1.1.1
+++ nt_execute_cmd.c 10 Mar 2002 21:45:13 -0000 1.2
@@ -275,8 +275,8 @@
#endif
/* Write the error to stderr too */
- if (thr_main && thr_main->stdfile[2])
- outf = thr_main->stdfile[2];
+ if (thr_main && thr_main->stdfile_[2])
+ outf = thr_main->stdfile_[2];
else
outf = &_iob[2];
@@ -367,12 +367,12 @@
for (i = 3; i < MAX_FD; i++)
thr_me->fd[i] = -1;
- thr_me->last_made_pid = NO_PID;
- thr_me->last_asynchronous_pid = NO_PID;
- thr_me->remember_on_history = 1;
+ last_made_pid = NO_PID;
+ last_asynchronous_pid = NO_PID;
+ remember_on_history = 1;
- thr_me->pid_list_size = 0;
- thr_me->pid_list = NULL;
+ pid_list_size = 0;
+ pid_list = NULL;
}
void
@@ -396,24 +396,24 @@
if (stderr)
FCLOSE (stderr);
- if (thr_me->temporary_env)
- free_array (thr_me->temporary_env);
- if (thr_me->builtin_env)
- free_array (thr_me->builtin_env);
- if (thr_me->function_env)
- free_array (thr_me->function_env);
+ if (temporary_env)
+ free_array (temporary_env);
+ if (builtin_env)
+ free_array (builtin_env);
+ if (function_env)
+ free_array (function_env);
- if (thr_me->shell_variables)
- dispose_hash_table (thr_me->shell_variables, dispose_variable);
- if (thr_me->shell_functions)
- dispose_hash_table (thr_me->shell_functions, dispose_variable);
- if (thr_me->shell_environment)
- free_array (thr_me->shell_environment);
- if (thr_me->export_env)
- free_array (thr_me->export_env);
+ if (shell_variables)
+ dispose_hash_table (shell_variables, dispose_variable);
+ if (shell_functions)
+ dispose_hash_table (shell_functions, dispose_variable);
+ if (shell_environment)
+ free_array (shell_environment);
+ if (export_env)
+ free_array (export_env);
- if (thr_me->the_printed_command)
- FREE (thr_me->the_printed_command);
+ if (the_printed_command)
+ FREE (the_printed_command);
FREE (thr_me);
}
@@ -445,7 +445,7 @@
V (sem_piping_subshell);
if (result == EXITPROG)
- status = thr_me->last_command_exit_value;
+ status = last_command_exit_value;
else if (result)
status = EXECUTION_FAILURE;
else
@@ -502,35 +502,35 @@
if (thr_me->fd[i] > 0)
close (thr_me->fd[i]);
- if (thr_me->temporary_env)
- free_array (thr_me->temporary_env);
- if (thr_me->builtin_env)
- free_array (thr_me->builtin_env);
- if (thr_me->function_env)
- free_array (thr_me->function_env);
+ if (temporary_env)
+ free_array (temporary_env);
+ if (builtin_env)
+ free_array (builtin_env);
+ if (function_env)
+ free_array (function_env);
- if (thr_me->shell_variables)
- dispose_hash_table (thr_me->shell_variables, dispose_variable);
- if (thr_me->shell_functions)
- dispose_hash_table (thr_me->shell_functions, dispose_variable);
- if (thr_me->shell_environment)
- free_array (thr_me->shell_environment);
- if (thr_me->export_env)
- free_array (thr_me->export_env);
- if (thr_me->pid_list_size) {
+ if (shell_variables)
+ dispose_hash_table (shell_variables, dispose_variable);
+ if (shell_functions)
+ dispose_hash_table (shell_functions, dispose_variable);
+ if (shell_environment)
+ free_array (shell_environment);
+ if (export_env)
+ free_array (export_env);
+ if (pid_list_size) {
int i;
/* parent exiting, reap any active thread handles */
- for (i = 0; i < thr_me->pid_list_size; i++)
- if (thr_me->pid_list[i].h != INVALID_HANDLE_VALUE)
- CloseHandle(thr_me->pid_list[i].h);
+ for (i = 0; i < pid_list_size; i++)
+ if (pid_list[i].h != INVALID_HANDLE_VALUE)
+ CloseHandle(pid_list[i].h);
/* reclaim heap */
- FREE(thr_me->pid_list);
+ FREE(pid_list);
}
- if (thr_me->the_printed_command)
- FREE (thr_me->the_printed_command);
+ if (the_printed_command)
+ FREE (the_printed_command);
FREE (thr_me);
@@ -581,11 +581,11 @@
if (async)
{
- old_interactive = thr_me->interactive;
- thr_me->interactive = 0;
+ old_interactive = interactive;
+ interactive = 0;
}
- thr_me->subshell_environment = 1;
+ subshell_environment = 1;
/* This functionality is now provided by close-on-exec of the
file descriptors manipulated by redirection and piping.
@@ -607,7 +607,7 @@
}
if (async)
- thr_me->interactive = old_interactive;
+ interactive = old_interactive;
if (!command)
{
@@ -616,7 +616,7 @@
return 127; /* was EX_NOTFOUND */ /* Posix.2 says the exit status is 127 */
}
- pi = nt_shell_execve_async (command, args, thr_me->export_env);
+ pi = nt_shell_execve_async (command, args, export_env);
V (sem_piping_disk);
@@ -1392,7 +1392,7 @@
close (fildes[0]);
/* The currently executing shell is not interactive. */
- thr_me->interactive = 0;
+ interactive = 0;
remove_quoted_escapes (string);
@@ -1401,7 +1401,7 @@
result = SETJMP (top_level);
if (result == EXITPROG)
- return (thr_me->last_command_exit_value);
+ return (last_command_exit_value);
else if (result)
return (EXECUTION_FAILURE);
else
Index: nt_io.c
===================================================================
RCS file: /cvsroot/winbash/winbash/nt_io.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- nt_io.c 9 Mar 2002 03:39:12 -0000 1.1.1.1
+++ nt_io.c 10 Mar 2002 21:45:13 -0000 1.2
@@ -148,11 +148,11 @@
int ret;
int save_count = count;
#if 0
- fprintf (stderr, "DEBUG: nt_read interactive=%d running_in_emacs=%d\n", thr_me->interactive_shell,running_in_emacs);
+ fprintf (stderr, "DEBUG: nt_read interactive=%d running_in_emacs=%d\n", interactive_shell,running_in_emacs);
fflush (stderr);
#endif
- if (thr_me->interactive_shell) // && !running_in_emacs)
+ if (interactive_shell)
{
int i;
for (i = 0; i < count; buf[i++] = getch ())
Index: nt_types.h
===================================================================
RCS file: /cvsroot/winbash/winbash/nt_types.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- nt_types.h 9 Mar 2002 03:39:12 -0000 1.1.1.1
+++ nt_types.h 10 Mar 2002 21:45:13 -0000 1.2
@@ -54,53 +54,91 @@
struct thread_env {
int fd[MAX_FD];
- FILE *stdfile[3];
+ FILE *stdfile_[3];
- int last_made_pid;
- int last_asynchronous_pid;
- int subshell_environment; /* Non-zero if we have just forked and are currently running in a subshell
+ int last_made_pid_;
+ int last_asynchronous_pid_;
+ int subshell_environment_; /* Non-zero if we have just forked and are currently running in a subshell
environment. */
- char **temporary_env;
- char **function_env;
- char **builtin_env;
- HASH_TABLE *shell_variables;
- HASH_TABLE *shell_functions;
- int variable_context;
- char **shell_environment;
- char **export_env;
+ char **temporary_env_;
+ char **function_env_;
+ char **builtin_env_;
+ HASH_TABLE *shell_variables_;
+ HASH_TABLE *shell_functions_;
+ int variable_context_;
+ char **shell_environment_;
+ char **export_env_;
- int interactive;
- int login_shell;
- int last_command_exit_value; /* The value returned by the last synchronous command. */
- int interactive_shell;
+ int interactive_;
+ int login_shell_;
+ int last_command_exit_value_; /* The value returned by the last synchronous command. */
+ int interactive_shell_;
- int already_making_children;
+ int already_making_children_;
- int shell_level;
+ int shell_level_;
- char *the_printed_command;
- int command_string_index;
+ char *the_printed_command_;
+ int command_string_index_;
- int remember_on_history;
- int no_line_editing;
- int history_expansion_inhibited;
+ int remember_on_history_;
+ int no_line_editing_;
+ int history_expansion_inhibited_;
- struct proc_status *pid_list;
- int pid_list_size;
+ struct proc_status *pid_list_;
+ int pid_list_size_;
};
extern __declspec(thread) struct thread_env *thr_me;
+/* macros to access members of the thr_me structure.
+ use these macros to reference thread-local variables.
+ this, in theory, will make it easier to merge changes
+ from the bash mainline into the windows port. */
+#define stdfile thr_me->stdfile_
+
+#define last_made_pid thr_me->last_made_pid_
+#define last_asynchronous_pid thr_me->last_asynchronous_pid_
+#define subshell_environment thr_me->subshell_environment_
+
+#define temporary_env thr_me->temporary_env_
+#define function_env thr_me->function_env_
+#define builtin_env thr_me->builtin_env_
+#define shell_variables thr_me->shell_variables_
+#define shell_functions thr_me->shell_functions_
+#define variable_context thr_me->variable_context_
+#define shell_environment thr_me->shell_environment_
+#define export_env thr_me->export_env_
+
+#define interactive thr_me->interactive_
+#define login_shell thr_me->login_shell_
+#define last_command_exit_value thr_me->last_command_exit_value_
+#define interactive_shell thr_me->interactive_shell_
+
+#define already_making_children thr_me->already_making_children_
+
+#define shell_level thr_me->shell_level_
+
+#define the_printed_command thr_me->the_printed_command_
+#define command_string_index thr_me->command_string_index_
+
+#define remember_on_history thr_me->remember_on_history_
+#define no_line_editing thr_me->no_line_editing_
+#define history_expansion_inhibited thr_me->history_expansion_inhibited_
+
+#define pid_list thr_me->pid_list_
+#define pid_list_size thr_me->pid_list_size_
+
/* Some convenience macros. */
#define FD0 (thr_me->fd[0])
#define FD1 (thr_me->fd[1])
#define FD2 (thr_me->fd[2])
-#define STDIN (thr_me->stdfile[0])
-#define STDOUT (thr_me->stdfile[1])
-#define STDERR (thr_me->stdfile[2])
+#define STDIN (thr_me->stdfile_[0])
+#define STDOUT (thr_me->stdfile_[1])
+#define STDERR (thr_me->stdfile_[2])
/* Thread I/O routines. */
extern int thr_printf (const char *, ...);
@@ -108,17 +146,17 @@
#if defined (stdin)
#undef stdin
#endif /* stdin */
-#define stdin (thr_me->stdfile[0])
+#define stdin (thr_me->stdfile_[0])
#if defined (stdout)
#undef stdout
#endif /* stdout */
-#define stdout (thr_me->stdfile[1])
+#define stdout (thr_me->stdfile_[1])
#if defined (stderr)
#undef stderr
#endif /* stderr */
-#define stderr (thr_me->stdfile[2])
+#define stderr (thr_me->stdfile_[2])
#ifdef putchar
#undef putchar
Index: parse.y
===================================================================
RCS file: /cvsroot/winbash/winbash/parse.y,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- parse.y 9 Mar 2002 16:05:42 -0000 1.2
+++ parse.y 10 Mar 2002 21:45:13 -0000 1.3
@@ -184,7 +184,7 @@
global_command = (COMMAND *)NULL;
eof_encountered = 0;
discard_parser_constructs (1);
- if (thr_me->interactive)
+ if (interactive)
{
YYACCEPT;
}
@@ -1420,9 +1420,9 @@
#endif /* !JOB_CONTROL */
#if defined (READLINE)
- if (thr_me->interactive && bash_input.type != st_string && thr_me->no_line_editing)
+ if (interactive && bash_input.type != st_string && no_line_editing)
#else
- if (thr_me->interactive && bash_input.type != st_string)
+ if (interactive && bash_input.type != st_string)
#endif
print_prompt ();
@@ -1463,7 +1463,7 @@
shell_input_line_len = i; /* == strlen (shell_input_line) */
#if defined (HISTORY)
- if (thr_me->interactive && shell_input_line && shell_input_line[0])
+ if (interactive && shell_input_line && shell_input_line[0])
{
char *expansions;
@@ -1595,7 +1595,7 @@
temp_last = last_shell_builtin;
temp_this = this_shell_builtin;
- temp_exit_value = thr_me->last_command_exit_value;
+ temp_exit_value = last_command_exit_value;
temp_eof_encountered = eof_encountered;
last_lastarg = get_string_value ("_");
if (last_lastarg)
@@ -1605,7 +1605,7 @@
last_shell_builtin = temp_last;
this_shell_builtin = temp_this;
- thr_me->last_command_exit_value = temp_exit_value;
+ last_command_exit_value = temp_exit_value;
eof_encountered = temp_eof_encountered;
bind_variable ("_", last_lastarg);
@@ -1623,7 +1623,7 @@
yylex ()
{
- if (thr_me->interactive && (!current_token || current_token == '\n'))
+ if (interactive && (!current_token || current_token == '\n'))
{
/* Before we print a prompt, we might have to check mailboxes.
We do this only if it is time to do so. Notice that only here
@@ -1637,7 +1637,7 @@
/* Avoid printing a prompt if we're not going to read anything, e.g.
after resetting the parser with read_token (RESET). */
- if (token_to_read == 0 && thr_me->interactive)
+ if (token_to_read == 0 && interactive)
prompt_again ();
}
@@ -1819,7 +1819,7 @@
return (yacc_EOF);
}
- if (character == '#' && (!thr_me->interactive || interactive_comments))
+ if (character == '#' && (!interactive || interactive_comments))
{
/* A comment. Discard until EOL or EOF, and then return a newline. */
discard_until ('\n');
@@ -2232,7 +2232,7 @@
token = xrealloc (token, token_buffer_size);
}
next_character:
- if (character == '\n' && thr_me->interactive && bash_input.type != st_string)
+ if (character == '\n' && interactive && bash_input.type != st_string)
prompt_again ();
/* We want to remove quoted newlines (that is, a \<newline> pair)
@@ -2351,7 +2351,7 @@
Special cases that disqualify:
In a pattern list in a case statement (in_case_pattern_list). */
- if (thr_me->interactive_shell && !quoted && !in_case_pattern_list &&
+ if (interactive_shell && !quoted && !in_case_pattern_list &&
(expand_next_token || command_token_position (last_read_token)))
{
char *alias_expand_word (), *expanded;
@@ -2524,7 +2524,7 @@
{
char *temp_prompt;
- if (!thr_me->interactive) /* XXX */
+ if (!interactive) /* XXX */
return;
ps1_prompt = get_string_value ("PS1");
@@ -2542,7 +2542,7 @@
prompt_string_pointer = &ps2_prompt;
#if defined (READLINE)
- if (!thr_me->no_line_editing)
+ if (!no_line_editing)
{
FREE (current_readline_prompt);
current_readline_prompt = temp_prompt;
@@ -2683,7 +2683,7 @@
}
case 'n':
- if (!thr_me->no_line_editing)
+ if (!no_line_editing)
temp = savestring ("\r\n");
else
temp = savestring ("\n");
@@ -2829,7 +2829,7 @@
{
if (message)
{
- if (!thr_me->interactive)
+ if (!interactive)
{
char *name = bash_input.name ? bash_input.name : "stdin";
report_error ("%s: line %d: `%s'", name, line_number, message);
@@ -2841,7 +2841,7 @@
report_error ("%s", message);
}
- thr_me->last_command_exit_value = EX_USAGE;
+ last_command_exit_value = EX_USAGE;
return;
}
@@ -2885,7 +2885,7 @@
report_error ("syntax error near unexpected token `%s'", etoken);
}
- if (!thr_me->interactive)
+ if (!interactive)
{
char *temp = savestring (shell_input_line);
char *name = bash_input.name ? bash_input.name : "stdin";
@@ -2901,13 +2901,13 @@
else
{
char *name, *msg;
- if (!thr_me->interactive)
+ if (!interactive)
name = bash_input.name ? bash_input.name : "stdin";
if (EOF_Reached)
msg = "syntax error: unexpected end of file";
else
msg = "syntax error";
- if (!thr_me->interactive)
+ if (!interactive)
report_error ("%s: line %d: %s", name, line_number, msg);
else
{
@@ -2918,7 +2918,7 @@
report_error (msg);
}
}
- thr_me->last_command_exit_value = EX_USAGE;
+ last_command_exit_value = EX_USAGE;
}
/* ??? Needed function. ??? We have to be able to discard the constructs
@@ -2951,7 +2951,7 @@
static void
handle_eof_input_unit ()
{
- if (thr_me->interactive)
+ if (interactive)
{
/* shell.c may use this to decide whether or not to write out the
history, among other things. We use it only for error reporting
@@ -2965,7 +2965,7 @@
if (eof_encountered < eof_encountered_limit)
{
fprintf (STDERR, "Use \"%s\" to leave the shell.\n",
- thr_me->login_shell ? "logout" : "exit");
+ login_shell ? "logout" : "exit");
fflush (STDERR);
eof_encountered++;
/* Reset the prompt string to be $PS1. */
Index: print_cmd.c
===================================================================
RCS file: /cvsroot/winbash/winbash/print_cmd.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- print_cmd.c 9 Mar 2002 03:39:12 -0000 1.1.1.1
+++ print_cmd.c 10 Mar 2002 21:45:13 -0000 1.2
@@ -83,7 +83,7 @@
print_command (command)
COMMAND *command;
{
- thr_me->command_string_index = 0;
+ command_string_index = 0;
printf ("%s", make_command_string (command));
}
@@ -95,9 +95,9 @@
make_command_string (command)
COMMAND *command;
{
- thr_me->command_string_index = 0;
+ command_string_index = 0;
make_command_string_internal (command);
- return (thr_me->the_printed_command);
+ return (the_printed_command);
}
/* The internal function. This is the real workhorse. */
@@ -571,7 +571,7 @@
char *result;
int old_indent = indentation, old_amount = indentation_amount;
- thr_me->command_string_index = 0;
+ command_string_index = 0;
if (name && *name)
cprintf ("%s ", name);
@@ -607,7 +607,7 @@
newline ("}");
- result = thr_me->the_printed_command;
+ result = the_printed_command;
if (!multi_line)
{
@@ -649,7 +649,7 @@
static void
semicolon ()
{
- if (thr_me->command_string_index > 0 && thr_me->the_printed_command[thr_me->command_string_index - 1] == '&')
+ if (command_string_index > 0 && the_printed_command[command_string_index - 1] == '&')
return;
cprintf (";");
}
@@ -718,14 +718,14 @@
if (argp)
{
the_printed_command_resize (arg_len + 1);
- FASTCOPY (argp, thr_me->the_printed_command + thr_me->command_string_index, arg_len);
- thr_me->command_string_index += arg_len;
+ FASTCOPY (argp, the_printed_command + command_string_index, arg_len);
+ command_string_index += arg_len;
if (free_argp)
free (argp);
}
}
- thr_me->the_printed_command[thr_me->command_string_index] = '\0';
+ the_printed_command[command_string_index] = '\0';
}
#else /* We have support for varargs. */
@@ -794,14 +794,14 @@
if (argp)
{
the_printed_command_resize (arg_len + 1);
- FASTCOPY (argp, thr_me->the_printed_command + thr_me->command_string_index, arg_len);
- thr_me->command_string_index += arg_len;
+ FASTCOPY (argp, the_printed_command + command_string_index, arg_len);
+ command_string_index += arg_len;
if (free_argp)
free (argp);
}
}
- thr_me->the_printed_command[thr_me->command_string_index] = '\0';
+ the_printed_command[command_string_index] = '\0';
}
#endif /* HAVE_VARARGS_H */
@@ -811,19 +811,19 @@
the_printed_command_resize (length)
int length;
{
- if (!thr_me->the_printed_command)
+ if (!the_printed_command)
{
the_printed_command_size = length + 1;
- thr_me->the_printed_command = xmalloc (the_printed_command_size);
- thr_me->command_string_index = 0;
+ the_printed_command = xmalloc (the_printed_command_size);
+ command_string_index = 0;
}
- else if ((thr_me->command_string_index + length) >= the_printed_command_size)
+ else if ((command_string_index + length) >= the_printed_command_size)
{
int new;
- new = thr_me->command_string_index + length + 1;
+ new = command_string_index + length + 1;
new = new + 2 * PRINTED_COMMAND_GROW_SIZE - 1;
new -= new % PRINTED_COMMAND_GROW_SIZE;
the_printed_command_size = new;
- thr_me->the_printed_command = xrealloc (thr_me->the_printed_command, the_printed_command_size);
+ the_printed_command = xrealloc (the_printed_command, the_printed_command_size);
}
}
Index: shell.c
===================================================================
RCS file: /cvsroot/winbash/winbash/shell.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- shell.c 10 Mar 2002 20:33:03 -0000 1.3
+++ shell.c 10 Mar 2002 21:45:13 -0000 1.4
@@ -190,7 +190,7 @@
static int quiet = 0; /* Be quiet when starting up. */
static int make_login_shell = 0; /* Make this shell be a `-bash' shell. */
-int no_line_editing = 0; /* Don't do fancy line editing. */
+int no_line_editing_private = 0; /* Don't do fancy line editing. */
int no_brace_expansion = 0; /* Non-zero means no foo{a,b} -> fooa foob. */
int posixly_correct = 0; /* Non-zero means posix.2 superset. */
@@ -211,7 +211,7 @@
{ "version", Int, &do_version, (char **)0x0 },
{ "quiet", Int, &quiet, (char **)0x0 },
{ "login", Int, &make_login_shell, (char **)0x0 },
- { "nolineediting", Int, &no_line_editing, (char **)0x0 },
+ { "nolineediting", Int, &no_line_editing_private, (char **)0x0 },
{ "nobraceexpansion", Int, &no_brace_expansion, (char **)0x0 },
{ "posix", Int, &posixly_correct, (char **)0x0 },
{ (char *)0x0, Int, (int *)0x0, (char **)0x0 }
@@ -318,7 +318,7 @@
/* Fix for the `infinite process creation' bug when running shell scripts
from startup files on System V. */
- thr_me->login_shell = make_login_shell = 0;
+ login_shell = make_login_shell = 0;
/* If this shell has already been run, then reinitialize it to a
vanilla state. */
@@ -344,14 +344,14 @@
yydebug = 0;
- thr_me->shell_environment = env;
+ shell_environment = env;
shell_name = argv[0];
dollar_vars[0] = savestring (shell_name);
if (*shell_name == '-')
{
shell_name++;
- thr_me->login_shell++;
+ login_shell++;
}
#if defined (JOB_CONTROL)
@@ -408,8 +408,8 @@
/* If user supplied the "-login" flag, then set and invert LOGIN_SHELL. */
if (make_login_shell)
{
- thr_me->login_shell++;
- thr_me->login_shell = -thr_me->login_shell;
+ login_shell++;
+ login_shell = -login_shell;
}
/* All done with full word options; do standard shell option parsing.*/
@@ -506,15 +506,15 @@
isatty (fileno (stdin)) && /* Input is a terminal and */
isatty (fileno (stdout)))) /* output is a terminal. */
{
- thr_me->interactive_shell = startup_state = thr_me->interactive = 1;
+ interactive_shell = startup_state = interactive = 1;
}
else
{
#if defined (HISTORY)
- history_expansion = thr_me->remember_on_history = 0;
+ history_expansion = remember_on_history = 0;
#endif /* HISTORY */
- thr_me->interactive_shell = startup_state = thr_me->interactive = 0;
- thr_me->no_line_editing = 1;
+ interactive_shell = startup_state = interactive = 0;
+ no_line_editing = 1;
#if defined (JOB_CONTROL)
job_control = 0;
#endif /* JOB_CONTROL */
@@ -531,7 +531,7 @@
* of the getpw* functions, and it's set to be open across execs. That
* means one for login, one for xterm, one for shelltool, etc.
*/
- if (thr_me->login_shell && thr_me->interactive_shell)
+ if (login_shell && interactive_shell)
{
for (i = 3; i < 20; i++)
close (i);
@@ -542,10 +542,10 @@
Variables from the environment are expected to be set, etc. */
shell_initialize ();
- if (thr_me->interactive_shell)
+ if (interactive_shell)
{
char *term = getenv ("TERM");
- thr_me->no_line_editing |= term && (STREQ (term, "emacs"));
+ no_line_editing |= term && (STREQ (term, "emacs"));
}
top_level_arg_index = arg_index;
@@ -574,18 +574,16 @@
/* Execute the start-up scripts. */
- if (!thr_me->interactive_shell)
+ if (!interactive_shell)
{
- makunbound ("PS1", thr_me->shell_variables);
- makunbound ("PS2", thr_me->shell_variables);
- thr_me->interactive = 0;
-
+ makunbound ("PS1", shell_variables);
+ makunbound ("PS2", shell_variables);
+ interactive = 0;
}
else
{
change_flag ('i', FLAG_ON);
- thr_me->interactive = 1;
-
+ interactive = 1;
}
if (!locally_skip_execution)
@@ -627,7 +625,7 @@
}
/* Do the things that should be done only for interactive shells. */
- if (thr_me->interactive_shell)
+ if (interactive_shell)
{
/* Set up for checking for presence of mail. */
remember_mail_dates ();
@@ -739,14 +737,14 @@
#endif /* !BUFFERED_INPUT */
- if (!thr_me->interactive_shell || (!isatty (fd)))
+ if (!interactive_shell || (!isatty (fd)))
{
#if defined (HISTORY)
history_expansion = 0;
- thr_me->remember_on_history = 0;
+ remember_on_history = 0;
#endif /* HISTORY */
- thr_me->interactive = thr_me->interactive_shell = 0;
- thr_me->no_line_editing = 1;
+ interactive = interactive_shell = 0;
+ no_line_editing = 1;
#if defined (JOB_CONTROL)
set_job_control (0);
@@ -761,7 +759,7 @@
fclose (default_input);
}
}
- else if (!thr_me->interactive)
+ else if (!interactive)
/* In this mode, bash is reading a script from stdin, which is a
pipe or redirected file. */
#if defined (BUFFERED_INPUT)
@@ -781,7 +779,7 @@
}
#if defined (BUFFERED_INPUT)
- if (!thr_me->interactive)
+ if (!interactive)
unset_nodelay_mode (default_buffered_input);
else
unset_nodelay_mode (fileno (stdin));
@@ -790,12 +788,12 @@
#endif /* !BUFFERED_INPUT */
/* with_input_from_stdin really means `with_input_from_readline' */
- if (thr_me->interactive && !thr_me->no_line_editing)
+ if (interactive && !no_line_editing)
with_input_from_stdin ();
else
#if defined (BUFFERED_INPUT)
{
- if (!thr_me->interactive)
+ if (!interactive)
with_input_from_buffered_stream (default_buffered_input, dollar_vars[0]);
else
with_input_from_stream (default_input, dollar_vars[0]);
@@ -816,14 +814,14 @@
exit_shell:
/* Do trap[0] if defined. */
if (signal_is_trapped (0))
- thr_me->last_command_exit_value = run_exit_trap ();
+ last_command_exit_value = run_exit_trap ();
#if defined (PROCESS_SUBSTITUTION)
unlink_fifo_list ();
#endif /* PROCESS_SUBSTITUTION */
#if defined (HISTORY)
- if (thr_me->interactive && thr_me->remember_on_history)
+ if (interactive && remember_on_history)
maybe_save_shell_history ();
#endif /* HISTORY */
@@ -847,12 +845,12 @@
#if defined (__NT_VC__)
{
- int last_command_exit_value = thr_me->last_command_exit_value;
+ int the_last_command_exit_value = last_command_exit_value;
nt_cleanup ();
#endif /* __NT_VC__ */
/* Always return the exit status of the last command to our parent. */
- exit (last_command_exit_value);
+ exit (the_last_command_exit_value);
#if defined (__NT_VC__)
}
#endif /* __NT_VC__ */
@@ -871,7 +869,7 @@
{
if (!posixly_correct)
{
- if (thr_me...
[truncated message content] |