2 * \brief Header: concurrent shell support
8 /*** typedefs(not structures) and defined constants **********************************************/
10 /* Used to distinguish between a normal MC termination and */
11 /* one caused by typing `exit' or `logout' in the subshell */
12 #define SUBSHELL_EXIT 128
14 #ifdef HAVE_SUBSHELL_SUPPORT
16 /*** enums ***************************************************************************************/
18 /* State of the subshell; see subshell.c for an explanation */
20 enum subshell_state_enum
21 { INACTIVE
, ACTIVE
, RUNNING_COMMAND
};
23 /* For the `how' argument to various functions */
27 /*** structures declarations (and typedefs of structures)*****************************************/
29 /*** global variables defined in .c file *********************************************************/
31 /* If using a subshell for evaluating commands this is true */
32 extern int use_subshell
;
34 /* File descriptor of the pseudoterminal used by the subshell */
35 extern int subshell_pty
;
37 extern enum subshell_state_enum subshell_state
;
39 /* Holds the latest prompt captured from the subshell */
40 extern char *subshell_prompt
;
42 /*** declarations of public functions ************************************************************/
44 void init_subshell (void);
45 int invoke_subshell (const char *command
, int how
, char **new_dir
);
46 int read_subshell_prompt (void);
47 void resize_subshell (void);
48 int exit_subshell (void);
49 void do_subshell_chdir (const char *directory
, int update_prompt
, int reset_prompt
);
50 void subshell_get_console_attributes (void);
51 void sigchld_handler (int sig
);
53 #else /* not HAVE_SUBSHELL_SUPPORT */
54 #define use_subshell 0
55 #endif /* not HAVE_SUBSHELL_SUPPORT */
57 /*** inline functions ****************************************************************************/
58 #endif /* MC__SUBSHELL_H */