#include <ctype.h>
#include <string.h>
-extern char *getenv ();
+/* Prototypes for local functions */
+
+static void
+undef_cmd_error PARAMS ((char *, char *));
+
+static void
+show_user PARAMS ((char *, int));
+
+static void
+show_user_1 PARAMS ((struct cmd_list_element *, FILE *));
+
+static void
+make_command PARAMS ((char *, int));
+
+static void
+shell_escape PARAMS ((char *, int));
+
+static int
+parse_binary_operation PARAMS ((char *));
+
+static void
+print_doc_line PARAMS ((FILE *, char *));
/* Add element named NAME to command list *LIST.
FUN should be the function to execute the command;
add_cmd (name, class, fun, doc, list)
char *name;
enum command_class class;
- void (*fun) ();
+ void (*fun) PARAMS ((char *, int));
char *doc;
struct cmd_list_element **list;
{
c->next = *list;
c->name = name;
c->class = class;
- c->function = fun;
+ c->function.cfunc = fun;
c->doc = doc;
c->prefixlist = 0;
c->prefixname = (char *)NULL;
/* Same as above, except that the abbrev_flag is set. */
+#if 0 /* Currently unused */
+
struct cmd_list_element *
add_abbrev_cmd (name, class, fun, doc, list)
char *name;
enum command_class class;
- void (*fun) ();
+ void (*fun) PARAMS ((char *, int));
char *doc;
struct cmd_list_element **list;
{
return c;
}
+#endif
+
struct cmd_list_element *
add_alias_cmd (name, oldname, class, abbrev_flag, list)
char *name;
return 0;
}
- c = add_cmd (name, class, old->function, old->doc, list);
+ c = add_cmd (name, class, old->function.cfunc, old->doc, list);
c->prefixlist = old->prefixlist;
c->prefixname = old->prefixname;
c->allow_unknown = old->allow_unknown;
allow_unknown, list)
char *name;
enum command_class class;
- void (*fun) ();
+ void (*fun) PARAMS ((char *, int));
char *doc;
struct cmd_list_element **prefixlist;
char *prefixname;
struct cmd_list_element *
add_abbrev_prefix_cmd (name, class, fun, doc, prefixlist, prefixname,
- allow_unknown, list)
+ allow_unknown, list)
char *name;
enum command_class class;
- void (*fun) ();
+ void (*fun) PARAMS ((char *, int));
char *doc;
struct cmd_list_element **prefixlist;
char *prefixname;
VAR_TYPE is the kind of thing we are setting.
VAR is address of the variable being controlled by this command.
DOC is the documentation string. */
+
struct cmd_list_element *
add_set_cmd (name, class, var_type, var, doc, list)
char *name;
fputs_filtered (c->doc, stream);
fputs_filtered ("\n", stream);
- if (c->prefixlist == 0 && c->function != 0)
+ if (c->prefixlist == 0 && c->function.cfunc != NULL)
return;
fprintf_filtered (stream, "\n");
help_list (*c->prefixlist, c->prefixname, all_commands, stream);
/* If this is a class name, print all of the commands in the class */
- if (c->function == 0)
+ if (c->function.cfunc == NULL)
help_list (cmdlist, "", c->class, stream);
}
* ALL_CLASSES to list all classes in list.
*
* Note that RECURSE will be active on *all* sublists, not just the
- * ones seclected by the criteria above (ie. the selection mechanism
+ * ones selected by the criteria above (ie. the selection mechanism
* is at the low level, not the high-level).
*/
void
{
if (c->abbrev_flag == 0 &&
(class == all_commands
- || (class == all_classes && c->function == 0)
- || (class == c->class && c->function != 0)))
+ || (class == all_classes && c->function.cfunc == NULL)
+ || (class == c->class && c->function.cfunc != NULL)))
{
fprintf_filtered (stream, "%s%s -- ", prefix, c->name);
print_doc_line (stream, c->doc);
nfound = 0;
for (c = clist; c; c = c->next)
if (!strncmp (command, c->name, len)
- && (!ignore_help_classes || c->function))
+ && (!ignore_help_classes || c->function.cfunc))
{
found = c;
nfound++;
/* All this hair to move the space to the front of cmdtype */
-void
+static void
undef_cmd_error (cmdtype, q)
char *cmdtype, *q;
{
for (ptr = list; ptr; ptr = ptr->next)
if (!strncmp (ptr->name, text, textlen)
&& !ptr->abbrev_flag
- && (ptr->function
+ && (ptr->function.cfunc
|| ptr->prefixlist))
{
if (matches == sizeof_matchlist)
arg = "";
new = (char *) xmalloc (strlen (arg) + 2);
p = arg; q = new;
- while (ch = *p++)
+ while ((ch = *p++) != '\000')
{
if (ch == '\\')
{
}
else
error ("gdb internal error: bad cmd_type in do_setshow_command");
- (*c->function) (NULL, from_tty, c);
+ (*c->function.sfunc) (NULL, from_tty, c);
}
/* Show all the settings in a list of show commands. */
{
int rc, status, pid;
char *p, *user_shell;
- extern char *rindex ();
if ((user_shell = (char *) getenv ("SHELL")) == NULL)
user_shell = "/bin/sh";
/* Get the name of the shell for arg0 */
- if ((p = rindex (user_shell, '/')) == NULL)
+ if ((p = strrchr (user_shell, '/')) == NULL)
p = user_shell;
else
p++; /* Get past '/' */