31 #if defined (HAVE_CONFIG_H) 47 #if ! defined (OCTAVE_VERSION) 48 # define OCTAVE_VERSION %OCTAVE_VERSION% 51 #if ! defined (OCTAVE_ARCHLIBDIR) 52 # define OCTAVE_ARCHLIBDIR %OCTAVE_ARCHLIBDIR% 55 #if ! defined (OCTAVE_BINDIR) 56 # define OCTAVE_BINDIR %OCTAVE_BINDIR% 59 #if ! defined (OCTAVE_PREFIX) 60 # define OCTAVE_PREFIX %OCTAVE_PREFIX% 63 #if ! defined (OCTAVE_EXEC_PREFIX) 64 # define OCTAVE_EXEC_PREFIX %OCTAVE_EXEC_PREFIX% 70 #if defined (HAVE_OCTAVE_QT_GUI) && ! defined (OCTAVE_USE_WINDOWS_API) 74 static pid_t gui_pid = 0;
76 static int caught_signal = -1;
79 gui_driver_sig_handler (
int sig)
86 gui_driver_set_signal_handler (
const char *signame,
99 gui_driver_set_signal_handler (
"SIGINT", gui_driver_sig_handler);
100 gui_driver_set_signal_handler (
"SIGBREAK", gui_driver_sig_handler);
101 gui_driver_set_signal_handler (
"SIGABRT", gui_driver_sig_handler);
102 gui_driver_set_signal_handler (
"SIGALRM", gui_driver_sig_handler);
103 gui_driver_set_signal_handler (
"SIGBUS", gui_driver_sig_handler);
109 gui_driver_set_signal_handler (
"SIGEMT", gui_driver_sig_handler);
110 gui_driver_set_signal_handler (
"SIGFPE", gui_driver_sig_handler);
111 gui_driver_set_signal_handler (
"SIGHUP", gui_driver_sig_handler);
112 gui_driver_set_signal_handler (
"SIGILL", gui_driver_sig_handler);
117 gui_driver_set_signal_handler (
"SIGIOT", gui_driver_sig_handler);
118 gui_driver_set_signal_handler (
"SIGLOST", gui_driver_sig_handler);
119 gui_driver_set_signal_handler (
"SIGPIPE", gui_driver_sig_handler);
120 gui_driver_set_signal_handler (
"SIGPOLL", gui_driver_sig_handler);
125 gui_driver_set_signal_handler (
"SIGQUIT", gui_driver_sig_handler);
126 gui_driver_set_signal_handler (
"SIGSEGV", gui_driver_sig_handler);
130 gui_driver_set_signal_handler (
"SIGSYS", gui_driver_sig_handler);
131 gui_driver_set_signal_handler (
"SIGTERM", gui_driver_sig_handler);
132 gui_driver_set_signal_handler (
"SIGTRAP", gui_driver_sig_handler);
139 gui_driver_set_signal_handler (
"SIGUSR1", gui_driver_sig_handler);
140 gui_driver_set_signal_handler (
"SIGUSR2", gui_driver_sig_handler);
141 gui_driver_set_signal_handler (
"SIGVTALRM", gui_driver_sig_handler);
142 gui_driver_set_signal_handler (
"SIGIO", gui_driver_sig_handler);
146 gui_driver_set_signal_handler (
"SIGXCPU", gui_driver_sig_handler);
147 gui_driver_set_signal_handler (
"SIGXFSZ", gui_driver_sig_handler);
184 std::cerr <<
argv[0] <<
": failed to exec '" <<
file <<
"'" << std::endl;
196 char *
tmp =
new char [len+1];
206 bool start_gui =
false;
207 bool gui_libs =
true;
217 #if defined (HAVE_OCTAVE_QT_GUI) 229 static char **new_argv =
new char * [
argc + 1];
233 bool warn_display =
true;
234 bool no_display =
false;
271 warn_display =
false;
286 for (
size_t j = 1; j < len; j++)
293 warn_display =
false;
312 std::cerr <<
"octave: conflicting options: --no-gui-libs and --gui" 317 #if ! defined (HAVE_OCTAVE_QT_GUI) 318 std::cerr <<
"octave: GUI features missing or disabled in this build" 324 new_argv[
k] =
nullptr;
333 else if (gui_libs || start_gui)
348 if (! display_check_err_msg)
349 display_check_err_msg =
"graphical display unavailable";
351 std::cerr <<
"octave: " << display_check_err_msg << std::endl;
352 std::cerr <<
"octave: disabling GUI features" << std::endl;
357 #if defined (OCTAVE_USE_WINDOWS_API) 373 #if defined (HAVE_OCTAVE_QT_GUI) && ! defined (OCTAVE_USE_WINDOWS_API) 375 if (gui_libs && start_gui)
391 std::cerr <<
"octave: fork failed!" << std::endl;
395 else if (gui_pid == 0)
401 std::cerr <<
"octave: error calling setsid!" << std::endl;
422 if (caught_signal > 0)
424 int sig = caught_signal;
437 std::cerr <<
"octave exited with signal " 449 std::cerr <<
argv[0] <<
": " << std::strerror (errno) << std::endl;
457 std::cerr <<
argv[0] <<
": " << std::strerror (errno) << std::endl;
static void set_octave_home(void)
bool octave_wifsignaled_wrapper(int status)
For example cd octave end example noindent changes the current working directory to file
static std::string prepend_octave_exec_home(const std::string &s)
#define OCTAVE_ARCHLIBDIR
bool octave_wifexited_wrapper(int status)
int octave_kill_wrapper(pid_t pid, int signum)
const char * display_available(int *dpy_avail)
void octave_sig_handler(int)
static int octave_exec(const std::string &file, char **argv)
int octave_wtermsig_wrapper(int status)
int main(int argc, char **argv)
bool strcmp(const T &str_a, const T &str_b)
True if strings are the same.
static const char dir_sep_char
pid_t octave_fork_wrapper(void)
pid_t octave_setsid_wrapper(void)
T::size_type strlen(const typename T::value_type *str)
int octave_wexitstatus_wrapper(int status)
void octave_unblock_async_signals(void)
static std::string get_octave_bindir(void)
static char * strsave(const char *s)
void octave_block_async_signals(void)
static std::string octave_getenv(const std::string &name)
int octave_execv_wrapper(const char *file, char *const *argv)
pid_t octave_waitpid_wrapper(pid_t pid, int *statusp, int options)
static std::string get_octave_archlibdir(void)
octave_sig_handler * octave_set_signal_handler_by_name(const char *signame, octave_sig_handler *handler, bool restart_syscalls)
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
void install_signal_handlers(void)