linebuf++;
/* end of buf, we match all inst */
- if (isendofline(*linebuf) || iscomment(*linebuf))
+ if (*linebuf == '\0' || isendofline(*linebuf) || iscomment(*linebuf))
return 0;
/* garbage after inst */
/* end of inst */
if (token == NULL) {
- n = snprintf(helpbuf, sizeof(helpbuf), "[RETURN]\n");
+ n = snprintf(helpbuf, sizeof(helpbuf), "[Return]\n");
if (n > 0)
write_buf(opaque, helpbuf, n);
continue;
while (token->ops->complete_iterate(token,
&preparse.opaque,
tmpbuf,
- sizeof(tmpbuf)) == 0) {
+ sizeof(tmpbuf)) >= 0) {
debug_printf(" choice <%s>\n", tmpbuf);
debug_printf("Completion %s\n", tmpbuf);
/* we kept at least the room for one char */
- /* XXX to be updated for non-final completion */
if (ret == 0)
strcat(tmpbuf, " ");
if (completion_len >= dstsize)
completion_len = dstsize - 1;
strncpy(dst, completion_buf + preparse.comp_tok_len,
- completion_len);
- dst[completion_len] = '\0';
+ completion_len - preparse.comp_tok_len);
+ dst[completion_len - preparse.comp_tok_len] = '\0';
return CMDLINE_COMPLETE_APPEND;
}