aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-setshow.c19
-rw-r--r--gdb/cli/cli-setshow.h6
2 files changed, 11 insertions, 14 deletions
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index 3a0e978..95ebbe7 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -29,10 +29,6 @@
#include "cli/cli-cmds.h"
#include "cli/cli-setshow.h"
-/* Prototypes for local functions. */
-
-static int parse_binary_operation (char *);
-
/* Return true if the change of command parameter should be notified. */
static int
@@ -76,8 +72,10 @@ parse_auto_binary_operation (const char *arg)
return AUTO_BOOLEAN_AUTO; /* Pacify GCC. */
}
-static int
-parse_binary_operation (char *arg)
+/* See cli-setshow.h. */
+
+int
+parse_cli_boolean_value (char *arg)
{
int length;
@@ -100,10 +98,7 @@ parse_binary_operation (char *arg)
|| strncmp (arg, "disable", length) == 0)
return 0;
else
- {
- error (_("\"on\" or \"off\" expected."));
- return 0;
- }
+ return -1;
}
void
@@ -248,8 +243,10 @@ do_set_command (char *arg, int from_tty, struct cmd_list_element *c)
break;
case var_boolean:
{
- int val = parse_binary_operation (arg);
+ int val = parse_cli_boolean_value (arg);
+ if (val < 0)
+ error (_("\"on\" or \"off\" expected."));
if (val != *(int *) c->var)
{
*(int *) c->var = val;
diff --git a/gdb/cli/cli-setshow.h b/gdb/cli/cli-setshow.h
index 079b9da..152080b 100644
--- a/gdb/cli/cli-setshow.h
+++ b/gdb/cli/cli-setshow.h
@@ -19,15 +19,15 @@
struct cmd_list_element;
-/* Exported to cli/cli-cmds.c and gdb/top.c */
+/* Parse ARG, an option to a boolean variable.
+ Returns 1 for true, 0 for false, and -1 if invalid. */
+extern int parse_cli_boolean_value (char *arg);
extern void do_set_command (char *arg, int from_tty,
struct cmd_list_element *c);
extern void do_show_command (char *arg, int from_tty,
struct cmd_list_element *c);
-/* Exported to cli/cli-cmds.c and gdb/top.c, language.c and valprint.c */
-
extern void cmd_show_list (struct cmd_list_element *list, int from_tty,
char *prefix);