config->errors = stderr; /* default errors to stderr */
config->postfieldsize = -1;
- config->showerror = -1; /* will show errors */
config->use_httpget = FALSE;
config->create_dirs = FALSE;
config->maxredirs = DEFAULT_MAXREDIRS;
char *dns_interface; /* interface name */
char *dns_ipv4_addr; /* dot notation */
char *dns_ipv6_addr; /* dot notation */
- int showerror; /* -1 == unset, default => show errors
- 0 => -s is used to NOT show errors
- 1 => -S has been used to show errors */
char *userpwd;
char *login_options;
char *tls_username;
struct GlobalConfig {
CURL *easy; /* Once we have one, we keep it here */
+ int showerror; /* -1 == unset, default => show errors
+ 0 => -s is used to NOT show errors
+ 1 => -S has been used to show errors */
struct OperationConfig *first;
struct OperationConfig *current;
config->mute = config->noprogress = TRUE;
else
config->mute = config->noprogress = FALSE;
- if(config->showerror < 0)
+ if(global->showerror < 0)
/* if still on the default value, set showerror to the reverse of
toggle. This is to allow -S and -s to be used in an independent
order but still have the same effect. */
- config->showerror = (!toggle)?TRUE:FALSE; /* toggle off */
+ global->showerror = (!toggle)?TRUE:FALSE; /* toggle off */
break;
case 'S':
/* show errors */
- config->showerror = toggle?1:0; /* toggle on if used with -s */
+ global->showerror = toggle?1:0; /* toggle on if used with -s */
break;
case 't':
/* Telnet options */
_djstat_flags |= _STAT_INODE | _STAT_EXEC_MAGIC | _STAT_DIRSIZE;
#endif
+ /* Initialise the global config */
+ config->showerror = -1; /* Will show errors */
+
/* Allocate the initial operate config */
config->first = config->last = malloc(sizeof(struct OperationConfig));
if(config->first) {
result = operate(&global, argc, argv);
#ifdef __SYMBIAN32__
- if(global.first->showerror)
+ if(global.showerror)
tool_pressanykey();
#endif
}
#endif /* __VMS */
-static CURLcode operate_do(struct OperationConfig *config)
+static CURLcode operate_do(struct GlobalConfig *global,
+ struct OperationConfig *config)
{
char errorbuffer[CURL_ERROR_SIZE];
struct ProgressData progressbar;
if(!config->globoff && infiles) {
/* Unless explicitly shut off */
res = glob_url(&inglob, infiles, &infilenum,
- config->showerror?config->errors:NULL);
+ global->showerror?config->errors:NULL);
if(res) {
Curl_safefree(outfiles);
break;
/* Unless explicitly shut off, we expand '{...}' and '[...]'
expressions and return total number of URLs in pattern set */
res = glob_url(&urls, urlnode->url, &urlnum,
- config->showerror?config->errors:NULL);
+ global->showerror?config->errors:NULL);
if(res) {
Curl_safefree(uploadfile);
break;
#ifdef __VMS
if(is_vms_shell()) {
/* VMS DCL shell behavior */
- if(!config->showerror)
+ if(!global->showerror)
vms_show = VMSSTS_HIDE;
}
else
#endif
- if(res && config->showerror) {
+ if(res && global->showerror) {
fprintf(config->errors, "curl: (%d) %s\n", res, (errorbuffer[0]) ?
errorbuffer : curl_easy_strerror((CURLcode)res));
if(res == CURLE_SSL_CACERT)
/* Perform each operation */
while(!result && config->current) {
- result = operate_do(config->current);
+ result = operate_do(config, config->current);
config->current = config->current->next;
}