From ffccd5b2b05243e7976db80f90f453dccfae9886 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 22:22:03 +0200 Subject: Adding upstream version 3:4.8.30. Signed-off-by: Daniel Baumann --- src/subshell/proxyfunc.c | 113 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 src/subshell/proxyfunc.c (limited to 'src/subshell/proxyfunc.c') diff --git a/src/subshell/proxyfunc.c b/src/subshell/proxyfunc.c new file mode 100644 index 0000000..3f180d3 --- /dev/null +++ b/src/subshell/proxyfunc.c @@ -0,0 +1,113 @@ +/* + Proxy functions for getting access to public variables into 'filemanager' module. + + Copyright (C) 2015-2023 + Free Software Foundation, Inc. + + Written by: + Slava Zanko , 2015. + + This file is part of the Midnight Commander. + + The Midnight Commander is free software: you can redistribute it + and/or modify it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + The Midnight Commander is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#include + +#include /* kill() */ +#include +#include /* waitpid() */ + +#include "lib/global.h" + +#include "lib/vfs/vfs.h" /* vfs_get_raw_current_dir() */ + +#include "src/setup.h" /* quit */ +#include "src/filemanager/filemanager.h" /* current_panel */ +#include "src/consaver/cons.saver.h" /* handle_console() */ + +#include "internal.h" + +/*** global variables ****************************************************************************/ + +/* path to X clipboard utility */ + +/*** file scope macro definitions ****************************************************************/ + +/*** file scope type declarations ****************************************************************/ + +/*** file scope variables ************************************************************************/ + +/* --------------------------------------------------------------------------------------------- */ +/*** file scope functions ************************************************************************/ +/* --------------------------------------------------------------------------------------------- */ + +/* --------------------------------------------------------------------------------------------- */ +/*** public functions ****************************************************************************/ +/* --------------------------------------------------------------------------------------------- */ + +const vfs_path_t * +subshell_get_cwd (void) +{ + if (mc_global.mc_run_mode == MC_RUN_FULL) + return current_panel->cwd_vpath; + + return vfs_get_raw_current_dir (); +} + +/* --------------------------------------------------------------------------------------------- */ + +void +subshell_handle_cons_saver (void) +{ +#ifdef __linux__ + int status; + pid_t pid; + + pid = waitpid (cons_saver_pid, &status, WUNTRACED | WNOHANG); + + if (pid == cons_saver_pid) + { + + if (WIFSTOPPED (status)) + /* Someone has stopped cons.saver - restart it */ + kill (pid, SIGCONT); + else + { + /* cons.saver has died - disable console saving */ + handle_console (CONSOLE_DONE); + mc_global.tty.console_flag = '\0'; + } + + } +#endif /* __linux__ */ +} + +/* --------------------------------------------------------------------------------------------- */ + +int +subshell_get_mainloop_quit (void) +{ + return quit; +} + +/* --------------------------------------------------------------------------------------------- */ + +void +subshell_set_mainloop_quit (const int param_quit) +{ + quit = param_quit; +} + +/* --------------------------------------------------------------------------------------------- */ -- cgit v1.2.3