2005-02-21 Andrew Cagney <cagney@gnu.org>

Replace string variables with a filename completer with
	add_setshow_optional_filename_cmd.
	* solib.c, symfile.c: Update.
	* cli/cli-setshow.c: Do not tidle expand the file.
This commit is contained in:
Andrew Cagney 2005-02-21 07:08:42 +00:00
parent 4d28ad1ece
commit 525226b563
4 changed files with 32 additions and 27 deletions

View file

@ -1,5 +1,10 @@
2005-02-21 Andrew Cagney <cagney@gnu.org> 2005-02-21 Andrew Cagney <cagney@gnu.org>
Replace string variables with a filename completer with
add_setshow_optional_filename_cmd.
* solib.c, symfile.c: Update.
* cli/cli-setshow.c: Do not tidle expand the file.
Add more uses of add_setshow_string_cmd, add_setshow_integer_cmd, Add more uses of add_setshow_string_cmd, add_setshow_integer_cmd,
and add_setshow_string_noescape_cmd. and add_setshow_string_noescape_cmd.
* cli/cli-setshow.c (deprecated_show_value_hack): Do not print a * cli/cli-setshow.c (deprecated_show_value_hack): Do not print a

View file

@ -180,15 +180,16 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
xfree (*(char **) c->var); xfree (*(char **) c->var);
*(char **) c->var = savestring (arg, strlen (arg)); *(char **) c->var = savestring (arg, strlen (arg));
break; break;
case var_filename:
case var_optional_filename: case var_optional_filename:
if (arg == NULL) if (arg == NULL)
{ arg = "";
if (c->var_type == var_optional_filename) if (*(char **) c->var != NULL)
arg = ""; xfree (*(char **) c->var);
else *(char **) c->var = savestring (arg, strlen (arg));
error_no_arg (_("filename to set it to.")); break;
} case var_filename:
if (arg == NULL)
error_no_arg (_("filename to set it to."));
if (*(char **) c->var != NULL) if (*(char **) c->var != NULL)
xfree (*(char **) c->var); xfree (*(char **) c->var);
*(char **) c->var = tilde_expand (arg); *(char **) c->var = tilde_expand (arg);

View file

@ -925,12 +925,12 @@ For other (relative) files, you can add values using `set solib-search-path'."),
one is set. */ one is set. */
solib_absolute_prefix = xstrdup (gdb_sysroot); solib_absolute_prefix = xstrdup (gdb_sysroot);
c = add_set_cmd ("solib-search-path", class_support, var_string, add_setshow_optional_filename_cmd ("solib-search-path", class_support,
(char *) &solib_search_path, &solib_search_path, _("\
"Set the search path for loading non-absolute shared library symbol files.\n\ Set the search path for loading non-absolute shared library symbol files."), _("\
This takes precedence over the environment variables PATH and LD_LIBRARY_PATH.", Show the search path for loading non-absolute shared library symbol files."), _("\
&setlist); This takes precedence over the environment variables PATH and LD_LIBRARY_PATH."),
deprecated_add_show_from_set (c, &showlist); reload_shared_libraries,
set_cmd_sfunc (c, reload_shared_libraries); NULL, /* FIXME: i18n: */
set_cmd_completer (c, filename_completer); &setlist, &showlist);
} }

View file

@ -3621,16 +3621,15 @@ cache."),
&setlist, &showlist); &setlist, &showlist);
debug_file_directory = xstrdup (DEBUGDIR); debug_file_directory = xstrdup (DEBUGDIR);
c = (add_set_cmd add_setshow_optional_filename_cmd ("debug-file-directory", class_support,
("debug-file-directory", class_support, var_string, &debug_file_directory, _("\
(char *) &debug_file_directory, Set the directory where separate debug symbols are searched for."), _("\
"Set the directory where separate debug symbols are searched for.\n" Show the directory where separate debug symbols are searched for."), _("\
"Separate debug symbols are first searched for in the same\n" Separate debug symbols are first searched for in the same\n\
"directory as the binary, then in the `" DEBUG_SUBDIRECTORY directory as the binary, then in the `" DEBUG_SUBDIRECTORY "' subdirectory,\n\
"' subdirectory,\n" and lastly at the path of the directory of the binary with\n\
"and lastly at the path of the directory of the binary with\n" the global debug-file directory prepended."),
"the global debug-file directory prepended\n", NULL,
&setlist)); NULL, /* FIXME: i18n: */
deprecated_add_show_from_set (c, &showlist); &setlist, &showlist);
set_cmd_completer (c, filename_completer);
} }