summaryrefslogtreecommitdiffhomepage
path: root/mixutils/mixvm_command.c
diff options
context:
space:
mode:
Diffstat (limited to 'mixutils/mixvm_command.c')
-rw-r--r--mixutils/mixvm_command.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/mixutils/mixvm_command.c b/mixutils/mixvm_command.c
index 8030eed..b8bef53 100644
--- a/mixutils/mixvm_command.c
+++ b/mixutils/mixvm_command.c
@@ -173,33 +173,23 @@ cmd_help_ (char *arg)
int i;
int printed = 0;
- for (i = 0; commands[i].name; i++)
+ for (i = 1; commands[i].name; i++)
{
- if (!*arg || (strcmp (arg, commands[i].name) == 0))
+ if (!arg || !*arg)
{
- printf (_("%s\t\t%s. Usage: %s\n"), commands[i].name,
- _(commands[i].doc), commands[i].usage);
+ printf (_("%s\t\t%s.\n"), commands[i].name, _(commands[i].doc));
printed++;
}
- }
-
- if (printed > 1) printf ("\n");
-
- for (i = LOCAL_COMANDS_NO_ + 1 /* skip help cmd */; mix_commands_[i]; i++)
- {
- if (!*arg || (strcmp (arg, mix_commands_[i]) == 0))
+ else if (strcmp (arg, commands[i].name) == 0)
{
- printf (_("%s\t\t%s. Usage: %s\n"), mix_commands_[i],
- mix_vm_command_help (i - LOCAL_COMANDS_NO_),
- mix_vm_command_usage (i - LOCAL_COMANDS_NO_));
+ printf (_("%s\t\t%s.\nUsage:\t\t%s\n"), commands[i].name,
+ _(commands[i].doc), commands[i].usage);
printed++;
}
}
-
- if (!printed) printf ("Command \'%s\' not found\n", arg);
-
+ if (!printed ||!arg || !*arg)
+ mix_vm_cmd_dispatcher_dispatch (dis_, MIX_CMD_HELP, arg);
return TRUE;
-
}
static int
@@ -246,7 +236,7 @@ init_dis_ (mix_vm_cmd_dispatcher_t *dis)
}
void
-mixvm_cmd_init (char *arg, gboolean use_emacs)
+mixvm_cmd_init (mix_config_t *config, char *arg, gboolean use_emacs)
{
int k;
/* get local command names */
@@ -263,7 +253,7 @@ mixvm_cmd_init (char *arg, gboolean use_emacs)
#endif /* HAVE_LIBREADLINE */
/* initialise the dispatcher */
- dis_ = mix_vm_cmd_dispatcher_new (stdout, stderr);
+ dis_ = mix_vm_cmd_dispatcher_new_with_config (stdout, stderr, config);
if ( dis_ == NULL)
g_error (_("Failed initialisation (no memory resources)"));