loop condition is nonzero. */
static void
-while_command (char *arg, int from_tty)
+while_command (const char *arg, int from_tty)
{
control_level = 1;
command_line_up command = get_command_line (while_control, arg);
on the value of the if conditional. */
static void
-if_command (char *arg, int from_tty)
+if_command (const char *arg, int from_tty)
{
control_level = 1;
command_line_up command = get_command_line (if_control, arg);
prefix. */
static struct cmd_list_element **
-validate_comname (char **comname)
+validate_comname (const char **comname)
{
struct cmd_list_element **list = &cmdlist;
- char *p, *last_word;
+ const char *p, *last_word;
if (*comname == 0)
error_no_arg (_("name of command to define"));
if (last_word != *comname)
{
struct cmd_list_element *c;
- char saved_char;
- const char *tem = *comname;
/* Separate the prefix and the command. */
- saved_char = last_word[-1];
- last_word[-1] = '\0';
+ std::string prefix (*comname, last_word - 1);
+ const char *tem = prefix.c_str ();
c = lookup_cmd (&tem, cmdlist, "", 0, 1);
if (c->prefixlist == NULL)
- error (_("\"%s\" is not a prefix command."), *comname);
+ error (_("\"%s\" is not a prefix command."), prefix.c_str ());
list = c->prefixlist;
- last_word[-1] = saved_char;
*comname = last_word;
}
}
static void
-define_command (char *comname, int from_tty)
+define_command (const char *comname, int from_tty)
{
#define MAX_TMPBUF 128
enum cmd_hook_type
CMD_POST_HOOK
};
struct cmd_list_element *c, *newc, *hookc = 0, **list;
- char *tem, *comfull;
- const char *tem_c;
+ const char *tem, *comfull;
char tmpbuf[MAX_TMPBUF];
int hook_type = CMD_NO_HOOK;
int hook_name_size = 0;
list = validate_comname (&comname);
/* Look it up, and verify that we got an exact match. */
- tem_c = comname;
- c = lookup_cmd (&tem_c, *list, "", -1, 1);
+ tem = comname;
+ c = lookup_cmd (&tem, *list, "", -1, 1);
if (c && strcmp (comname, c->name) != 0)
c = 0;
if (hook_type != CMD_NO_HOOK)
{
/* Look up cmd it hooks, and verify that we got an exact match. */
- tem_c = comname + hook_name_size;
- hookc = lookup_cmd (&tem_c, *list, "", -1, 0);
+ tem = comname + hook_name_size;
+ hookc = lookup_cmd (&tem, *list, "", -1, 0);
if (hookc && strcmp (comname + hook_name_size, hookc->name) != 0)
hookc = 0;
if (!hookc)
}
static void
-document_command (char *comname, int from_tty)
+document_command (const char *comname, int from_tty)
{
struct cmd_list_element *c, **list;
const char *tem;
- char *comfull;
+ const char *comfull;
char tmpbuf[128];
comfull = comname;