Mercurial > octave-nkf
comparison libinterp/octave.cc @ 17568:1b388d922e6b
provide --no-fork command line option
* octave.cc (no_fork_option): New static varaible.
(NO_FORK_OPTION): New macro.
(long_opts): Include it in the list.
(usage_string, verbose_usage): Update for new --no-fork option.
(octave_process_command_line): Handle NO_FORK_OPTION case.
* octave-gui.h, octave-gui.cc (octave_start_gui): New arg, fork.
Don't call dissociate_terminal if fork is false.
* octave.h, octave.cc (octave_fork_gui): New function.
* main.cc (main): Use it to pass --no-fork option to gui.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 04 Oct 2013 13:53:25 -0400 |
parents | 7542f4496974 |
children | 1c7d768c3847 |
comparison
equal
deleted
inserted
replaced
17567:0b3cf264ec2f | 17568:1b388d922e6b |
---|---|
123 | 123 |
124 // If TRUE, force the GUI to start. | 124 // If TRUE, force the GUI to start. |
125 // (--force-gui) | 125 // (--force-gui) |
126 static bool force_gui_option = false; | 126 static bool force_gui_option = false; |
127 | 127 |
128 // If TRUE don't fork when starting the GUI. | |
129 // (--no-fork) | |
130 static bool no_fork_option = false; | |
131 | |
128 // If TRUE don't start the GUI. | 132 // If TRUE don't start the GUI. |
129 // (--no-gui) | 133 // (--no-gui) |
130 static bool no_gui_option = false; | 134 static bool no_gui_option = false; |
131 | 135 |
132 // If TRUE, force readline command line editing. | 136 // If TRUE, force readline command line editing. |
157 static const char *usage_string = | 161 static const char *usage_string = |
158 "octave [-HVWdfhiqvx] [--debug] [--debug-jit] [--doc-cache-file file]\n\ | 162 "octave [-HVWdfhiqvx] [--debug] [--debug-jit] [--doc-cache-file file]\n\ |
159 [--echo-commands] [--eval CODE] [--exec-path path]\n\ | 163 [--echo-commands] [--eval CODE] [--exec-path path]\n\ |
160 [--force-gui] [--help] [--image-path path]\n\ | 164 [--force-gui] [--help] [--image-path path]\n\ |
161 [--info-file file] [--info-program prog] [--interactive]\n\ | 165 [--info-file file] [--info-program prog] [--interactive]\n\ |
162 [--line-editing] [--no-gui] [--no-history]\n\ | 166 [--line-editing] [--no-fork] [--no-gui] [--no-history]\n\ |
163 [--no-init-file] [--no-init-path] [--no-jit-compiler]\n\ | 167 [--no-init-file] [--no-init-path] [--no-jit-compiler]\n\ |
164 [--no-line-editing] [--no-site-file] [--no-window-system]\n\ | 168 [--no-line-editing] [--no-site-file] [--no-window-system]\n\ |
165 [--norc] [-p path] [--path path] [--persist] [--silent]\n\ | 169 [--norc] [-p path] [--path path] [--persist] [--silent]\n\ |
166 [--traditional] [--verbose] [--version] [file]"; | 170 [--traditional] [--verbose] [--version] [file]"; |
167 | 171 |
192 #define IMAGE_PATH_OPTION 6 | 196 #define IMAGE_PATH_OPTION 6 |
193 #define INFO_FILE_OPTION 7 | 197 #define INFO_FILE_OPTION 7 |
194 #define INFO_PROG_OPTION 8 | 198 #define INFO_PROG_OPTION 8 |
195 #define DEBUG_JIT_OPTION 9 | 199 #define DEBUG_JIT_OPTION 9 |
196 #define LINE_EDITING_OPTION 10 | 200 #define LINE_EDITING_OPTION 10 |
197 #define NO_GUI_OPTION 11 | 201 #define NO_FORK_OPTION 11 |
198 #define NO_INIT_FILE_OPTION 12 | 202 #define NO_GUI_OPTION 12 |
199 #define NO_INIT_PATH_OPTION 13 | 203 #define NO_INIT_FILE_OPTION 13 |
200 #define NO_JIT_COMPILER_OPTION 14 | 204 #define NO_INIT_PATH_OPTION 14 |
201 #define NO_LINE_EDITING_OPTION 15 | 205 #define NO_JIT_COMPILER_OPTION 15 |
202 #define NO_SITE_FILE_OPTION 16 | 206 #define NO_LINE_EDITING_OPTION 16 |
203 #define PERSIST_OPTION 17 | 207 #define NO_SITE_FILE_OPTION 17 |
204 #define TEXI_MACROS_FILE_OPTION 18 | 208 #define PERSIST_OPTION 18 |
205 #define TRADITIONAL_OPTION 19 | 209 #define TEXI_MACROS_FILE_OPTION 19 |
210 #define TRADITIONAL_OPTION 20 | |
206 struct option long_opts[] = { | 211 struct option long_opts[] = { |
207 { "braindead", no_argument, 0, TRADITIONAL_OPTION }, | 212 { "braindead", no_argument, 0, TRADITIONAL_OPTION }, |
208 { "built-in-docstrings-file", required_argument, 0, BUILT_IN_DOCSTRINGS_FILE_OPTION }, | 213 { "built-in-docstrings-file", required_argument, 0, BUILT_IN_DOCSTRINGS_FILE_OPTION }, |
209 { "debug", no_argument, 0, 'd' }, | 214 { "debug", no_argument, 0, 'd' }, |
210 { "debug-jit", no_argument, 0, DEBUG_JIT_OPTION }, | 215 { "debug-jit", no_argument, 0, DEBUG_JIT_OPTION }, |
217 { "image-path", required_argument, 0, IMAGE_PATH_OPTION }, | 222 { "image-path", required_argument, 0, IMAGE_PATH_OPTION }, |
218 { "info-file", required_argument, 0, INFO_FILE_OPTION }, | 223 { "info-file", required_argument, 0, INFO_FILE_OPTION }, |
219 { "info-program", required_argument, 0, INFO_PROG_OPTION }, | 224 { "info-program", required_argument, 0, INFO_PROG_OPTION }, |
220 { "interactive", no_argument, 0, 'i' }, | 225 { "interactive", no_argument, 0, 'i' }, |
221 { "line-editing", no_argument, 0, LINE_EDITING_OPTION }, | 226 { "line-editing", no_argument, 0, LINE_EDITING_OPTION }, |
227 { "no-fork", no_argument, 0, NO_FORK_OPTION }, | |
222 { "no-gui", no_argument, 0, NO_GUI_OPTION }, | 228 { "no-gui", no_argument, 0, NO_GUI_OPTION }, |
223 { "no-history", no_argument, 0, 'H' }, | 229 { "no-history", no_argument, 0, 'H' }, |
224 { "no-init-file", no_argument, 0, NO_INIT_FILE_OPTION }, | 230 { "no-init-file", no_argument, 0, NO_INIT_FILE_OPTION }, |
225 { "no-init-path", no_argument, 0, NO_INIT_PATH_OPTION }, | 231 { "no-init-path", no_argument, 0, NO_INIT_PATH_OPTION }, |
226 { "no-jit-compiler", no_argument, 0, NO_JIT_COMPILER_OPTION }, | 232 { "no-jit-compiler", no_argument, 0, NO_JIT_COMPILER_OPTION }, |
535 --image-path PATH Add PATH to head of image search path.\n\ | 541 --image-path PATH Add PATH to head of image search path.\n\ |
536 --info-file FILE Use top-level info file FILE.\n\ | 542 --info-file FILE Use top-level info file FILE.\n\ |
537 --info-program PROGRAM Use PROGRAM for reading info files.\n\ | 543 --info-program PROGRAM Use PROGRAM for reading info files.\n\ |
538 --interactive, -i Force interactive behavior.\n\ | 544 --interactive, -i Force interactive behavior.\n\ |
539 --line-editing Force readline use for command-line editing.\n\ | 545 --line-editing Force readline use for command-line editing.\n\ |
546 --no-fork Don't fork when starting the graphical user interface.\n\ | |
540 --no-gui Disable the graphical user interface.\n\ | 547 --no-gui Disable the graphical user interface.\n\ |
541 --no-history, -H Don't save commands to the history list\n\ | 548 --no-history, -H Don't save commands to the history list\n\ |
542 --no-init-file Don't read the ~/.octaverc or .octaverc files.\n\ | 549 --no-init-file Don't read the ~/.octaverc or .octaverc files.\n\ |
543 --no-init-path Don't initialize function search path.\n\ | 550 --no-init-path Don't initialize function search path.\n\ |
544 --no-jit-compiler Disable the JIT compiler.\n\ | 551 --no-jit-compiler Disable the JIT compiler.\n\ |
785 | 792 |
786 case LINE_EDITING_OPTION: | 793 case LINE_EDITING_OPTION: |
787 forced_line_editing = true; | 794 forced_line_editing = true; |
788 break; | 795 break; |
789 | 796 |
797 case NO_FORK_OPTION: | |
798 no_fork_option = true; | |
799 break; | |
800 | |
790 case NO_GUI_OPTION: | 801 case NO_GUI_OPTION: |
791 no_gui_option = true; | 802 no_gui_option = true; |
792 break; | 803 break; |
793 | 804 |
794 case NO_INIT_FILE_OPTION: | 805 case NO_INIT_FILE_OPTION: |
1067 int | 1078 int |
1068 octave_starting_gui (void) | 1079 octave_starting_gui (void) |
1069 { | 1080 { |
1070 start_gui = check_starting_gui (); | 1081 start_gui = check_starting_gui (); |
1071 return start_gui; | 1082 return start_gui; |
1083 } | |
1084 | |
1085 int | |
1086 octave_fork_gui (void) | |
1087 { | |
1088 return ! no_fork_option; | |
1072 } | 1089 } |
1073 | 1090 |
1074 DEFUN (isguirunning, args, , | 1091 DEFUN (isguirunning, args, , |
1075 "-*- texinfo -*-\n\ | 1092 "-*- texinfo -*-\n\ |
1076 @deftypefn {Built-in Function} {} isguirunning ()\n\ | 1093 @deftypefn {Built-in Function} {} isguirunning ()\n\ |