From ecfbaef01c8717a0b2c09f0d0ef9ad0666d92de6 Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Sun, 20 Feb 2011 17:58:40 +0100 Subject: [PATCH] cmdine:: allow non-final completion (will be used by file token) Signed-off-by: Olivier Matz --- src/lib/cmdline_parse.c | 3 +-- src/lib/cmdline_parse.h | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/cmdline_parse.c b/src/lib/cmdline_parse.c index 18ea76e..513c9f0 100644 --- a/src/lib/cmdline_parse.c +++ b/src/lib/cmdline_parse.c @@ -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, " "); diff --git a/src/lib/cmdline_parse.h b/src/lib/cmdline_parse.h index 6facb9e..9196cc7 100644 --- a/src/lib/cmdline_parse.h +++ b/src/lib/cmdline_parse.h @@ -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. * -- 2.20.1