Consistently quote variables used with "test"
[deliverable/binutils-gdb.git] / gdb / maint-test-settings.c
CommitLineData
d1fcf2fd 1/* Maintenance commands for testing the settings framework.
dca0f6c0
PA
2
3 Copyright (C) 2019 Free Software Foundation, Inc.
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20
21#include "defs.h"
22#include "gdbcmd.h"
23
c6ac8931
PA
24/* Command list for "maint set test-settings". */
25static cmd_list_element *maintenance_set_test_settings_list;
dca0f6c0 26
c6ac8931
PA
27/* Command list for "maint show test-settings". */
28static cmd_list_element *maintenance_show_test_settings_list;
dca0f6c0 29
c6ac8931 30/* The "maintenance set test-settings" prefix command. */
dca0f6c0
PA
31
32static void
c6ac8931 33maintenance_set_test_settings_cmd (const char *args, int from_tty)
dca0f6c0 34{
c6ac8931 35 printf_unfiltered (_("\"maintenance set test-settings\" must be followed "
dca0f6c0 36 "by the name of a set command.\n"));
c6ac8931
PA
37 help_list (maintenance_set_test_settings_list,
38 "maintenance set test-settings ",
dca0f6c0
PA
39 all_commands, gdb_stdout);
40}
41
c6ac8931 42/* The "maintenance show test-settings" prefix command. */
dca0f6c0
PA
43
44static void
c6ac8931 45maintenance_show_test_settings_cmd (const char *args, int from_tty)
dca0f6c0 46{
c6ac8931 47 cmd_show_list (maintenance_show_test_settings_list, from_tty, "");
dca0f6c0
PA
48}
49
c6ac8931 50/* Control variables for all the "maintenance set/show test-settings
dca0f6c0
PA
51 xxx" commands. */
52
491144b5 53static bool maintenance_test_settings_boolean;
dca0f6c0
PA
54
55static auto_boolean maintenance_test_settings_auto_boolean = AUTO_BOOLEAN_AUTO;
56
57static unsigned int maintenance_test_settings_uinteger;
58
59static int maintenance_test_settings_integer;
60
61static int maintenance_test_settings_zinteger;
62
63static unsigned int maintenance_test_settings_zuinteger;
64
65static int maintenance_test_settings_zuinteger_unlimited;
66
67static char *maintenance_test_settings_string;
68
69static char *maintenance_test_settings_string_noescape;
70
71static char *maintenance_test_settings_optional_filename;
72
73static char *maintenance_test_settings_filename;
74
c6ac8931 75/* Enum values for the "maintenance set/show test-settings boolean"
dca0f6c0 76 commands. */
970f9d09
PA
77static const char maintenance_test_settings_xxx[] = "xxx";
78static const char maintenance_test_settings_yyy[] = "yyy";
79static const char maintenance_test_settings_zzz[] = "zzz";
80
dca0f6c0 81static const char *const maintenance_test_settings_enums[] = {
970f9d09
PA
82 maintenance_test_settings_xxx,
83 maintenance_test_settings_yyy,
84 maintenance_test_settings_zzz,
85 nullptr
dca0f6c0
PA
86};
87
970f9d09
PA
88static const char *maintenance_test_settings_enum
89 = maintenance_test_settings_xxx;
90
c6ac8931 91/* The "maintenance show test-settings xxx" commands. */
dca0f6c0
PA
92
93static void
c6ac8931 94maintenance_show_test_settings_value_cmd
dca0f6c0
PA
95 (struct ui_file *file, int from_tty,
96 struct cmd_list_element *c, const char *value)
97{
98 fprintf_filtered (file, (("%s\n")), value);
99}
100
101\f
102void
103_initialize_maint_test_settings (void)
104{
970f9d09
PA
105 maintenance_test_settings_filename = xstrdup ("/foo/bar");
106
c6ac8931
PA
107 add_prefix_cmd ("test-settings", class_maintenance,
108 maintenance_set_test_settings_cmd, _("\
dca0f6c0 109Set GDB internal variables used for set/show command infrastructure testing."),
c6ac8931
PA
110 &maintenance_set_test_settings_list,
111 "maintenance set test-settings ",
dca0f6c0 112 0/*allow-unknown*/,
c6ac8931 113 &maintenance_set_cmdlist);
dca0f6c0 114
c6ac8931
PA
115 add_prefix_cmd ("test-settings", class_maintenance,
116 maintenance_show_test_settings_cmd, _("\
dca0f6c0 117Show GDB internal variables used for set/show command infrastructure testing."),
c6ac8931
PA
118 &maintenance_show_test_settings_list,
119 "maintenance show test-settings ",
dca0f6c0 120 0/*allow-unknown*/,
c6ac8931 121 &maintenance_show_cmdlist);
dca0f6c0
PA
122
123 add_setshow_boolean_cmd ("boolean", class_maintenance,
124 &maintenance_test_settings_boolean, _("\
590042fc
PW
125command used for internal testing."), _("\
126command used for internal testing."),
dca0f6c0
PA
127 nullptr, /* help_doc */
128 nullptr, /* set_cmd */
c6ac8931
PA
129 maintenance_show_test_settings_value_cmd,
130 &maintenance_set_test_settings_list,
131 &maintenance_show_test_settings_list);
dca0f6c0
PA
132
133 add_setshow_auto_boolean_cmd ("auto-boolean", class_maintenance,
134 &maintenance_test_settings_auto_boolean, _("\
590042fc
PW
135command used for internal testing."), _("\
136command used for internal testing."),
dca0f6c0
PA
137 nullptr, /* help_doc */
138 nullptr, /* set_cmd */
c6ac8931
PA
139 maintenance_show_test_settings_value_cmd,
140 &maintenance_set_test_settings_list,
141 &maintenance_show_test_settings_list);
dca0f6c0
PA
142
143 add_setshow_uinteger_cmd ("uinteger", class_maintenance,
144 &maintenance_test_settings_uinteger, _("\
590042fc
PW
145command used for internal testing."), _("\
146command used for internal testing."),
c6ac8931
PA
147 nullptr, /* help_doc */
148 nullptr, /* set_cmd */
149 maintenance_show_test_settings_value_cmd,
150 &maintenance_set_test_settings_list,
151 &maintenance_show_test_settings_list);
dca0f6c0
PA
152
153 add_setshow_integer_cmd ("integer", class_maintenance,
154 &maintenance_test_settings_integer, _("\
590042fc
PW
155command used for internal testing."), _("\
156command used for internal testing."),
dca0f6c0
PA
157 nullptr, /* help_doc */
158 nullptr, /* set_cmd */
c6ac8931
PA
159 maintenance_show_test_settings_value_cmd,
160 &maintenance_set_test_settings_list,
161 &maintenance_show_test_settings_list);
dca0f6c0
PA
162
163 add_setshow_string_cmd ("string", class_maintenance,
164 &maintenance_test_settings_string, _("\
590042fc
PW
165command used for internal testing."), _("\
166command used for internal testing."),
dca0f6c0
PA
167 nullptr, /* help_doc */
168 nullptr, /* set_cmd */
c6ac8931
PA
169 maintenance_show_test_settings_value_cmd,
170 &maintenance_set_test_settings_list,
171 &maintenance_show_test_settings_list);
dca0f6c0
PA
172
173 add_setshow_string_noescape_cmd
174 ("string-noescape", class_maintenance,
175 &maintenance_test_settings_string_noescape, _("\
590042fc
PW
176command used for internal testing."), _("\
177command used for internal testing."),
dca0f6c0
PA
178 nullptr, /* help_doc */
179 nullptr, /* set_cmd */
c6ac8931
PA
180 maintenance_show_test_settings_value_cmd,
181 &maintenance_set_test_settings_list,
182 &maintenance_show_test_settings_list);
dca0f6c0
PA
183
184 add_setshow_optional_filename_cmd
185 ("optional-filename", class_maintenance,
186 &maintenance_test_settings_optional_filename, _("\
590042fc
PW
187command used for internal testing."), _("\
188command used for internal testing."),
dca0f6c0
PA
189 nullptr, /* help_doc */
190 nullptr, /* set_cmd */
c6ac8931
PA
191 maintenance_show_test_settings_value_cmd,
192 &maintenance_set_test_settings_list,
193 &maintenance_show_test_settings_list);
dca0f6c0
PA
194
195 add_setshow_filename_cmd ("filename", class_maintenance,
196 &maintenance_test_settings_filename, _("\
590042fc
PW
197command used for internal testing."), _("\
198command used for internal testing."),
dca0f6c0
PA
199 nullptr, /* help_doc */
200 nullptr, /* set_cmd */
c6ac8931
PA
201 maintenance_show_test_settings_value_cmd,
202 &maintenance_set_test_settings_list,
203 &maintenance_show_test_settings_list);
dca0f6c0
PA
204
205 add_setshow_zinteger_cmd ("zinteger", class_maintenance,
206 &maintenance_test_settings_zinteger, _("\
590042fc
PW
207command used for internal testing."), _("\
208command used for internal testing."),
dca0f6c0
PA
209 nullptr, /* help_doc */
210 nullptr, /* set_cmd */
c6ac8931
PA
211 maintenance_show_test_settings_value_cmd,
212 &maintenance_set_test_settings_list,
213 &maintenance_show_test_settings_list);
dca0f6c0
PA
214
215 add_setshow_zuinteger_cmd ("zuinteger", class_maintenance,
216 &maintenance_test_settings_zuinteger, _("\
590042fc
PW
217command used for internal testing."), _("\
218command used for internal testing."),
dca0f6c0
PA
219 nullptr, /* help_doc */
220 nullptr, /* set_cmd */
c6ac8931
PA
221 maintenance_show_test_settings_value_cmd,
222 &maintenance_set_test_settings_list,
223 &maintenance_show_test_settings_list);
dca0f6c0
PA
224
225 add_setshow_zuinteger_unlimited_cmd
226 ("zuinteger-unlimited", class_maintenance,
227 &maintenance_test_settings_zuinteger_unlimited, _("\
590042fc
PW
228command used for internal testing."), _("\
229command used for internal testing."),
dca0f6c0
PA
230 nullptr, /* help_doc */
231 nullptr, /* set_cmd */
c6ac8931
PA
232 maintenance_show_test_settings_value_cmd,
233 &maintenance_set_test_settings_list,
234 &maintenance_show_test_settings_list);
dca0f6c0
PA
235
236 add_setshow_enum_cmd ("enum", class_maintenance,
237 maintenance_test_settings_enums,
238 &maintenance_test_settings_enum, _("\
590042fc
PW
239command used for internal testing."), _("\
240command used for internal testing."),
dca0f6c0
PA
241 nullptr, /* help_doc */
242 nullptr, /* set_cmd */
c6ac8931
PA
243 maintenance_show_test_settings_value_cmd,
244 &maintenance_set_test_settings_list,
245 &maintenance_show_test_settings_list);
dca0f6c0 246}
This page took 0.097303 seconds and 4 git commands to generate.