mirror of
https://github.com/moparisthebest/curl
synced 2024-12-23 00:28:48 -05:00
tool_cfgable: Removed list_engine flag from config structure
In preparation for separating the global config options from the per operation config options, reworked the list engines code to not use a member variable in the Configurable structure.
This commit is contained in:
parent
b914e7ed02
commit
e6e8b14405
@ -120,7 +120,6 @@ struct Configurable {
|
|||||||
char *pubkey;
|
char *pubkey;
|
||||||
char *hostpubmd5;
|
char *hostpubmd5;
|
||||||
char *engine;
|
char *engine;
|
||||||
bool list_engines;
|
|
||||||
bool crlf;
|
bool crlf;
|
||||||
char *customrequest;
|
char *customrequest;
|
||||||
char *krblevel;
|
char *krblevel;
|
||||||
|
@ -1310,7 +1310,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
case 'f': /* crypto engine */
|
case 'f': /* crypto engine */
|
||||||
GetStr(&config->engine, nextarg);
|
GetStr(&config->engine, nextarg);
|
||||||
if(config->engine && curlx_raw_equal(config->engine,"list"))
|
if(config->engine && curlx_raw_equal(config->engine,"list"))
|
||||||
config->list_engines = TRUE;
|
return PARAM_ENGINES_REQUESTED;
|
||||||
break;
|
break;
|
||||||
case 'g': /* CA info PEM file */
|
case 'g': /* CA info PEM file */
|
||||||
/* CA cert directory */
|
/* CA cert directory */
|
||||||
@ -1819,7 +1819,7 @@ ParameterError parse_args(struct Configurable *config, int argc,
|
|||||||
orig_opt = argv[i];
|
orig_opt = argv[i];
|
||||||
|
|
||||||
if(curlx_strequal(":", argv[i]) &&
|
if(curlx_strequal(":", argv[i]) &&
|
||||||
((config->url_list && config->url_list->url) || config->list_engines)) {
|
(config->url_list && config->url_list->url)) {
|
||||||
|
|
||||||
/* Allocate the next config */
|
/* Allocate the next config */
|
||||||
config->next = malloc(sizeof(struct Configurable));
|
config->next = malloc(sizeof(struct Configurable));
|
||||||
@ -1865,7 +1865,8 @@ ParameterError parse_args(struct Configurable *config, int argc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(result && result != PARAM_HELP_REQUESTED) {
|
if(result && result != PARAM_HELP_REQUESTED &&
|
||||||
|
result != PARAM_ENGINES_REQUESTED) {
|
||||||
const char *reason = param2text(result);
|
const char *reason = param2text(result);
|
||||||
|
|
||||||
if(!curlx_strequal(":", orig_opt))
|
if(!curlx_strequal(":", orig_opt))
|
||||||
|
@ -30,6 +30,7 @@ typedef enum {
|
|||||||
PARAM_REQUIRES_PARAMETER,
|
PARAM_REQUIRES_PARAMETER,
|
||||||
PARAM_BAD_USE,
|
PARAM_BAD_USE,
|
||||||
PARAM_HELP_REQUESTED,
|
PARAM_HELP_REQUESTED,
|
||||||
|
PARAM_ENGINES_REQUESTED,
|
||||||
PARAM_GOT_EXTRA_PARAMETER,
|
PARAM_GOT_EXTRA_PARAMETER,
|
||||||
PARAM_BAD_NUMERIC,
|
PARAM_BAD_NUMERIC,
|
||||||
PARAM_NEGATIVE_NUMERIC,
|
PARAM_NEGATIVE_NUMERIC,
|
||||||
|
@ -1826,14 +1826,13 @@ CURLcode operate(struct Configurable *config, int argc, argv_item_t argv[])
|
|||||||
/* Parse the command line arguments */
|
/* Parse the command line arguments */
|
||||||
ParameterError res = parse_args(config, argc, argv);
|
ParameterError res = parse_args(config, argc, argv);
|
||||||
if(res) {
|
if(res) {
|
||||||
if(res != PARAM_HELP_REQUESTED)
|
|
||||||
result = CURLE_FAILED_INIT;
|
|
||||||
else
|
|
||||||
result = CURLE_OK;
|
result = CURLE_OK;
|
||||||
}
|
|
||||||
/* Check if we were asked to list the SSL engines */
|
/* Check if we were asked to list the SSL engines */
|
||||||
else if(config->list_engines) {
|
if(res == PARAM_ENGINES_REQUESTED)
|
||||||
tool_list_engines(config->easy);
|
tool_list_engines(config->easy);
|
||||||
|
else if(res != PARAM_HELP_REQUESTED)
|
||||||
|
result = CURLE_FAILED_INIT;
|
||||||
}
|
}
|
||||||
/* Perform the main operations */
|
/* Perform the main operations */
|
||||||
else {
|
else {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -230,7 +230,8 @@ int parseconfig(const char *filename,
|
|||||||
if(!strcmp(filename, "-")) {
|
if(!strcmp(filename, "-")) {
|
||||||
filename = (char *)"<stdin>";
|
filename = (char *)"<stdin>";
|
||||||
}
|
}
|
||||||
if(PARAM_HELP_REQUESTED != res) {
|
if(res != PARAM_HELP_REQUESTED &&
|
||||||
|
res != PARAM_ENGINES_REQUESTED) {
|
||||||
const char *reason = param2text(res);
|
const char *reason = param2text(res);
|
||||||
warnf(config, "%s:%d: warning: '%s' %s\n",
|
warnf(config, "%s:%d: warning: '%s' %s\n",
|
||||||
filename, lineno, option, reason);
|
filename, lineno, option, reason);
|
||||||
|
Loading…
Reference in New Issue
Block a user