cmdline: display "[Return]" when there is no more token to complete
[libcmdline.git] / src / lib / cmdline_parse.c
index 513c9f0..ceb22d6 100644 (file)
@@ -312,7 +312,7 @@ match_inst(cmdline_parse_inst_t *inst, const char *linebuf,
                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 */
@@ -489,7 +489,7 @@ int cmdline_help(cmdline_parse_ctx_t *ctx, const char *buf,
 
                /* 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;