diff options
author | Daniel Stenberg <daniel@haxx.se> | 2020-09-18 08:09:09 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2020-09-18 14:47:23 +0200 |
commit | 5bd63e0619d10d81850a9993ac278396bb77e36c (patch) | |
tree | 3fe1e3986f8df5eb3f81b7d8225d86bffc2051f5 /src/tool_help.c | |
parent | 2df7414a7390771316be4cc8822650470e7d7aa8 (diff) | |
download | curl-5bd63e0619d10d81850a9993ac278396bb77e36c.tar.gz |
--help: strdup the category
... since it is converted and the original pointer is freed on Windows
unicode handling.
Follow-up to aa8777f63febc
Fixes #5977
Closes #5978
Reported-by: xwxbug on github
Diffstat (limited to 'src/tool_help.c')
-rw-r--r-- | src/tool_help.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/tool_help.c b/src/tool_help.c index 54a37e6b2..a67e4bc85 100644 --- a/src/tool_help.c +++ b/src/tool_help.c @@ -899,35 +899,31 @@ static void get_categories(void) } -void tool_help(const char *category) +void tool_help(char *category) { puts("Usage: curl [options...] <url>"); /* If no category was provided */ if(!category) { const char *category_note = "\nThis is not the full help, this " - "menu is stripped into categories.\nUse \"--help category\" to get " - "an overview of all categories.\nFor all options use the manual" - " or \"--help all\"."; + "menu is stripped into categories.\nUse \"--help category\" to get " + "an overview of all categories.\nFor all options use the manual" + " or \"--help all\"."; print_category(CURLHELP_IMPORTANT); puts(category_note); - return; } /* Lets print everything if "all" was provided */ - if(curl_strequal(category, "all")) { + else if(curl_strequal(category, "all")) /* Print everything except hidden */ print_category(~(CURLHELP_HIDDEN)); - return; - } /* Lets handle the string "category" differently to not print an errormsg */ - if(curl_strequal(category, "category")) { + else if(curl_strequal(category, "category")) get_categories(); - return; - } /* Otherwise print category and handle the case if the cat was not found */ - if(get_category_content(category)) { + else if(get_category_content(category)) { puts("Invalid category provided, here is a list of all categories:\n"); get_categories(); } + free(category); } static int |