19 #include "readline/tilde.h"
37 if (param_changed == 0)
51 if (arg != NULL && *arg !=
'\0')
53 int length = strlen (arg);
55 while (isspace (arg[length - 1]) && length > 0)
57 if (strncmp (arg,
"on", length) == 0
58 || strncmp (arg,
"1", length) == 0
59 || strncmp (arg,
"yes", length) == 0
60 || strncmp (arg,
"enable", length) == 0)
62 else if (strncmp (arg,
"off", length) == 0
63 || strncmp (arg,
"0", length) == 0
64 || strncmp (arg,
"no", length) == 0
65 || strncmp (arg,
"disable", length) == 0)
67 else if (strncmp (arg,
"auto", length) == 0
68 || (strncmp (arg,
"-1", length) == 0 && length > 1))
71 error (
_(
"\"on\", \"off\" or \"auto\" expected."));
85 length = strlen (arg);
87 while (arg[length - 1] ==
' ' || arg[length - 1] ==
'\t')
90 if (strncmp (arg,
"on", length) == 0
91 || strncmp (arg,
"1", length) == 0
92 || strncmp (arg,
"yes", length) == 0
93 || strncmp (arg,
"enable", length) == 0)
95 else if (strncmp (arg,
"off", length) == 0
96 || strncmp (arg,
"0", length) == 0
97 || strncmp (arg,
"no", length) == 0
98 || strncmp (arg,
"disable", length) == 0)
111 if (c == NULL || value == NULL)
135 size_t len =
sizeof (
"unlimited") - 1;
139 return (strncmp (arg,
"unlimited", len) == 0
140 && (isspace (arg[len]) || arg[len] ==
'\0'));
153 int option_changed = 0;
168 newobj = (
char *)
xmalloc (strlen (arg) + 2);
171 while ((ch = *p++) !=
'\000')
194 if (*(p - 1) !=
'\\')
198 newobj = (
char *)
xrealloc (newobj, q - newobj);
200 if (*(
char **) c->
var == NULL
201 || strcmp (*(
char **) c->
var, newobj) != 0)
204 *(
char **) c->
var = newobj;
216 if (*(
char **) c->
var == NULL || strcmp (*(
char **) c->
var, arg) != 0)
219 *(
char **) c->
var = xstrdup (arg);
235 const char *ptr = arg + strlen (arg) - 1;
238 while (ptr >= arg && (*ptr ==
' ' || *ptr ==
'\t'))
240 copy = xstrndup (arg, ptr + 1 - arg);
242 val = tilde_expand (copy);
248 if (*(
char **) c->
var == NULL
249 || strcmp (*(
char **) c->
var, val) != 0)
252 *(
char **) c->
var = val;
265 error (
_(
"\"on\" or \"off\" expected."));
266 if (val != *(
int *) c->
var)
268 *(
int *) c->
var = val;
314 if (*(
unsigned int *) c->
var != val)
316 *(
unsigned int *) c->
var = val;
350 if (*(
int *) c->
var != val)
352 *(
int *) c->
var = val;
363 const char *match = NULL;
373 for (i = 0; c->
enums[i]; i++)
374 msg_len += strlen (c->
enums[i]) + 2;
380 for (i = 0; c->
enums[i]; i++)
384 strcat (msg, c->
enums[i]);
386 error (
_(
"Requires an argument. Valid arguments are %s."),
390 p = strchr (arg,
' ');
398 for (i = 0; c->
enums[i]; i++)
399 if (strncmp (arg, c->
enums[i], len) == 0)
401 if (c->
enums[i][len] ==
'\0')
415 error (
_(
"Undefined item: \"%s\"."), arg);
418 error (
_(
"Ambiguous item \"%s\"."), arg);
420 if (*(
const char **) c->
var != match)
422 *(
const char **) c->
var = match;
443 error (
_(
"only -1 is allowed to set as unlimited"));
445 if (*(
int *) c->
var != val)
447 *(
int *) c->
var = val;
453 error (
_(
"gdb internal error: bad var_type in do_setshow_command"));
455 c->
func (c, NULL, from_tty);
471 for (i = 0, p = c; p != NULL; i++)
473 length += strlen (p->
name);
482 for (i = 0, p = c; p != NULL; i++)
500 for (i--; i >= 0; i--)
502 memcpy (cp, cmds[i]->name, strlen (cmds[i]->name));
503 cp += strlen (cmds[i]->name);
526 char *opt = *(
int *) c->
var ?
"on" :
"off";
543 xsnprintf (s,
sizeof s,
"%u", *(
unsigned int *) c->
var);
586 if (*(
char **) c->
var)
593 if (*(
char **) c->
var)
613 _(
"do_show_command: "
614 "invalid var_auto_boolean"));
636 if (*(
int *) c->
var == -1)
643 error (
_(
"gdb internal error: bad var_type in do_show_command"));
666 c->
func (c, NULL, from_tty);
674 struct cleanup *showlist_chain;
678 for (; list != NULL; list = list->
next)
684 struct cleanup *optionlist_chain
686 char *new_prefix = strstr (list->
prefixname,
"show ") + 5;
void error_no_arg(const char *why)
struct cmd_list_element * next
int parse_cli_boolean_value(const char *arg)
void ui_out_field_stream(struct ui_out *uiout, const char *fldname, struct ui_file *stream)
static enum auto_boolean parse_auto_binary_operation(const char *arg)
__extension__ enum cmd_types type
void print_doc_line(struct ui_file *stream, const char *str)
const char *const * enums
char * ui_file_xstrdup(struct ui_file *file, long *length)
char * plongest(LONGEST l)
struct ui_file * gdb_stdout
void internal_error(const char *file, int line, const char *fmt,...)
int ui_out_is_mi_like_p(struct ui_out *uiout)
struct cmd_list_element * prefix
void ui_out_text(struct ui_out *uiout, const char *string)
void printf_filtered(const char *format,...)
void cmd_func(struct cmd_list_element *cmd, char *args, int from_tty)
struct cmd_list_element * setlist
struct cleanup * make_cleanup_ui_out_tuple_begin_end(struct ui_out *uiout, const char *id)
void fprintf_filtered(struct ui_file *stream, const char *format,...)
const char * skip_spaces_const(const char *chp)
void fputs_filtered(const char *linebuffer, struct ui_file *stream)
__extension__ enum var_types var_type
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
struct gdbarch * get_current_arch(void)
struct ui_file * mem_fileopen(void)
void cmd_show_list(struct cmd_list_element *list, int from_tty, const char *prefix)
void(* pre_show_hook)(struct cmd_list_element *c)
int parse_escape(struct gdbarch *gdbarch, const char **string_ptr)
PTR xrealloc(PTR ptr, size_t size)
void deprecated_show_value_hack(struct ui_file *ignore_file, int ignore_from_tty, struct cmd_list_element *c, const char *value)
struct cleanup * make_cleanup_ui_file_delete(struct ui_file *arg)
int xsnprintf(char *str, size_t size, const char *format,...)
void(* func)(struct cmd_list_element *c, char *args, int from_tty)
enum command_class theclass
void observer_notify_command_param_changed(const char *param, const char *value)
static int notify_command_param_changed_p(int param_changed, struct cmd_list_element *c)
show_value_ftype * show_value_func
void do_set_command(const char *arg, int from_tty, struct cmd_list_element *c)
struct cmd_list_element ** prefixlist
void ui_out_field_string(struct ui_out *uiout, const char *fldname, const char *string)
void do_show_command(const char *arg, int from_tty, struct cmd_list_element *c)
struct ui_out * current_uiout
const char *const auto_boolean_enums[]
void error(const char *fmt,...)
void fputstr_filtered(const char *str, int quoter, struct ui_file *stream)
void do_cleanups(struct cleanup *old_chain)
static int is_unlimited_literal(const char *arg)
const ULONGEST const LONGEST len
LONGEST parse_and_eval_long(const char *exp)