1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-20 02:38:43 +00:00

Use CHECK_FLAG

This commit is contained in:
Dag-Erling Smørgrav 2000-10-29 15:56:10 +00:00
parent be1494064f
commit d74a913b68
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=67892
4 changed files with 22 additions and 22 deletions

View File

@ -74,7 +74,7 @@ fetchXGet(struct url *URL, struct url_stat *us, char *flags)
{
int direct;
direct = (flags && strchr(flags, 'd'));
direct = CHECK_FLAG('d');
if (strcasecmp(URL->scheme, SCHEME_FILE) == 0)
return fetchXGetFile(URL, us, flags);
else if (strcasecmp(URL->scheme, SCHEME_HTTP) == 0)
@ -106,7 +106,7 @@ fetchPut(struct url *URL, char *flags)
{
int direct;
direct = (flags && strchr(flags, 'd'));
direct = CHECK_FLAG('d');
if (strcasecmp(URL->scheme, SCHEME_FILE) == 0)
return fetchPutFile(URL, flags);
else if (strcasecmp(URL->scheme, SCHEME_HTTP) == 0)
@ -128,7 +128,7 @@ fetchStat(struct url *URL, struct url_stat *us, char *flags)
{
int direct;
direct = (flags && strchr(flags, 'd'));
direct = CHECK_FLAG('d');
if (strcasecmp(URL->scheme, SCHEME_FILE) == 0)
return fetchStatFile(URL, us, flags);
else if (strcasecmp(URL->scheme, SCHEME_HTTP) == 0)
@ -150,7 +150,7 @@ fetchList(struct url *URL, char *flags)
{
int direct;
direct = (flags && strchr(flags, 'd'));
direct = CHECK_FLAG('d');
if (strcasecmp(URL->scheme, SCHEME_FILE) == 0)
return fetchListFile(URL, flags);
else if (strcasecmp(URL->scheme, SCHEME_HTTP) == 0)

View File

@ -70,7 +70,7 @@ fetchPutFile(struct url *u, char *flags)
{
FILE *f;
if (flags && strchr(flags, 'a'))
if (CHECK_FLAG('a'))
f = fopen(u->doc, "a");
else
f = fopen(u->doc, "w+");

View File

@ -458,9 +458,9 @@ _ftp_transfer(int cd, char *oper, char *file,
FILE *df;
/* check flags */
pasv = (flags && strchr(flags, 'p'));
high = (flags && strchr(flags, 'h'));
verbose = (flags && strchr(flags, 'v'));
pasv = CHECK_FLAG('p');
high = CHECK_FLAG('h');
verbose = CHECK_FLAG('v');
/* passive mode */
if (!pasv)
@ -740,11 +740,11 @@ _ftp_connect(struct url *url, struct url *purl, char *flags)
char localhost[MAXHOSTNAMELEN];
char pbuf[MAXHOSTNAMELEN + MAXLOGNAME + 1];
direct = (flags && strchr(flags, 'd'));
verbose = (flags && strchr(flags, 'v'));
if ((flags && strchr(flags, '4')))
direct = CHECK_FLAG('d');
verbose = CHECK_FLAG('v');
if (CHECK_FLAG('4'))
af = AF_INET;
else if ((flags && strchr(flags, '6')))
else if (CHECK_FLAG('6'))
af = AF_INET6;
if (direct)
@ -911,7 +911,7 @@ fetchXGetFTP(struct url *url, struct url_stat *us, char *flags)
int cd;
/* get the proxy URL, and check if we should use HTTP instead */
if (!(flags && strchr(flags, 'd')) && (purl = _ftp_get_proxy()) != NULL) {
if (!CHECK_FLAG('d') && (purl = _ftp_get_proxy()) != NULL) {
if (strcasecmp(purl->scheme, SCHEME_HTTP) == 0)
return _http_request(url, "GET", us, purl, flags);
} else {
@ -958,7 +958,7 @@ fetchPutFTP(struct url *url, char *flags)
int cd;
/* get the proxy URL, and check if we should use HTTP instead */
if (!(flags && strchr(flags, 'd')) && (purl = _ftp_get_proxy()) != NULL) {
if (!CHECK_FLAG('d') && (purl = _ftp_get_proxy()) != NULL) {
if (strcasecmp(purl->scheme, SCHEME_HTTP) == 0)
/* XXX HTTP PUT is not implemented, so try without the proxy */
purl = NULL;
@ -978,7 +978,7 @@ fetchPutFTP(struct url *url, char *flags)
return NULL;
/* initiate the transfer */
return _ftp_transfer(cd, (flags && strchr(flags, 'a')) ? "APPE" : "STOR",
return _ftp_transfer(cd, CHECK_FLAG('a') ? "APPE" : "STOR",
url->doc, O_WRONLY, url->offset, flags);
}
@ -992,7 +992,7 @@ fetchStatFTP(struct url *url, struct url_stat *us, char *flags)
int cd;
/* get the proxy URL, and check if we should use HTTP instead */
if (!(flags && strchr(flags, 'd')) && (purl = _ftp_get_proxy()) != NULL) {
if (!CHECK_FLAG('d') && (purl = _ftp_get_proxy()) != NULL) {
if (strcasecmp(purl->scheme, SCHEME_HTTP) == 0) {
FILE *f;

View File

@ -640,11 +640,11 @@ _http_connect(struct url *URL, struct url *purl, char *flags)
af = AF_INET;
#endif
verbose = (flags && strchr(flags, 'v'));
if (flags && strchr(flags, '4'))
verbose = CHECK_FLAG('v');
if (CHECK_FLAG('4'))
af = AF_INET;
#ifdef INET6
else if (flags && strchr(flags, '6'))
else if (CHECK_FLAG('6'))
af = AF_INET6;
#endif
@ -705,9 +705,9 @@ _http_request(struct url *URL, char *op, struct url_stat *us,
char hbuf[MAXHOSTNAMELEN + 1];
#endif
direct = (flags && strchr(flags, 'd'));
noredirect = (flags && strchr(flags, 'A'));
verbose = (flags && strchr(flags, 'v'));
direct = CHECK_FLAG('d');
noredirect = CHECK_FLAG('A');
verbose = CHECK_FLAG('v');
if (direct && purl) {
fetchFreeURL(purl);