diff options
author | Steve Holme <steve_holme@hotmail.com> | 2014-02-23 14:32:22 +0000 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2014-02-24 20:01:37 +0000 |
commit | 59b5ef444e4682f66d9a16ff793f60903857dd35 (patch) | |
tree | b999e92392ddb0440751e023c0095dde04c5c6e4 /src/tool_main.c | |
parent | 0d9ddf91ca896d5a4ed5525a426ff74bd2bc6726 (diff) | |
download | curl-59b5ef444e4682f66d9a16ff793f60903857dd35.tar.gz |
tool_main: Moved easy handle into global config structure
Diffstat (limited to 'src/tool_main.c')
-rw-r--r-- | src/tool_main.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/tool_main.c b/src/tool_main.c index bceb65c7b..009790493 100644 --- a/src/tool_main.c +++ b/src/tool_main.c @@ -131,7 +131,7 @@ static CURLcode main_init(struct GlobalConfig *config) #endif /* Allocate the initial operate config */ - config->first = malloc(sizeof(struct OperationConfig)); + config->first = config->last = malloc(sizeof(struct OperationConfig)); if(config->first) { /* Perform the libcurl initialization */ result = curl_global_init(CURL_GLOBAL_DEFAULT); @@ -140,8 +140,17 @@ static CURLcode main_init(struct GlobalConfig *config) result = get_libcurl_info(); if(!result) { - /* Initialise the config */ - config_init(config->first); + /* Get a curl handle to use for all forthcoming curl transfers */ + config->easy = curl_easy_init(); + if(config->easy) { + /* Initialise the config */ + config_init(config->first); + config->first->easy = config->easy; + } + else { + helpf(stderr, "error initializing curl easy handle\n"); + result = CURLE_FAILED_INIT; + } } else helpf(stderr, "error retrieving curl library information\n"); @@ -197,7 +206,7 @@ int main(int argc, char *argv[]) result = main_init(&global); if(!result) { /* Start our curl operation */ - result = operate(global.first, argc, argv); + result = operate(&global, argc, argv); #ifdef __SYMBIAN32__ if(global.first->showerror) |