mirror of
https://github.com/moparisthebest/curl
synced 2024-12-23 00:28:48 -05:00
tool: Moved --showerror to the global config
Other global options such as --libcurl, --trace and --verbose to follow.
This commit is contained in:
parent
0704dd770d
commit
249dc83571
@ -32,7 +32,6 @@ void config_init(struct OperationConfig* config)
|
|||||||
|
|
||||||
config->errors = stderr; /* default errors to stderr */
|
config->errors = stderr; /* default errors to stderr */
|
||||||
config->postfieldsize = -1;
|
config->postfieldsize = -1;
|
||||||
config->showerror = -1; /* will show errors */
|
|
||||||
config->use_httpget = FALSE;
|
config->use_httpget = FALSE;
|
||||||
config->create_dirs = FALSE;
|
config->create_dirs = FALSE;
|
||||||
config->maxredirs = DEFAULT_MAXREDIRS;
|
config->maxredirs = DEFAULT_MAXREDIRS;
|
||||||
|
@ -70,9 +70,6 @@ struct OperationConfig {
|
|||||||
char *dns_interface; /* interface name */
|
char *dns_interface; /* interface name */
|
||||||
char *dns_ipv4_addr; /* dot notation */
|
char *dns_ipv4_addr; /* dot notation */
|
||||||
char *dns_ipv6_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 *userpwd;
|
||||||
char *login_options;
|
char *login_options;
|
||||||
char *tls_username;
|
char *tls_username;
|
||||||
@ -222,6 +219,9 @@ struct OperationConfig {
|
|||||||
|
|
||||||
struct GlobalConfig {
|
struct GlobalConfig {
|
||||||
CURL *easy; /* Once we have one, we keep it here */
|
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 *first;
|
||||||
struct OperationConfig *current;
|
struct OperationConfig *current;
|
||||||
|
@ -1619,15 +1619,15 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
config->mute = config->noprogress = TRUE;
|
config->mute = config->noprogress = TRUE;
|
||||||
else
|
else
|
||||||
config->mute = config->noprogress = FALSE;
|
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
|
/* 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
|
toggle. This is to allow -S and -s to be used in an independent
|
||||||
order but still have the same effect. */
|
order but still have the same effect. */
|
||||||
config->showerror = (!toggle)?TRUE:FALSE; /* toggle off */
|
global->showerror = (!toggle)?TRUE:FALSE; /* toggle off */
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
/* show errors */
|
/* 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;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
/* Telnet options */
|
/* Telnet options */
|
||||||
|
@ -130,6 +130,9 @@ static CURLcode main_init(struct GlobalConfig *config)
|
|||||||
_djstat_flags |= _STAT_INODE | _STAT_EXEC_MAGIC | _STAT_DIRSIZE;
|
_djstat_flags |= _STAT_INODE | _STAT_EXEC_MAGIC | _STAT_DIRSIZE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Initialise the global config */
|
||||||
|
config->showerror = -1; /* Will show errors */
|
||||||
|
|
||||||
/* Allocate the initial operate config */
|
/* Allocate the initial operate config */
|
||||||
config->first = config->last = malloc(sizeof(struct OperationConfig));
|
config->first = config->last = malloc(sizeof(struct OperationConfig));
|
||||||
if(config->first) {
|
if(config->first) {
|
||||||
@ -213,7 +216,7 @@ int main(int argc, char *argv[])
|
|||||||
result = operate(&global, argc, argv);
|
result = operate(&global, argc, argv);
|
||||||
|
|
||||||
#ifdef __SYMBIAN32__
|
#ifdef __SYMBIAN32__
|
||||||
if(global.first->showerror)
|
if(global.showerror)
|
||||||
tool_pressanykey();
|
tool_pressanykey();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -187,7 +187,8 @@ static curl_off_t VmsSpecialSize(const char * name,
|
|||||||
}
|
}
|
||||||
#endif /* __VMS */
|
#endif /* __VMS */
|
||||||
|
|
||||||
static CURLcode operate_do(struct OperationConfig *config)
|
static CURLcode operate_do(struct GlobalConfig *global,
|
||||||
|
struct OperationConfig *config)
|
||||||
{
|
{
|
||||||
char errorbuffer[CURL_ERROR_SIZE];
|
char errorbuffer[CURL_ERROR_SIZE];
|
||||||
struct ProgressData progressbar;
|
struct ProgressData progressbar;
|
||||||
@ -408,7 +409,7 @@ static CURLcode operate_do(struct OperationConfig *config)
|
|||||||
if(!config->globoff && infiles) {
|
if(!config->globoff && infiles) {
|
||||||
/* Unless explicitly shut off */
|
/* Unless explicitly shut off */
|
||||||
res = glob_url(&inglob, infiles, &infilenum,
|
res = glob_url(&inglob, infiles, &infilenum,
|
||||||
config->showerror?config->errors:NULL);
|
global->showerror?config->errors:NULL);
|
||||||
if(res) {
|
if(res) {
|
||||||
Curl_safefree(outfiles);
|
Curl_safefree(outfiles);
|
||||||
break;
|
break;
|
||||||
@ -459,7 +460,7 @@ static CURLcode operate_do(struct OperationConfig *config)
|
|||||||
/* Unless explicitly shut off, we expand '{...}' and '[...]'
|
/* Unless explicitly shut off, we expand '{...}' and '[...]'
|
||||||
expressions and return total number of URLs in pattern set */
|
expressions and return total number of URLs in pattern set */
|
||||||
res = glob_url(&urls, urlnode->url, &urlnum,
|
res = glob_url(&urls, urlnode->url, &urlnum,
|
||||||
config->showerror?config->errors:NULL);
|
global->showerror?config->errors:NULL);
|
||||||
if(res) {
|
if(res) {
|
||||||
Curl_safefree(uploadfile);
|
Curl_safefree(uploadfile);
|
||||||
break;
|
break;
|
||||||
@ -1554,12 +1555,12 @@ static CURLcode operate_do(struct OperationConfig *config)
|
|||||||
#ifdef __VMS
|
#ifdef __VMS
|
||||||
if(is_vms_shell()) {
|
if(is_vms_shell()) {
|
||||||
/* VMS DCL shell behavior */
|
/* VMS DCL shell behavior */
|
||||||
if(!config->showerror)
|
if(!global->showerror)
|
||||||
vms_show = VMSSTS_HIDE;
|
vms_show = VMSSTS_HIDE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if(res && config->showerror) {
|
if(res && global->showerror) {
|
||||||
fprintf(config->errors, "curl: (%d) %s\n", res, (errorbuffer[0]) ?
|
fprintf(config->errors, "curl: (%d) %s\n", res, (errorbuffer[0]) ?
|
||||||
errorbuffer : curl_easy_strerror((CURLcode)res));
|
errorbuffer : curl_easy_strerror((CURLcode)res));
|
||||||
if(res == CURLE_SSL_CACERT)
|
if(res == CURLE_SSL_CACERT)
|
||||||
@ -1836,7 +1837,7 @@ CURLcode operate(struct GlobalConfig *config, int argc, argv_item_t argv[])
|
|||||||
|
|
||||||
/* Perform each operation */
|
/* Perform each operation */
|
||||||
while(!result && config->current) {
|
while(!result && config->current) {
|
||||||
result = operate_do(config->current);
|
result = operate_do(config, config->current);
|
||||||
|
|
||||||
config->current = config->current->next;
|
config->current = config->current->next;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user