Lines 139-144
Link Here
|
139 |
current_command_number++; |
139 |
current_command_number++; |
140 |
|
140 |
|
141 |
executing = 1; |
141 |
executing = 1; |
|
|
142 |
export_command(current_command); |
143 |
preexec_command (); |
142 |
stdin_redir = 0; |
144 |
stdin_redir = 0; |
143 |
execute_command (current_command); |
145 |
execute_command (current_command); |
144 |
|
146 |
|
Lines 222-227
Link Here
|
222 |
return (r); |
224 |
return (r); |
223 |
} |
225 |
} |
224 |
|
226 |
|
|
|
227 |
/* This is where PREEXEC_COMMAND is executed */ |
228 |
|
229 |
void |
230 |
preexec_command () |
231 |
{ |
232 |
char *command_to_execute; |
233 |
|
234 |
need_here_doc = 0; |
235 |
run_pending_traps (); |
236 |
|
237 |
if (interactive && bash_input.type != st_string) |
238 |
{ |
239 |
command_to_execute = get_string_value ("PREEXEC_COMMAND"); |
240 |
if (command_to_execute) |
241 |
execute_prompt_command (command_to_execute); |
242 |
|
243 |
if (running_under_emacs == 2) |
244 |
send_pwd_to_eterm (); /* Yuck */ |
245 |
} |
246 |
} |
247 |
|
225 |
/* Read and parse a command, returning the status of the parse. The command |
248 |
/* Read and parse a command, returning the status of the parse. The command |
226 |
is left in the globval variable GLOBAL_COMMAND for use by reader_loop. |
249 |
is left in the globval variable GLOBAL_COMMAND for use by reader_loop. |
227 |
This is where the shell timeout code is executed. */ |
250 |
This is where the shell timeout code is executed. */ |
Lines 268-270
Link Here
|
268 |
|
293 |
|
269 |
return (result); |
294 |
return (result); |
270 |
} |
295 |
} |
|
|
296 |
|
297 |
/* export_command makes an array "CMD" and fills its fields |
298 |
with the command line of "command" (only for cm_simple, |
299 |
for cm_connection the last command in the chain is used */ |
300 |
|
301 |
void |
302 |
export_command (command) |
303 |
COMMAND *command; |
304 |
{ |
305 |
int i = 0; |
306 |
SHELL_VAR *cmd_var; |
307 |
ARRAY *cmd_array; |
308 |
WORD_LIST *list; |
309 |
|
310 |
if(command->type == cm_simple) |
311 |
list = command->value.Simple->words; |
312 |
else if(command->type == cm_connection) |
313 |
{ |
314 |
if(!command->value.Connection->second) |
315 |
return; |
316 |
if(command->flags == CMD_FORCE_SUBSHELL) |
317 |
command = command->value.Connection->first; |
318 |
return; |
319 |
while(command->type == cm_connection) |
320 |
command = command->value.Connection->second; |
321 |
if(command->type == cm_simple) |
322 |
list = command->value.Simple->words; |
323 |
else |
324 |
return; |
325 |
} |
326 |
else |
327 |
return; |
328 |
|
329 |
cmd_var = make_new_array_variable ("CMD"); |
330 |
cmd_array = array_cell (cmd_var); |
331 |
|
332 |
while(list) |
333 |
{ |
334 |
array_insert (cmd_array, i, list->word->word); |
335 |
list=list->next; |
336 |
i++; |
337 |
} |
338 |
|
339 |
VSETATTR (cmd_var, (att_exported)); |
340 |
} |