1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 16:18:48 -05:00

tool_cfgable: Renamed Configurable structure to OperationConfig

To allow for the addition of a global config structure and prevent
confusion between the two.
This commit is contained in:
Steve Holme 2014-02-23 12:59:59 +00:00
parent 6512e93be1
commit 705a4cb549
32 changed files with 99 additions and 103 deletions

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, 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
@ -44,7 +44,7 @@ int tool_debug_cb(CURL *handle, curl_infotype type,
unsigned char *data, size_t size, unsigned char *data, size_t size,
void *userdata) void *userdata)
{ {
struct Configurable *config = userdata; struct OperationConfig *config = userdata;
FILE *output = config->errors; FILE *output = config->errors;
const char *text; const char *text;
struct timeval tv; struct timeval tv;

View File

@ -101,7 +101,7 @@ int tool_progress_cb(void *clientp,
} }
void progressbarinit(struct ProgressData *bar, void progressbarinit(struct ProgressData *bar,
struct Configurable *config) struct OperationConfig *config)
{ {
#ifdef __EMX__ #ifdef __EMX__
/* 20000318 mgs */ /* 20000318 mgs */
@ -148,4 +148,3 @@ void progressbarinit(struct ProgressData *bar,
bar->out = config->errors; bar->out = config->errors;
} }

View File

@ -7,7 +7,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
@ -36,7 +36,7 @@ struct ProgressData {
}; };
void progressbarinit(struct ProgressData *bar, void progressbarinit(struct ProgressData *bar,
struct Configurable *config); struct OperationConfig *config);
/* /*
** callback for CURLOPT_PROGRESSFUNCTION ** callback for CURLOPT_PROGRESSFUNCTION

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, 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
@ -39,7 +39,7 @@ size_t tool_write_cb(void *buffer, size_t sz, size_t nmemb, void *userdata)
{ {
size_t rc; size_t rc;
struct OutStruct *outs = userdata; struct OutStruct *outs = userdata;
struct Configurable *config = outs->config; struct OperationConfig *config = outs->config;
/* /*
* Once that libcurl has called back tool_write_cb() the returned value * Once that libcurl has called back tool_write_cb() the returned value

View File

@ -26,9 +26,9 @@
#include "memdebug.h" /* keep this as LAST include */ #include "memdebug.h" /* keep this as LAST include */
void config_init(struct Configurable* config) void config_init(struct OperationConfig* config)
{ {
memset(config, 0, sizeof(struct Configurable)); memset(config, 0, sizeof(struct OperationConfig));
config->errors = stderr; /* default errors to stderr */ config->errors = stderr; /* default errors to stderr */
config->postfieldsize = -1; config->postfieldsize = -1;
@ -43,7 +43,7 @@ void config_init(struct Configurable* config)
config->proto_redir_present = FALSE; config->proto_redir_present = FALSE;
} }
static void free_config_fields(struct Configurable *config) static void free_config_fields(struct OperationConfig *config)
{ {
struct getout *urlnode; struct getout *urlnode;
@ -150,9 +150,9 @@ static void free_config_fields(struct Configurable *config)
Curl_safefree(config->libcurl); Curl_safefree(config->libcurl);
} }
void config_free(struct Configurable *config) void config_free(struct OperationConfig *config)
{ {
struct Configurable *last = config; struct OperationConfig *last = config;
/* Find the last config structure */ /* Find the last config structure */
while(last->next) while(last->next)
@ -160,7 +160,7 @@ void config_free(struct Configurable *config)
/* Free each of the structures in reverse order */ /* Free each of the structures in reverse order */
do { do {
struct Configurable *prev = last->prev; struct OperationConfig *prev = last->prev;
if(prev) if(prev)
last->easy = NULL; last->easy = NULL;

View File

@ -27,7 +27,7 @@
#include "tool_metalink.h" #include "tool_metalink.h"
struct Configurable { struct OperationConfig {
CURL *easy; /* once we have one, we keep it here */ CURL *easy; /* once we have one, we keep it here */
bool remote_time; bool remote_time;
char *random_file; char *random_file;
@ -216,11 +216,11 @@ struct Configurable {
bool nonpn; /* enable/disable TLS NPN extension */ bool nonpn; /* enable/disable TLS NPN extension */
bool noalpn; /* enable/disable TLS ALPN extension */ bool noalpn; /* enable/disable TLS ALPN extension */
struct Configurable* prev; struct OperationConfig* prev;
struct Configurable* next; /* Always last in the struct */ struct OperationConfig* next; /* Always last in the struct */
}; };
void config_init(struct Configurable* config); void config_init(struct OperationConfig* config);
void config_free(struct Configurable* config); void config_free(struct OperationConfig* config);
#endif /* HEADER_CURL_TOOL_CFGABLE_H */ #endif /* HEADER_CURL_TOOL_CFGABLE_H */

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, 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
@ -262,7 +262,8 @@ char **__crt0_glob_function(char *arg)
* HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\SafeProcessSearchMode * HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\SafeProcessSearchMode
*/ */
CURLcode FindWin32CACert(struct Configurable *config, const char *bundle_file) CURLcode FindWin32CACert(struct OperationConfig *config,
const char *bundle_file)
{ {
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
@ -296,4 +297,3 @@ CURLcode FindWin32CACert(struct Configurable *config, const char *bundle_file)
#endif /* WIN32 */ #endif /* WIN32 */
#endif /* MSDOS || WIN32 */ #endif /* MSDOS || WIN32 */

View File

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, 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
@ -35,7 +35,7 @@ char **__crt0_glob_function(char *arg);
#ifdef WIN32 #ifdef WIN32
CURLcode FindWin32CACert(struct Configurable *config, const char *bundle_file); CURLcode FindWin32CACert(struct OperationConfig *config, const char *bundle_file);
#endif /* WIN32 */ #endif /* WIN32 */

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, 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
@ -165,7 +165,7 @@ CURLcode easysrc_cleanup(void)
return CURLE_OK; return CURLE_OK;
} }
void dumpeasysrc(struct Configurable *config) void dumpeasysrc(struct OperationConfig *config)
{ {
struct curl_slist *ptr; struct curl_slist *ptr;
char *o = config->libcurl; char *o = config->libcurl;

View File

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, 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
@ -40,7 +40,7 @@ extern CURLcode easysrc_add(struct curl_slist **plist, const char *bupf);
extern CURLcode easysrc_addf(struct curl_slist **plist, const char *fmt, ...); extern CURLcode easysrc_addf(struct curl_slist **plist, const char *fmt, ...);
extern CURLcode easysrc_perform(void); extern CURLcode easysrc_perform(void);
extern CURLcode easysrc_cleanup(void); extern CURLcode easysrc_cleanup(void);
void dumpeasysrc(struct Configurable *config); void dumpeasysrc(struct OperationConfig *config);
#endif /* CURL_DISABLE_LIBCURL_OPTION */ #endif /* CURL_DISABLE_LIBCURL_OPTION */

View File

@ -140,7 +140,7 @@ static char *get_param_word(char **str, char **end_pos)
* *
***************************************************************************/ ***************************************************************************/
int formparse(struct Configurable *config, int formparse(struct OperationConfig *config,
const char *input, const char *input,
struct curl_httppost **httppost, struct curl_httppost **httppost,
struct curl_httppost **last_post, struct curl_httppost **last_post,

View File

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, 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
@ -23,7 +23,7 @@
***************************************************************************/ ***************************************************************************/
#include "tool_setup.h" #include "tool_setup.h"
int formparse(struct Configurable *config, int formparse(struct OperationConfig *config,
const char *input, const char *input,
struct curl_httppost **httppost, struct curl_httppost **httppost,
struct curl_httppost **last_post, struct curl_httppost **last_post,

View File

@ -373,7 +373,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
char *nextarg, /* NULL if unset */ char *nextarg, /* NULL if unset */
bool *usedarg, /* set to TRUE if the arg bool *usedarg, /* set to TRUE if the arg
has been used */ has been used */
struct Configurable *config) struct OperationConfig *config)
{ {
char letter; char letter;
char subletter = '\0'; /* subletters can only occur on long options */ char subletter = '\0'; /* subletters can only occur on long options */
@ -1798,7 +1798,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
return PARAM_OK; return PARAM_OK;
} }
ParameterError parse_args(struct Configurable *config, int argc, ParameterError parse_args(struct OperationConfig *config, int argc,
argv_item_t argv[]) argv_item_t argv[])
{ {
int i; int i;
@ -1813,7 +1813,7 @@ ParameterError parse_args(struct Configurable *config, int argc,
(config->url_list && config->url_list->url)) { (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 OperationConfig));
if(config->next) { if(config->next) {
/* Initialise the newly created config */ /* Initialise the newly created config */
config_init(config->next); config_init(config->next);

View File

@ -41,12 +41,12 @@ typedef enum {
PARAM_LAST PARAM_LAST
} ParameterError; } ParameterError;
struct Configurable; struct OperationConfig;
ParameterError getparameter(char *flag, ParameterError getparameter(char *flag,
char *nextarg, char *nextarg,
bool *usedarg, bool *usedarg,
struct Configurable *config); struct OperationConfig *config);
#ifdef UNITTESTS #ifdef UNITTESTS
void parse_cert_parameter(const char *cert_parameter, void parse_cert_parameter(const char *cert_parameter,
@ -54,7 +54,7 @@ void parse_cert_parameter(const char *cert_parameter,
char **passphrase); char **passphrase);
#endif #endif
ParameterError parse_args(struct Configurable *config, int argc, ParameterError parse_args(struct OperationConfig *config, int argc,
argv_item_t argv[]); argv_item_t argv[]);
#endif /* HEADER_CURL_TOOL_GETPARAM_H */ #endif /* HEADER_CURL_TOOL_GETPARAM_H */

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, 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
@ -65,7 +65,7 @@ const char *param2text(int res)
} }
} }
int SetHTTPrequest(struct Configurable *config, HttpReq req, HttpReq *store) int SetHTTPrequest(struct OperationConfig *config, HttpReq req, HttpReq *store)
{ {
if((*store == HTTPREQ_UNSPEC) || if((*store == HTTPREQ_UNSPEC) ||
(*store == req)) { (*store == req)) {
@ -75,4 +75,3 @@ int SetHTTPrequest(struct Configurable *config, HttpReq req, HttpReq *store)
warnf(config, "You can only select one HTTP request!\n"); warnf(config, "You can only select one HTTP request!\n");
return 1; return 1;
} }

View File

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, 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
@ -25,7 +25,7 @@
const char *param2text(int res); const char *param2text(int res);
int SetHTTPrequest(struct Configurable *config, HttpReq req, HttpReq *store); int SetHTTPrequest(struct OperationConfig *config, HttpReq req, HttpReq *store);
#endif /* HEADER_CURL_TOOL_HELPERS_H */ #endif /* HEADER_CURL_TOOL_HELPERS_H */

View File

@ -121,7 +121,7 @@ static void memory_tracking_init(void)
* _any_ libcurl usage. If this fails, *NO* libcurl functions may be * _any_ libcurl usage. If this fails, *NO* libcurl functions may be
* used, or havoc may be the result. * used, or havoc may be the result.
*/ */
static CURLcode main_init(struct Configurable *config) static CURLcode main_init(struct OperationConfig *config)
{ {
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
@ -162,7 +162,7 @@ static void main_free(void)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
struct Configurable *config; struct OperationConfig *config;
main_checkfds(); main_checkfds();
@ -174,7 +174,7 @@ int main(int argc, char *argv[])
memory_tracking_init(); memory_tracking_init();
/* Allocate the initial config */ /* Allocate the initial config */
config = malloc(sizeof(struct Configurable)); config = malloc(sizeof(struct OperationConfig));
if(config) { if(config) {
/* Initialise the config */ /* Initialise the config */

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, 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
@ -594,7 +594,7 @@ static int check_hash(const char *filename,
return check_ok; return check_ok;
} }
int metalink_check_hash(struct Configurable *config, int metalink_check_hash(struct OperationConfig *config,
metalinkfile *mlfile, metalinkfile *mlfile,
const char *filename) const char *filename)
{ {
@ -712,7 +712,7 @@ static metalinkfile *new_metalinkfile(metalink_file_t *fileinfo)
return f; return f;
} }
int parse_metalink(struct Configurable *config, struct OutStruct *outs, int parse_metalink(struct OperationConfig *config, struct OutStruct *outs,
const char *metalink_url) const char *metalink_url)
{ {
metalink_error_t r; metalink_error_t r;
@ -791,7 +791,7 @@ size_t metalink_write_cb(void *buffer, size_t sz, size_t nmemb,
void *userdata) void *userdata)
{ {
struct OutStruct *outs = userdata; struct OutStruct *outs = userdata;
struct Configurable *config = outs->config; struct OperationConfig *config = outs->config;
int rv; int rv;
/* /*
@ -878,7 +878,7 @@ static void delete_metalinkfile(metalinkfile *mlfile)
Curl_safefree(mlfile); Curl_safefree(mlfile);
} }
void clean_metalink(struct Configurable *config) void clean_metalink(struct OperationConfig *config)
{ {
while(config->metalinkfile_list) { while(config->metalinkfile_list) {
metalinkfile *mlfile = config->metalinkfile_list; metalinkfile *mlfile = config->metalinkfile_list;

View File

@ -101,7 +101,7 @@ extern const digest_params SHA256_DIGEST_PARAMS[1];
* Counts the resource in the metalinkfile. * Counts the resource in the metalinkfile.
*/ */
int count_next_metalink_resource(metalinkfile *mlfile); int count_next_metalink_resource(metalinkfile *mlfile);
void clean_metalink(struct Configurable *config); void clean_metalink(struct OperationConfig *config);
/* /*
* Performs final parse operation and extracts information from * Performs final parse operation and extracts information from
@ -113,7 +113,7 @@ void clean_metalink(struct Configurable *config);
* -1: Parsing failed; or no file is found * -1: Parsing failed; or no file is found
* -2: Parsing succeeded with some warnings. * -2: Parsing succeeded with some warnings.
*/ */
int parse_metalink(struct Configurable *config, struct OutStruct *outs, int parse_metalink(struct OperationConfig *config, struct OutStruct *outs,
const char *metalink_url); const char *metalink_url);
/* /*
@ -142,7 +142,7 @@ int check_metalink_content_type(const char *content_type);
* No checksum in Metalink supported, hash algorithm not available, or * No checksum in Metalink supported, hash algorithm not available, or
* Metalink does not contain checksum. * Metalink does not contain checksum.
*/ */
int metalink_check_hash(struct Configurable *config, int metalink_check_hash(struct OperationConfig *config,
metalinkfile *mlfile, metalinkfile *mlfile,
const char *filename); const char *filename);

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, 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
@ -38,7 +38,7 @@
* mute (--silent) was selected. * mute (--silent) was selected.
*/ */
void warnf(struct Configurable *config, const char *fmt, ...) void warnf(struct OperationConfig *config, const char *fmt, ...)
{ {
if(!config->mute) { if(!config->mute) {
va_list ap; va_list ap;

View File

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, 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
@ -23,7 +23,7 @@
***************************************************************************/ ***************************************************************************/
#include "tool_setup.h" #include "tool_setup.h"
void warnf(struct Configurable *config, const char *fmt, ...); void warnf(struct OperationConfig *config, const char *fmt, ...);
void helpf(FILE *errors, const char *fmt, ...); void helpf(FILE *errors, const char *fmt, ...);

View File

@ -187,7 +187,7 @@ static curl_off_t VmsSpecialSize(const char * name,
} }
#endif /* __VMS */ #endif /* __VMS */
static CURLcode operate_init(struct Configurable *config) static CURLcode operate_init(struct OperationConfig *config)
{ {
/* Get a curl handle to use for all forthcoming curl transfers */ /* Get a curl handle to use for all forthcoming curl transfers */
config->easy = curl_easy_init(); config->easy = curl_easy_init();
@ -204,7 +204,7 @@ static CURLcode operate_init(struct Configurable *config)
return CURLE_OK; return CURLE_OK;
} }
static CURLcode operate_do(struct Configurable *config) static CURLcode operate_do(struct OperationConfig *config)
{ {
char errorbuffer[CURL_ERROR_SIZE]; char errorbuffer[CURL_ERROR_SIZE];
struct ProgressData progressbar; struct ProgressData progressbar;
@ -1792,7 +1792,7 @@ static CURLcode operate_do(struct Configurable *config)
return (CURLcode)res; return (CURLcode)res;
} }
static void operate_free(struct Configurable *config) static void operate_free(struct OperationConfig *config)
{ {
if(config->easy) { if(config->easy) {
curl_easy_cleanup(config->easy); curl_easy_cleanup(config->easy);
@ -1803,7 +1803,7 @@ static void operate_free(struct Configurable *config)
clean_metalink(config); clean_metalink(config);
} }
CURLcode operate(struct Configurable *config, int argc, argv_item_t argv[]) CURLcode operate(struct OperationConfig *config, int argc, argv_item_t argv[])
{ {
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
@ -1847,7 +1847,7 @@ CURLcode operate(struct Configurable *config, int argc, argv_item_t argv[])
/* Perform the main operations */ /* Perform the main operations */
else { else {
size_t count = 0; size_t count = 0;
struct Configurable *operation = config; struct OperationConfig *operation = config;
/* Get the required aguments for each operation */ /* Get the required aguments for each operation */
while(!result && operation) { while(!result && operation) {

View File

@ -23,7 +23,7 @@
***************************************************************************/ ***************************************************************************/
#include "tool_setup.h" #include "tool_setup.h"
CURLcode operate(struct Configurable *config, int argc, argv_item_t argv[]); CURLcode operate(struct OperationConfig *config, int argc, argv_item_t argv[]);
#endif /* HEADER_CURL_TOOL_OPERATE_H */ #endif /* HEADER_CURL_TOOL_OPERATE_H */

View File

@ -34,7 +34,7 @@
#include "memdebug.h" /* keep this as LAST include */ #include "memdebug.h" /* keep this as LAST include */
void clean_getout(struct Configurable *config) void clean_getout(struct OperationConfig *config)
{ {
struct getout *next; struct getout *next;
struct getout *node = config->url_list; struct getout *node = config->url_list;

View File

@ -23,9 +23,9 @@
***************************************************************************/ ***************************************************************************/
#include "tool_setup.h" #include "tool_setup.h"
struct Configurable; struct OperationConfig;
void clean_getout(struct Configurable *config); void clean_getout(struct OperationConfig *config);
bool output_expected(const char *url, const char *uploadfile); bool output_expected(const char *url, const char *uploadfile);

View File

@ -37,7 +37,7 @@
#include "memdebug.h" /* keep this as LAST include */ #include "memdebug.h" /* keep this as LAST include */
struct getout *new_getout(struct Configurable *config) struct getout *new_getout(struct OperationConfig *config)
{ {
struct getout *node = calloc(1, sizeof(struct getout)); struct getout *node = calloc(1, sizeof(struct getout));
struct getout *last = config->url_last; struct getout *last = config->url_last;
@ -241,7 +241,7 @@ ParameterError str2udouble(double *val, const char *str)
* data. * data.
*/ */
long proto2num(struct Configurable *config, long *val, const char *str) long proto2num(struct OperationConfig *config, long *val, const char *str)
{ {
char *buffer; char *buffer;
const char *sep = ","; const char *sep = ",";
@ -439,7 +439,7 @@ ParameterError add2list(struct curl_slist **list, const char *ptr)
return PARAM_OK; return PARAM_OK;
} }
int ftpfilemethod(struct Configurable *config, const char *str) int ftpfilemethod(struct OperationConfig *config, const char *str)
{ {
if(curlx_raw_equal("singlecwd", str)) if(curlx_raw_equal("singlecwd", str))
return CURLFTPMETHOD_SINGLECWD; return CURLFTPMETHOD_SINGLECWD;
@ -451,7 +451,7 @@ int ftpfilemethod(struct Configurable *config, const char *str)
return CURLFTPMETHOD_MULTICWD; return CURLFTPMETHOD_MULTICWD;
} }
int ftpcccmethod(struct Configurable *config, const char *str) int ftpcccmethod(struct OperationConfig *config, const char *str)
{ {
if(curlx_raw_equal("passive", str)) if(curlx_raw_equal("passive", str))
return CURLFTPSSL_CCC_PASSIVE; return CURLFTPSSL_CCC_PASSIVE;
@ -461,7 +461,7 @@ int ftpcccmethod(struct Configurable *config, const char *str)
return CURLFTPSSL_CCC_PASSIVE; return CURLFTPSSL_CCC_PASSIVE;
} }
long delegation(struct Configurable *config, char *str) long delegation(struct OperationConfig *config, char *str)
{ {
if(curlx_raw_equal("none", str)) if(curlx_raw_equal("none", str))
return CURLGSSAPI_DELEGATION_NONE; return CURLGSSAPI_DELEGATION_NONE;
@ -481,7 +481,7 @@ static char *my_useragent(void)
return strdup(CURL_NAME "/" CURL_VERSION); return strdup(CURL_NAME "/" CURL_VERSION);
} }
CURLcode get_args(struct Configurable *config, const size_t i) CURLcode get_args(struct OperationConfig *config, const size_t i)
{ {
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
bool last = (config->next ? FALSE : TRUE); bool last = (config->next ? FALSE : TRUE);

View File

@ -23,7 +23,7 @@
***************************************************************************/ ***************************************************************************/
#include "tool_setup.h" #include "tool_setup.h"
struct getout *new_getout(struct Configurable *config); struct getout *new_getout(struct OperationConfig *config);
ParameterError file2string(char **bufp, FILE *file); ParameterError file2string(char **bufp, FILE *file);
@ -36,19 +36,19 @@ ParameterError str2unum(long *val, const char *str);
ParameterError str2double(double *val, const char *str); ParameterError str2double(double *val, const char *str);
ParameterError str2udouble(double *val, const char *str); ParameterError str2udouble(double *val, const char *str);
long proto2num(struct Configurable *config, long *val, const char *str); long proto2num(struct OperationConfig *config, long *val, const char *str);
ParameterError str2offset(curl_off_t *val, const char *str); ParameterError str2offset(curl_off_t *val, const char *str);
CURLcode get_args(struct Configurable *config, const size_t index); CURLcode get_args(struct OperationConfig *config, const size_t i);
ParameterError add2list(struct curl_slist **list, const char *ptr); ParameterError add2list(struct curl_slist **list, const char *ptr);
int ftpfilemethod(struct Configurable *config, const char *str); int ftpfilemethod(struct OperationConfig *config, const char *str);
int ftpcccmethod(struct Configurable *config, const char *str); int ftpcccmethod(struct OperationConfig *config, const char *str);
long delegation(struct Configurable *config, char *str); long delegation(struct OperationConfig *config, char *str);
#endif /* HEADER_CURL_TOOL_PARAMHLP_H */ #endif /* HEADER_CURL_TOOL_PARAMHLP_H */

View File

@ -44,8 +44,7 @@ static const char *unslashquote(const char *line, char *param);
static char *my_get_line(FILE *fp); static char *my_get_line(FILE *fp);
/* return 0 on everything-is-fine, and non-zero otherwise */ /* return 0 on everything-is-fine, and non-zero otherwise */
int parseconfig(const char *filename, int parseconfig(const char *filename, struct OperationConfig *config)
struct Configurable *config)
{ {
int res; int res;
FILE *file; FILE *file;

View File

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, 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
@ -23,8 +23,7 @@
***************************************************************************/ ***************************************************************************/
#include "tool_setup.h" #include "tool_setup.h"
int parseconfig(const char *filename, int parseconfig(const char *filename, struct OperationConfig *config);
struct Configurable *config);
#endif /* HEADER_CURL_TOOL_PARSECFG_H */ #endif /* HEADER_CURL_TOOL_PARSECFG_H */

View File

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, 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
@ -51,7 +51,7 @@
* 'stream' member is a pointer to a stream controlling object as returned * 'stream' member is a pointer to a stream controlling object as returned
* from a 'fopen' call or a standard stream. * from a 'fopen' call or a standard stream.
* *
* 'config' member is a pointer to associated 'Configurable' struct. * 'config' member is a pointer to associated 'OperationConfig' struct.
* *
* 'bytes' member represents amount written so far. * 'bytes' member represents amount written so far.
* *
@ -69,7 +69,7 @@ struct OutStruct {
bool s_isreg; bool s_isreg;
bool fopened; bool fopened;
FILE *stream; FILE *stream;
struct Configurable *config; struct OperationConfig *config;
curl_off_t bytes; curl_off_t bytes;
curl_off_t init; curl_off_t init;
#ifdef USE_METALINK #ifdef USE_METALINK
@ -85,12 +85,12 @@ struct OutStruct {
* 'fd' member is either 'stdin' file descriptor number STDIN_FILENO * 'fd' member is either 'stdin' file descriptor number STDIN_FILENO
* or a file descriptor as returned from an 'open' call for some file. * or a file descriptor as returned from an 'open' call for some file.
* *
* 'config' member is a pointer to associated 'Configurable' struct. * 'config' member is a pointer to associated 'OperationConfig' struct.
*/ */
struct InStruct { struct InStruct {
int fd; int fd;
struct Configurable *config; struct OperationConfig *config;
}; };
@ -143,7 +143,7 @@ typedef enum {
/* /*
* Complete struct declarations which have Configurable struct members, * Complete struct declarations which have OperationConfig struct members,
* just in case this header is directly included in some source file. * just in case this header is directly included in some source file.
*/ */

View File

@ -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,7 @@ static char *c_escape(const char *str)
} }
/* setopt wrapper for enum types */ /* setopt wrapper for enum types */
CURLcode tool_setopt_enum(CURL *curl, struct Configurable *config, CURLcode tool_setopt_enum(CURL *curl, struct OperationConfig *config,
const char *name, CURLoption tag, const char *name, CURLoption tag,
const NameValue *nvlist, long lval) const NameValue *nvlist, long lval)
{ {
@ -263,7 +263,7 @@ CURLcode tool_setopt_enum(CURL *curl, struct Configurable *config,
} }
/* setopt wrapper for flags */ /* setopt wrapper for flags */
CURLcode tool_setopt_flags(CURL *curl, struct Configurable *config, CURLcode tool_setopt_flags(CURL *curl, struct OperationConfig *config,
const char *name, CURLoption tag, const char *name, CURLoption tag,
const NameValue *nvlist, long lval) const NameValue *nvlist, long lval)
{ {
@ -305,7 +305,7 @@ CURLcode tool_setopt_flags(CURL *curl, struct Configurable *config,
} }
/* setopt wrapper for bitmasks */ /* setopt wrapper for bitmasks */
CURLcode tool_setopt_bitmask(CURL *curl, struct Configurable *config, CURLcode tool_setopt_bitmask(CURL *curl, struct OperationConfig *config,
const char *name, CURLoption tag, const char *name, CURLoption tag,
const NameValueUnsigned *nvlist, const NameValueUnsigned *nvlist,
long lval) long lval)
@ -348,7 +348,7 @@ CURLcode tool_setopt_bitmask(CURL *curl, struct Configurable *config,
} }
/* setopt wrapper for CURLOPT_HTTPPOST */ /* setopt wrapper for CURLOPT_HTTPPOST */
CURLcode tool_setopt_httppost(CURL *curl, struct Configurable *config, CURLcode tool_setopt_httppost(CURL *curl, struct OperationConfig *config,
const char *name, CURLoption tag, const char *name, CURLoption tag,
struct curl_httppost *post) struct curl_httppost *post)
{ {
@ -424,7 +424,7 @@ CURLcode tool_setopt_httppost(CURL *curl, struct Configurable *config,
} }
/* setopt wrapper for curl_slist options */ /* setopt wrapper for curl_slist options */
CURLcode tool_setopt_slist(CURL *curl, struct Configurable *config, CURLcode tool_setopt_slist(CURL *curl, struct OperationConfig *config,
const char *name, CURLoption tag, const char *name, CURLoption tag,
struct curl_slist *list) struct curl_slist *list)
{ {
@ -464,7 +464,7 @@ CURLcode tool_setopt_slist(CURL *curl, struct Configurable *config,
/* generic setopt wrapper for all other options. /* generic setopt wrapper for all other options.
* Some type information is encoded in the tag value. */ * Some type information is encoded in the tag value. */
CURLcode tool_setopt(CURL *curl, bool str, struct Configurable *config, CURLcode tool_setopt(CURL *curl, bool str, struct OperationConfig *config,
const char *name, CURLoption tag, ...) const char *name, CURLoption tag, ...)
{ {
va_list arg; va_list arg;

View File

@ -7,7 +7,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
@ -71,22 +71,22 @@ extern const NameValueUnsigned setopt_nv_CURLAUTH[];
/* Intercept setopt calls for --libcurl */ /* Intercept setopt calls for --libcurl */
CURLcode tool_setopt_enum(CURL *curl, struct Configurable *config, CURLcode tool_setopt_enum(CURL *curl, struct OperationConfig *config,
const char *name, CURLoption tag, const char *name, CURLoption tag,
const NameValue *nv, long lval); const NameValue *nv, long lval);
CURLcode tool_setopt_flags(CURL *curl, struct Configurable *config, CURLcode tool_setopt_flags(CURL *curl, struct OperationConfig *config,
const char *name, CURLoption tag, const char *name, CURLoption tag,
const NameValue *nv, long lval); const NameValue *nv, long lval);
CURLcode tool_setopt_bitmask(CURL *curl, struct Configurable *config, CURLcode tool_setopt_bitmask(CURL *curl, struct OperationConfig *config,
const char *name, CURLoption tag, const char *name, CURLoption tag,
const NameValueUnsigned *nv, long lval); const NameValueUnsigned *nv, long lval);
CURLcode tool_setopt_httppost(CURL *curl, struct Configurable *config, CURLcode tool_setopt_httppost(CURL *curl, struct OperationConfig *config,
const char *name, CURLoption tag, const char *name, CURLoption tag,
struct curl_httppost *httppost); struct curl_httppost *httppost);
CURLcode tool_setopt_slist(CURL *curl, struct Configurable *config, CURLcode tool_setopt_slist(CURL *curl, struct OperationConfig *config,
const char *name, CURLoption tag, const char *name, CURLoption tag,
struct curl_slist *list); struct curl_slist *list);
CURLcode tool_setopt(CURL *curl, bool str, struct Configurable *config, CURLcode tool_setopt(CURL *curl, bool str, struct OperationConfig *config,
const char *name, CURLoption tag, ...); const char *name, CURLoption tag, ...);
#define my_setopt(x,y,z) \ #define my_setopt(x,y,z) \