Signed-off-by: Jiang Xin <worldhello....@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclo...@gmail.com>
---
 parse-options.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/parse-options.c b/parse-options.c
index cd029f..be916 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -497,6 +497,8 @@ static int usage_with_options_internal(struct 
parse_opt_ctx_t *ctx,
                                       const struct option *opts, int full, int 
err)
 {
        FILE *outfile = err ? stderr : stdout;
+       const char *opt_num_buff = _("-NUM");
+       int opt_num_size = utf8_strwidth(opt_num_buff);
 
        if (!usagestr)
                return PARSE_OPT_HELP;
@@ -544,8 +546,10 @@ static int usage_with_options_internal(struct 
parse_opt_ctx_t *ctx,
                        pos += fprintf(outfile, ", ");
                if (opts->long_name)
                        pos += fprintf(outfile, "--%s", opts->long_name);
-               if (opts->type == OPTION_NUMBER)
-                       pos += fprintf(outfile, "-NUM");
+               if (opts->type == OPTION_NUMBER) {
+                       fputs(opt_num_buff, outfile);
+                       pos += opt_num_size;
+               }
 
                if ((opts->flags & PARSE_OPT_LITERAL_ARGHELP) ||
                    !(opts->flags & PARSE_OPT_NOARG))
-- 
1.8.1.1.368.g6034fad.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to