if (cmd && cmd->pc_func) {
int rc = cmd->pc_func(argc, argv);
- if (rc == CMD_HELP) {
- fprintf(stdout, "%s\n", cmd->pc_help);
- fflush(stdout);
- }
+ if (rc == CMD_HELP)
+ fprintf(stderr, "%s\n", cmd->pc_help);
return rc;
}
- fprintf(stderr,
- "%s: '%s' is not a valid command. See '%s --list-commands'.\n",
- program_invocation_short_name, argv[0],
- program_invocation_short_name);
+ printf("Try interactive use without arguments or use one of:\n");
+ for (cmd = cmds; cmd->pc_name; cmd++)
+ printf("\"%s\"\n", cmd->pc_name);
+ printf("as argument.\n");
return -1;
}
i = line2args(line, argv, MAXARGS);
rc = cmd->pc_func(i, argv);
- if (rc == CMD_HELP) {
- fprintf(stdout, "%s\n", cmd->pc_help);
- fflush(stdout);
- }
+ if (rc == CMD_HELP)
+ fprintf(stderr, "%s\n", cmd->pc_help);
break;
}
program_invocation_short_name);
printf("Without any parameters, interactive mode is invoked\n");
- printf("Try '%s help <COMMAND>', or '%s --list-commands' for a list of commands.\n",
- program_invocation_short_name, program_invocation_short_name);
+ printf("Try '%s help <COMMAND>' or '%s --list-commands' for more information\n",
+ program_invocation_short_name, program_invocation_short_name);
}
int Parser_help(int argc, char **argv)