case 'h': /* h for help */
if(toggle) {
- global->help_category = nextarg;
+ if(nextarg) {
+ global->help_category = strdup(nextarg);
+ if(!global->help_category)
+ return PARAM_NO_MEM;
+ }
return PARAM_HELP_REQUESTED;
}
/* we now actually support --no-help too! */
}
-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
***************************************************************************/
#include "tool_setup.h"
-void tool_help(const char *category);
+void tool_help(char *category);
void tool_list_engines(void);
void tool_version_info(void);