Midnight Commander for Win32
[reactos.git] / rosapps / mc / src / subshell.h
1 #ifndef __SUBSHELL_H
2 #define __SUBSHELL_H
3
4 /* Used to distinguish between a normal MC termination and */
5 /* one caused by typing `exit' or `logout' in the subshell */
6 #define SUBSHELL_EXIT 128
7
8 #ifdef HAVE_SUBSHELL_SUPPORT
9
10 /* If using a subshell for evaluating commands this is true */
11 extern int use_subshell;
12
13 /* File descriptor of the pseudoterminal used by the subshell */
14 extern int subshell_pty;
15
16 /* If true, the child forked in init_subshell will wait in a loop to be attached by gdb */
17 extern int debug_subshell;
18
19 /* The key to switch back to MC from the subshell */
20 extern char subshell_switch_key;
21
22 /* State of the subshell; see subshell.c for an explanation */
23 enum subshell_state_enum {INACTIVE, ACTIVE, RUNNING_COMMAND};
24 extern enum subshell_state_enum subshell_state;
25
26 /* Holds the latest prompt captured from the subshell */
27 extern char *subshell_prompt;
28
29 /* For the `how' argument to various functions */
30 enum {QUIETLY, VISIBLY};
31
32 /* Exported functions */
33 void init_subshell (void);
34 int invoke_subshell (const char *command, int how, char **new_dir);
35 int read_subshell_prompt (int how);
36 void resize_subshell (void);
37 int exit_subshell (void);
38 void do_subshell_chdir (char *command, int update_prompt, int reset_prompt);
39 void subshell_get_console_attributes (void);
40 void sigchld_handler (int sig);
41
42 #else
43 #define use_subshell 0
44 #endif /* not HAVE_SUBSHELL_SUPPORT */
45
46 #endif /* __SUBSHELL_H */