Merge branch '3205_eta'
[midnight-commander.git] / src / subshell / proxyfunc.c
blobb1c20a9b912056e1e1dad8fa8272e09d7d4603b8
1 /*
2 Proxy functions for getting access to public variables into 'filemanager' module.
4 Copyright (C) 2015-2024
5 Free Software Foundation, Inc.
7 Written by:
8 Slava Zanko <slavazanko@gmail.com>, 2015.
10 This file is part of the Midnight Commander.
12 The Midnight Commander is free software: you can redistribute it
13 and/or modify it under the terms of the GNU General Public License as
14 published by the Free Software Foundation, either version 3 of the License,
15 or (at your option) any later version.
17 The Midnight Commander is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program. If not, see <http://www.gnu.org/licenses/>.
26 #include <config.h>
28 #include <signal.h> /* kill() */
29 #include <sys/types.h>
30 #include <sys/wait.h> /* waitpid() */
32 #include "lib/global.h"
34 #include "lib/vfs/vfs.h" /* vfs_get_raw_current_dir() */
36 #include "src/setup.h" /* quit */
37 #include "src/filemanager/filemanager.h" /* current_panel */
38 #include "src/consaver/cons.saver.h" /* handle_console() */
40 #include "internal.h"
42 /*** global variables ****************************************************************************/
44 /* path to X clipboard utility */
46 /*** file scope macro definitions ****************************************************************/
48 /*** file scope type declarations ****************************************************************/
50 /*** file scope variables ************************************************************************/
52 /* --------------------------------------------------------------------------------------------- */
53 /*** file scope functions ************************************************************************/
54 /* --------------------------------------------------------------------------------------------- */
56 /* --------------------------------------------------------------------------------------------- */
57 /*** public functions ****************************************************************************/
58 /* --------------------------------------------------------------------------------------------- */
60 const vfs_path_t *
61 subshell_get_cwd (void)
63 if (mc_global.mc_run_mode == MC_RUN_FULL)
64 return current_panel->cwd_vpath;
66 return vfs_get_raw_current_dir ();
69 /* --------------------------------------------------------------------------------------------- */
71 void
72 subshell_handle_cons_saver (void)
74 #ifdef __linux__
75 int status;
76 pid_t pid;
78 pid = waitpid (cons_saver_pid, &status, WUNTRACED | WNOHANG);
80 if (pid == cons_saver_pid)
83 if (WIFSTOPPED (status))
84 /* Someone has stopped cons.saver - restart it */
85 kill (pid, SIGCONT);
86 else
88 /* cons.saver has died - disable console saving */
89 handle_console (CONSOLE_DONE);
90 mc_global.tty.console_flag = '\0';
94 #endif /* __linux__ */
97 /* --------------------------------------------------------------------------------------------- */
99 int
100 subshell_get_mainloop_quit (void)
102 return quit;
105 /* --------------------------------------------------------------------------------------------- */
107 void
108 subshell_set_mainloop_quit (const int param_quit)
110 quit = param_quit;
113 /* --------------------------------------------------------------------------------------------- */