Fix a bug in the "help" command. Some commands have no action function,

so the function pointer should not be used to detect the end of the table.
Use the command name instead.
This commit is contained in:
Giles Atkinson 2023-09-19 18:29:10 +01:00 committed by Holger Vogt
parent 423f9a9db2
commit 588116af48
1 changed files with 3 additions and 2 deletions

View File

@ -81,7 +81,7 @@ void com_help(wordlist *wl)
else { else {
while (wl != NULL) { while (wl != NULL) {
struct comm *c; struct comm *c;
for (c = &cp_coms[0]; c->co_func != NULL; c++) for (c = &cp_coms[0]; c->co_comname != NULL; c++) {
if (eq(wl->wl_word, c->co_comname)) { if (eq(wl->wl_word, c->co_comname)) {
out_printf("%s ", c->co_comname); out_printf("%s ", c->co_comname);
out_printf(c->co_help, cp_program); out_printf(c->co_help, cp_program);
@ -90,7 +90,8 @@ void com_help(wordlist *wl)
out_send("\n"); out_send("\n");
break; break;
} }
if (c->co_func == NULL) { }
if (c->co_comname == NULL) {
/* See if this is aliased. */ /* See if this is aliased. */
struct alias *al; struct alias *al;