mirror of
https://github.com/curl/curl.git
synced 2026-08-26 00:13:34 +03:00
curl: add long option '--out-null'
Add a new commandline option --out-null that discards all response bytes into the void. Replaces non-portable use of '-o /dev/null' with more efficiency. Feature added in 8.16.0 Closes #17800
This commit is contained in:
parent
0e49234128
commit
6845533e24
13 changed files with 137 additions and 6 deletions
|
|
@ -224,6 +224,7 @@ static const struct LongShort aliases[]= {
|
|||
{"ntlm", ARG_BOOL, ' ', C_NTLM},
|
||||
{"ntlm-wb", ARG_BOOL|ARG_DEPR, ' ', C_NTLM_WB},
|
||||
{"oauth2-bearer", ARG_STRG|ARG_CLEAR, ' ', C_OAUTH2_BEARER},
|
||||
{"out-null", ARG_BOOL, ' ', C_OUT_NULL},
|
||||
{"output", ARG_FILE, 'o', C_OUTPUT},
|
||||
{"output-dir", ARG_STRG, ' ', C_OUTPUT_DIR},
|
||||
{"parallel", ARG_BOOL, 'Z', C_PARALLEL},
|
||||
|
|
@ -1310,9 +1311,13 @@ static ParameterError parse_output(struct OperationConfig *config,
|
|||
return PARAM_NO_MEM;
|
||||
|
||||
/* fill in the outfile */
|
||||
err = getstr(&url->outfile, nextarg, DENY_BLANK);
|
||||
if(nextarg)
|
||||
err = getstr(&url->outfile, nextarg, DENY_BLANK);
|
||||
else
|
||||
url->outfile = NULL;
|
||||
url->useremote = FALSE; /* switch off */
|
||||
url->outset = TRUE;
|
||||
url->out_null = !nextarg;
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -1351,6 +1356,7 @@ static ParameterError parse_remote_name(struct OperationConfig *config,
|
|||
url->outfile = NULL; /* leave it */
|
||||
url->useremote = toggle;
|
||||
url->outset = TRUE;
|
||||
url->out_null = FALSE;
|
||||
return PARAM_OK;
|
||||
}
|
||||
|
||||
|
|
@ -1833,6 +1839,8 @@ static ParameterError opt_bool(struct OperationConfig *config,
|
|||
return PARAM_LIBCURL_DOESNT_SUPPORT;
|
||||
togglebit(toggle, &config->authtype, CURLAUTH_NTLM);
|
||||
break;
|
||||
case C_OUT_NULL: /* --out-null */
|
||||
return parse_output(config, NULL);
|
||||
case C_BASIC: /* --basic */
|
||||
togglebit(toggle, &config->authtype, CURLAUTH_BASIC);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue