cmdine:: allow non-final completion (will be used by file token)
authorOlivier Matz <zer0@droids-corp.org>
Sun, 20 Feb 2011 16:58:40 +0000 (17:58 +0100)
committerOlivier Matz <zer0@droids-corp.org>
Sun, 13 Mar 2011 10:09:25 +0000 (11:09 +0100)
Signed-off-by: Olivier Matz <zer0@droids-corp.org>
src/lib/cmdline_parse.c
src/lib/cmdline_parse.h

index 18ea76e..513c9f0 100644 (file)
@@ -542,7 +542,7 @@ int cmdline_help(cmdline_parse_ctx_t *ctx, const char *buf,
                while (token->ops->complete_iterate(token,
                                                    &preparse.opaque,
                                                    tmpbuf,
-                                                   sizeof(tmpbuf)) == 0) {
+                                                   sizeof(tmpbuf)) >= 0) {
 
 
                        debug_printf("   choice <%s>\n", tmpbuf);
@@ -641,7 +641,6 @@ cmdline_complete(cmdline_parse_ctx_t *ctx, const char *buf,
                        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, " ");
 
index 6facb9e..9196cc7 100644 (file)
@@ -101,7 +101,8 @@ typedef struct cmdline_token_hdr cmdline_parse_token_hdr_t;
  *
  * complete_iterate() copy in dstbuf (the size is specified in the
  * parameter) the next possible completion for this token. Return 0 on
- * success or a negative value on error (or when there is no more
+ * success (final completion), 1 if it's an intermediate completion,
+ * or a negative value on error (or when there is no more
  * completion). Refer to cmdline_complete_string_iterate() for an
  * example.
  *