-
-/*
- * read_switch_multiword_via_readline.c -- get an answer from the user, with readline
+/* read_switch_multiword_via_readline.c -- get an answer from the user, with readline
*
* This code is Copyright (c) 2012, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
add_history(ans);
strncpy(ansbuf, ans, sizeof(ansbuf));
ansbuf[sizeof(ansbuf) - 1] = '\0';
+ free(ans);
+
cpp = brkstring(ansbuf, " ", NULL);
switch (smatch(*cpp, ansp)) {
case AMBIGSW:
printf(" -%s unknown. Hit <CR> for help.\n", *cpp);
continue;
default:
- free(ans);
return cpp;
}
- free(ans);
}
}
static char **
nmh_completion(const char *text, int start, int end)
{
- char **matches;
-
NMH_UNUSED (end);
- matches = (char **) NULL;
-
if (start == 0)
- matches = rl_completion_matches(text, nmh_command_generator);
+ return rl_completion_matches(text, nmh_command_generator);
- return matches;
+ return NULL;
}
static char *
return NULL;
}
#endif /* READLINE_SUPPORT */
-