Merge branch '2121_dir_symlink'
[kaloumi3.git] / src / subshell.h
blob6bb003a4ae9f7c9446c6159e82c2b5ea3cd71dcd
2 /** \file subshell.h
3 * \brief Header: concurrent shell support
4 */
6 #ifndef MC_SUBSHELL_H
7 #define MC_SUBSHELL_H
9 /* Used to distinguish between a normal MC termination and */
10 /* one caused by typing `exit' or `logout' in the subshell */
11 #define SUBSHELL_EXIT 128
13 #ifdef HAVE_SUBSHELL_SUPPORT
15 /* If using a subshell for evaluating commands this is true */
16 extern int use_subshell;
18 /* File descriptor of the pseudoterminal used by the subshell */
19 extern int subshell_pty;
21 /* State of the subshell; see subshell.c for an explanation */
22 enum subshell_state_enum {INACTIVE, ACTIVE, RUNNING_COMMAND};
23 extern enum subshell_state_enum subshell_state;
25 /* Holds the latest prompt captured from the subshell */
26 extern char *subshell_prompt;
28 /* For the `how' argument to various functions */
29 enum {QUIETLY, VISIBLY};
31 /* Exported functions */
32 void init_subshell (void);
33 int invoke_subshell (const char *command, int how, char **new_dir);
34 int read_subshell_prompt (void);
35 void resize_subshell (void);
36 int exit_subshell (void);
37 void do_subshell_chdir (const char *directory, int update_prompt, int reset_prompt);
38 void subshell_get_console_attributes (void);
39 void sigchld_handler (int sig);
41 #else
42 #define use_subshell 0
43 #endif /* not HAVE_SUBSHELL_SUPPORT */
45 #endif