/* use remote file's time */
config->remote_time = toggle;
break;
- case 's':
- /* don't show progress meter, don't show errors : */
- if(toggle)
- global->mute = global->noprogress = TRUE;
- else
- global->mute = global->noprogress = FALSE;
- 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. */
- global->showerror = (!toggle)?TRUE:FALSE; /* toggle off */
+ case 's': /* --silent */
+ global->silent = toggle;
break;
- case 'S':
- /* show errors */
- global->showerror = toggle?1:0; /* toggle on if used with -s */
+ case 'S': /* --show-error */
+ global->showerror = toggle;
break;
case 't':
/* Telnet options */
#ifdef __VMS
if(is_vms_shell()) {
/* VMS DCL shell behavior */
- if(!global->showerror)
+ if(global->silent && !global->showerror)
vms_show = VMSSTS_HIDE;
}
else
#endif
- if(!config->synthetic_error && result && global->showerror) {
+ if(!config->synthetic_error && result &&
+ (!global->silent || global->showerror)) {
const char *msg = per->errorbuffer;
fprintf(global->errors, "curl: (%d) %s\n", result,
(msg && msg[0]) ? msg : curl_easy_strerror(result));
long code = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &code);
if(code >= 400) {
- if(global->showerror)
+ if(!global->silent || global->showerror)
fprintf(global->errors,
"curl: (%d) The requested URL returned error: %ld\n",
CURLE_HTTP_RETURNED_ERROR, code);
if(!result && rc) {
/* something went wrong in the writing process */
result = CURLE_WRITE_ERROR;
- if(global->showerror)
+ if(!global->silent || global->showerror)
fprintf(global->errors, "curl: (%d) Failed writing body\n", result);
}
}
int rc;
/* We have written data to an output file, we truncate file
*/
- if(!global->mute)
+ if(!global->silent)
fprintf(global->errors, "Throwing away %"
CURL_FORMAT_CURL_OFF_T " bytes\n",
outs->bytes);
if(ftruncate(fileno(outs->stream), outs->init)) {
/* when truncate fails, we can't just append as then we'll
create something strange, bail out */
- if(global->showerror)
+ if(!global->silent || global->showerror)
fprintf(global->errors,
"curl: (23) Failed to truncate file\n");
return CURLE_WRITE_ERROR;
rc = fseek(outs->stream, (long)outs->init, SEEK_SET);
#endif
if(rc) {
- if(global->showerror)
+ if(!global->silent || global->showerror)
fprintf(global->errors,
"curl: (23) Failed seeking to end of file\n");
return CURLE_WRITE_ERROR;
if(!result && rc) {
/* something went wrong in the writing process */
result = CURLE_WRITE_ERROR;
- if(global->showerror)
+ if(!global->silent || global->showerror)
fprintf(global->errors, "curl: (%d) Failed writing body\n", result);
}
if(result && config->rm_partial) {
if(!config->globoff && infiles && !inglob) {
/* Unless explicitly shut off */
result = glob_url(&inglob, infiles, &state->infilenum,
- global->showerror?global->errors:NULL);
+ (!global->silent || global->showerror)?
+ global->errors:NULL);
if(result)
break;
config->state.inglob = inglob;
/* Unless explicitly shut off, we expand '{...}' and '[...]'
expressions and return total number of URLs in pattern set */
result = glob_url(&state->urls, urlnode->url, &state->urlnum,
- global->showerror?global->errors:NULL);
+ (!global->silent || global->showerror)?
+ global->errors:NULL);
if(result)
break;
urlnum = state->urlnum;
}
my_setopt_str(curl, CURLOPT_URL, per->this_url);
- my_setopt(curl, CURLOPT_NOPROGRESS, global->noprogress?1L:0L);
+ my_setopt(curl, CURLOPT_NOPROGRESS,
+ global->noprogress || global->silent?1L:0L);
if(config->no_body)
my_setopt(curl, CURLOPT_NOBODY, 1L);
progressbarinit(&per->progressbar, config);
if((global->progressmode == CURL_PROGRESS_BAR) &&
- !global->noprogress && !global->mute) {
+ !global->noprogress && !global->silent) {
/* we want the alternative style, then we have to implement it
ourselves! */
my_setopt(curl, CURLOPT_XFERINFOFUNCTION, tool_progress_cb);