Merge branch '2275_ignore_relative_dirs'
[midnight-commander/osp/podlajak.git] / src / subshell.h
blobabfe174f950b17aeae724902f7c27f5139ed1a22
1 /** \file subshell.h
2 * \brief Header: concurrent shell support
3 */
5 #ifndef MC__SUBSHELL_H
6 #define MC__SUBSHELL_H
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
22 INACTIVE,
23 ACTIVE,
24 RUNNING_COMMAND
27 /* For the `how' argument to various functions */
28 enum
30 QUIETLY,
31 VISIBLY
34 /*** structures declarations (and typedefs of structures)*****************************************/
36 /*** global variables defined in .c file *********************************************************/
38 /* If using a subshell for evaluating commands this is true */
39 extern int use_subshell;
41 /* File descriptor of the pseudoterminal used by the subshell */
42 extern int subshell_pty;
44 extern enum subshell_state_enum subshell_state;
46 /* Holds the latest prompt captured from the subshell */
47 extern char *subshell_prompt;
49 extern gboolean update_subshell_prompt;
51 /*** declarations of public functions ************************************************************/
53 void init_subshell (void);
54 int invoke_subshell (const char *command, int how, char **new_dir);
55 int read_subshell_prompt (void);
56 void do_update_prompt (void);
57 void resize_subshell (void);
58 int exit_subshell (void);
59 void do_subshell_chdir (const char *directory, gboolean update_prompt, gboolean reset_prompt);
60 void subshell_get_console_attributes (void);
61 void sigchld_handler (int sig);
63 #else /* not HAVE_SUBSHELL_SUPPORT */
64 #define use_subshell 0
65 #endif /* HAVE_SUBSHELL_SUPPORT */
67 /*** inline functions ****************************************************************************/
69 #endif /* MC__SUBSHELL_H */