Mercurial > octave
comparison libinterp/options.h @ 29898:dffd1c943f1a stable
main.cc: Use getopt to parse command line arguments (bug #60886).
* src/main.in.cc (main): Use getopt to parse command line arguments.
* libinterp/options-usage.h: Split into options.h and usage.h.
* libinterp/options.h (octave_getopt_options long_opts): Add command line
options "force-gui" and "no-gui-libs" to struct.
(grafted from bc19d9360bace492accb86414badda5ab9ba8cde)
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Sun, 18 Jul 2021 15:54:48 +0200 |
parents | libinterp/options-usage.h@0a5b15007766 |
children | 853e4b7ae0d5 |
comparison
equal
deleted
inserted
replaced
29883:0f6dc48a740e | 29898:dffd1c943f1a |
---|---|
1 //////////////////////////////////////////////////////////////////////// | |
2 // | |
3 // Copyright (C) 1993-2021 The Octave Project Developers | |
4 // | |
5 // See the file COPYRIGHT.md in the top-level directory of this | |
6 // distribution or <https://octave.org/copyright/>. | |
7 // | |
8 // This file is part of Octave. | |
9 // | |
10 // Octave is free software: you can redistribute it and/or modify it | |
11 // under the terms of the GNU General Public License as published by | |
12 // the Free Software Foundation, either version 3 of the License, or | |
13 // (at your option) any later version. | |
14 // | |
15 // Octave is distributed in the hope that it will be useful, but | |
16 // WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 // GNU General Public License for more details. | |
19 // | |
20 // You should have received a copy of the GNU General Public License | |
21 // along with Octave; see the file COPYING. If not, see | |
22 // <https://www.gnu.org/licenses/>. | |
23 // | |
24 //////////////////////////////////////////////////////////////////////// | |
25 | |
26 #if ! defined (octave_options_h) | |
27 #define octave_options_h 1 | |
28 | |
29 #include "octave-config.h" | |
30 | |
31 #include <iosfwd> | |
32 | |
33 // This is here so that it's more likely that the usage message and | |
34 // the real set of options will agree. Note: the '+' must come first | |
35 // to prevent getopt from permuting arguments! | |
36 static const char *short_opts = "+HWVdfhip:qvx"; | |
37 | |
38 | |
39 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC) | |
40 // Disable warning temporarily. | |
41 # pragma GCC diagnostic push | |
42 # pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" | |
43 #endif | |
44 | |
45 // Long options. See the comments in getopt.h for the meanings of the | |
46 // fields in this structure. | |
47 #define BUILT_IN_DOCSTRINGS_FILE_OPTION 1 | |
48 #define DOC_CACHE_FILE_OPTION 2 | |
49 #define EVAL_OPTION 3 | |
50 #define EXEC_PATH_OPTION 4 | |
51 #define GUI_OPTION 5 | |
52 #define IMAGE_PATH_OPTION 6 | |
53 #define INFO_FILE_OPTION 7 | |
54 #define INFO_PROG_OPTION 8 | |
55 #define DEBUG_JIT_OPTION 9 | |
56 #define JIT_COMPILER_OPTION 10 | |
57 #define LINE_EDITING_OPTION 11 | |
58 #define NO_GUI_OPTION 12 | |
59 #define NO_GUI_LIBS_OPTION 13 | |
60 #define NO_INIT_FILE_OPTION 14 | |
61 #define NO_INIT_PATH_OPTION 15 | |
62 #define NO_LINE_EDITING_OPTION 16 | |
63 #define NO_SITE_FILE_OPTION 17 | |
64 #define PERSIST_OPTION 18 | |
65 #define TEXI_MACROS_FILE_OPTION 19 | |
66 #define TRADITIONAL_OPTION 20 | |
67 struct octave_getopt_options long_opts[] = | |
68 { | |
69 { "braindead", octave_no_arg, 0, TRADITIONAL_OPTION }, | |
70 { "built-in-docstrings-file", octave_required_arg, 0, BUILT_IN_DOCSTRINGS_FILE_OPTION }, | |
71 { "debug", octave_no_arg, 0, 'd' }, | |
72 { "debug-jit", octave_no_arg, 0, DEBUG_JIT_OPTION }, | |
73 { "doc-cache-file", octave_required_arg, 0, DOC_CACHE_FILE_OPTION }, | |
74 { "echo-commands", octave_no_arg, 0, 'x' }, | |
75 { "eval", octave_required_arg, 0, EVAL_OPTION }, | |
76 { "exec-path", octave_required_arg, 0, EXEC_PATH_OPTION }, | |
77 { "force-gui", octave_no_arg, 0, GUI_OPTION }, | |
78 { "gui", octave_no_arg, 0, GUI_OPTION }, | |
79 { "help", octave_no_arg, 0, 'h' }, | |
80 { "image-path", octave_required_arg, 0, IMAGE_PATH_OPTION }, | |
81 { "info-file", octave_required_arg, 0, INFO_FILE_OPTION }, | |
82 { "info-program", octave_required_arg, 0, INFO_PROG_OPTION }, | |
83 { "interactive", octave_no_arg, 0, 'i' }, | |
84 { "jit-compiler", octave_no_arg, 0, JIT_COMPILER_OPTION }, | |
85 { "line-editing", octave_no_arg, 0, LINE_EDITING_OPTION }, | |
86 { "no-gui", octave_no_arg, 0, NO_GUI_OPTION }, | |
87 { "no-gui-libs", octave_no_arg, 0, NO_GUI_LIBS_OPTION }, | |
88 { "no-history", octave_no_arg, 0, 'H' }, | |
89 { "no-init-file", octave_no_arg, 0, NO_INIT_FILE_OPTION }, | |
90 { "no-init-path", octave_no_arg, 0, NO_INIT_PATH_OPTION }, | |
91 { "no-line-editing", octave_no_arg, 0, NO_LINE_EDITING_OPTION }, | |
92 { "no-site-file", octave_no_arg, 0, NO_SITE_FILE_OPTION }, | |
93 { "no-window-system", octave_no_arg, 0, 'W' }, | |
94 { "norc", octave_no_arg, 0, 'f' }, | |
95 { "path", octave_required_arg, 0, 'p' }, | |
96 { "persist", octave_no_arg, 0, PERSIST_OPTION }, | |
97 { "quiet", octave_no_arg, 0, 'q' }, | |
98 { "silent", octave_no_arg, 0, 'q' }, | |
99 { "texi-macros-file", octave_required_arg, 0, TEXI_MACROS_FILE_OPTION }, | |
100 { "traditional", octave_no_arg, 0, TRADITIONAL_OPTION }, | |
101 { "verbose", octave_no_arg, 0, 'V' }, | |
102 { "version", octave_no_arg, 0, 'v' }, | |
103 { 0, 0, 0, 0 } | |
104 }; | |
105 | |
106 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC) | |
107 // Restore prevailing warning state for remainder of the file. | |
108 # pragma GCC diagnostic pop | |
109 #endif | |
110 | |
111 #endif |