summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-10-06 07:50:18 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-10-06 07:50:18 +0000
commit39af394a1c3ae1d8ac71ad263a7c524988702c2e (patch)
tree4ba44670440d52ff6c3b07fdef35ae3384f3dc5a
parent5c7dcc6c33bb9e9621cf09ada4a15f310cf1c0e0 (diff)
downloadgnurl-39af394a1c3ae1d8ac71ad263a7c524988702c2e.tar.gz
gnurl-39af394a1c3ae1d8ac71ad263a7c524988702c2e.tar.bz2
gnurl-39af394a1c3ae1d8ac71ad263a7c524988702c2e.zip
removed tabs and trailing whitespace from source
-rw-r--r--ares/adig.c344
-rw-r--r--ares/ahost.c16
-rw-r--r--ares/ares.h98
-rw-r--r--ares/ares__get_hostent.c116
-rw-r--r--ares/ares__read_line.c14
-rw-r--r--ares/ares_dns.h94
-rw-r--r--ares/ares_expand_name.c100
-rw-r--r--ares/ares_fds.c24
-rw-r--r--ares/ares_gethostbyaddr.c80
-rw-r--r--ares/ares_gethostbyname.c116
-rw-r--r--ares/ares_init.c176
-rw-r--r--ares/ares_mkquery.c48
-rw-r--r--ares/ares_parse_a_reply.c92
-rw-r--r--ares/ares_parse_ptr_reply.c110
-rw-r--r--ares/ares_private.h14
-rw-r--r--ares/ares_process.c432
-rw-r--r--ares/ares_query.c44
-rw-r--r--ares/ares_search.c146
-rw-r--r--ares/ares_send.c2
-rw-r--r--ares/ares_timeout.c8
-rw-r--r--curl-style.el9
-rw-r--r--docs/MANUAL4
-rw-r--r--docs/examples/curlx.c572
-rw-r--r--docs/examples/fopen.c396
-rw-r--r--docs/examples/multi-app.c24
-rw-r--r--include/curl/curl.h4
-rw-r--r--lib/amigaos.c6
-rw-r--r--lib/amigaos.h8
-rw-r--r--lib/config-mac.h70
-rwxr-xr-xlib/config-vms.h18
-rw-r--r--lib/connect.c6
-rw-r--r--lib/cookie.c40
-rw-r--r--lib/cookie.h2
-rw-r--r--lib/dict.c34
-rw-r--r--lib/file.c2
-rw-r--r--lib/formdata.c30
-rw-r--r--lib/ftp.c46
-rw-r--r--lib/getenv.c14
-rw-r--r--lib/hostares.c4
-rw-r--r--lib/hostasyn.c4
-rw-r--r--lib/hostip.c4
-rw-r--r--lib/hostip4.c4
-rw-r--r--lib/hostip6.c4
-rw-r--r--lib/hostsyn.c14
-rw-r--r--lib/hostthre.c4
-rw-r--r--lib/http.c12
-rw-r--r--lib/http_digest.c2
-rw-r--r--lib/inet_ntop.c6
-rw-r--r--lib/inet_pton.c48
-rw-r--r--lib/krb4.c6
-rw-r--r--lib/ldap.c8
-rw-r--r--lib/memory.h10
-rw-r--r--lib/netrc.c98
-rw-r--r--lib/progress.c2
-rw-r--r--lib/security.c18
-rw-r--r--lib/security.h16
-rw-r--r--lib/sendf.c12
-rw-r--r--lib/speedcheck.c20
-rw-r--r--lib/ssluse.c6
-rw-r--r--lib/strequal.c2
-rw-r--r--lib/telnet.c52
-rw-r--r--lib/transfer.h10
-rw-r--r--lib/url.c70
-rw-r--r--lib/urldata.h52
-rw-r--r--src/config-amigaos.h39
-rw-r--r--src/config-mac.h12
-rw-r--r--src/getpass.c10
-rw-r--r--src/homedir.c20
-rw-r--r--src/main.c148
-rw-r--r--src/urlglob.c110
70 files changed, 2091 insertions, 2095 deletions
diff --git a/ares/adig.c b/ares/adig.c
index a14288fb1..27b250047 100644
--- a/ares/adig.c
+++ b/ares/adig.c
@@ -37,7 +37,7 @@
#include "ares_dns.h"
#ifndef INADDR_NONE
-#define INADDR_NONE 0xffffffff
+#define INADDR_NONE 0xffffffff
#endif
/* Mac OS X portability check */
@@ -54,58 +54,58 @@ struct nv {
};
static const struct nv flags[] = {
- { "usevc", ARES_FLAG_USEVC },
- { "primary", ARES_FLAG_PRIMARY },
- { "igntc", ARES_FLAG_IGNTC },
- { "norecurse", ARES_FLAG_NORECURSE },
- { "stayopen", ARES_FLAG_STAYOPEN },
- { "noaliases", ARES_FLAG_NOALIASES }
+ { "usevc", ARES_FLAG_USEVC },
+ { "primary", ARES_FLAG_PRIMARY },
+ { "igntc", ARES_FLAG_IGNTC },
+ { "norecurse", ARES_FLAG_NORECURSE },
+ { "stayopen", ARES_FLAG_STAYOPEN },
+ { "noaliases", ARES_FLAG_NOALIASES }
};
static const int nflags = sizeof(flags) / sizeof(flags[0]);
static const struct nv classes[] = {
- { "IN", C_IN },
- { "CHAOS", C_CHAOS },
- { "HS", C_HS },
- { "ANY", C_ANY }
+ { "IN", C_IN },
+ { "CHAOS", C_CHAOS },
+ { "HS", C_HS },
+ { "ANY", C_ANY }
};
static const int nclasses = sizeof(classes) / sizeof(classes[0]);
static const struct nv types[] = {
- { "A", T_A },
- { "NS", T_NS },
- { "MD", T_MD },
- { "MF", T_MF },
- { "CNAME", T_CNAME },
- { "SOA", T_SOA },
- { "MB", T_MB },
- { "MG", T_MG },
- { "MR", T_MR },
- { "NULL", T_NULL },
- { "WKS", T_WKS },
- { "PTR", T_PTR },
- { "HINFO", T_HINFO },
- { "MINFO", T_MINFO },
- { "MX", T_MX },
- { "TXT", T_TXT },
- { "RP", T_RP },
- { "AFSDB", T_AFSDB },
- { "X25", T_X25 },
- { "ISDN", T_ISDN },
- { "RT", T_RT },
- { "NSAP", T_NSAP },
- { "NSAP_PTR", T_NSAP_PTR },
- { "SIG", T_SIG },
- { "KEY", T_KEY },
- { "PX", T_PX },
- { "GPOS", T_GPOS },
- { "AAAA", T_AAAA },
- { "LOC", T_LOC },
- { "SRV", T_SRV },
- { "AXFR", T_AXFR },
- { "MAILB", T_MAILB },
- { "MAILA", T_MAILA },
- { "ANY", T_ANY }
+ { "A", T_A },
+ { "NS", T_NS },
+ { "MD", T_MD },
+ { "MF", T_MF },
+ { "CNAME", T_CNAME },
+ { "SOA", T_SOA },
+ { "MB", T_MB },
+ { "MG", T_MG },
+ { "MR", T_MR },
+ { "NULL", T_NULL },
+ { "WKS", T_WKS },
+ { "PTR", T_PTR },
+ { "HINFO", T_HINFO },
+ { "MINFO", T_MINFO },
+ { "MX", T_MX },
+ { "TXT", T_TXT },
+ { "RP", T_RP },
+ { "AFSDB", T_AFSDB },
+ { "X25", T_X25 },
+ { "ISDN", T_ISDN },
+ { "RT", T_RT },
+ { "NSAP", T_NSAP },
+ { "NSAP_PTR", T_NSAP_PTR },
+ { "SIG", T_SIG },
+ { "KEY", T_KEY },
+ { "PX", T_PX },
+ { "GPOS", T_GPOS },
+ { "AAAA", T_AAAA },
+ { "LOC", T_LOC },
+ { "SRV", T_SRV },
+ { "AXFR", T_AXFR },
+ { "MAILB", T_MAILB },
+ { "MAILA", T_MAILA },
+ { "ANY", T_ANY }
};
static const int ntypes = sizeof(types) / sizeof(types[0]);
@@ -124,10 +124,10 @@ static const char *rcodes[] = {
static void callback(void *arg, int status, unsigned char *abuf, int alen);
static const unsigned char *display_question(const unsigned char *aptr,
- const unsigned char *abuf,
- int alen);
+ const unsigned char *abuf,
+ int alen);
static const unsigned char *display_rr(const unsigned char *aptr,
- const unsigned char *abuf, int alen);
+ const unsigned char *abuf, int alen);
static const char *type_name(int type);
static const char *class_name(int dnsclass);
static void usage(void);
@@ -146,7 +146,7 @@ int main(int argc, char **argv)
WORD wVersionRequested = MAKEWORD(1,1);
WSADATA wsaData;
WSAStartup(wVersionRequested, &wsaData);
-#endif
+#endif
options.flags = ARES_FLAG_NOCHECKRESP;
options.servers = NULL;
@@ -154,80 +154,80 @@ int main(int argc, char **argv)
while ((c = getopt(argc, argv, "f:s:c:t:T:U:")) != -1)
{
switch (c)
- {
- case 'f':
- /* Add a flag. */
- for (i = 0; i < nflags; i++)
- {
- if (strcmp(flags[i].name, optarg) == 0)
- break;
- }
- if (i == nflags)
- usage();
- options.flags |= flags[i].value;
- break;
-
- case 's':
- /* Add a server, and specify servers in the option mask. */
- hostent = gethostbyname(optarg);
- if (!hostent || hostent->h_addrtype != AF_INET)
- {
- fprintf(stderr, "adig: server %s not found.\n", optarg);
- return 1;
- }
- options.servers = realloc(options.servers, (options.nservers + 1)
- * sizeof(struct in_addr));
- if (!options.servers)
- {
- fprintf(stderr, "Out of memory!\n");
- return 1;
- }
- memcpy(&options.servers[options.nservers], hostent->h_addr,
- sizeof(struct in_addr));
- options.nservers++;
- optmask |= ARES_OPT_SERVERS;
- break;
-
- case 'c':
- /* Set the query class. */
- for (i = 0; i < nclasses; i++)
- {
- if (strcasecmp(classes[i].name, optarg) == 0)
- break;
- }
- if (i == nclasses)
- usage();
- dnsclass = classes[i].value;
- break;
-
- case 't':
- /* Set the query type. */
- for (i = 0; i < ntypes; i++)
- {
- if (strcasecmp(types[i].name, optarg) == 0)
- break;
- }
- if (i == ntypes)
- usage();
- type = types[i].value;
- break;
-
- case 'T':
- /* Set the TCP port number. */
- if (!isdigit((unsigned char)*optarg))
- usage();
- options.tcp_port = strtol(optarg, NULL, 0);
- optmask |= ARES_OPT_TCP_PORT;
- break;
-
- case 'U':
- /* Set the UDP port number. */
- if (!isdigit((unsigned char)*optarg))
- usage();
- options.udp_port = strtol(optarg, NULL, 0);
- optmask |= ARES_OPT_UDP_PORT;
- break;
- }
+ {
+ case 'f':
+ /* Add a flag. */
+ for (i = 0; i < nflags; i++)
+ {
+ if (strcmp(flags[i].name, optarg) == 0)
+ break;
+ }
+ if (i == nflags)
+ usage();
+ options.flags |= flags[i].value;
+ break;
+
+ case 's':
+ /* Add a server, and specify servers in the option mask. */
+ hostent = gethostbyname(optarg);
+ if (!hostent || hostent->h_addrtype != AF_INET)
+ {
+ fprintf(stderr, "adig: server %s not found.\n", optarg);
+ return 1;
+ }
+ options.servers = realloc(options.servers, (options.nservers + 1)
+ * sizeof(struct in_addr));
+ if (!options.servers)
+ {
+ fprintf(stderr, "Out of memory!\n");
+ return 1;
+ }
+ memcpy(&options.servers[options.nservers], hostent->h_addr,
+ sizeof(struct in_addr));
+ options.nservers++;
+ optmask |= ARES_OPT_SERVERS;
+ break;
+
+ case 'c':
+ /* Set the query class. */
+ for (i = 0; i < nclasses; i++)
+ {
+ if (strcasecmp(classes[i].name, optarg) == 0)
+ break;
+ }
+ if (i == nclasses)
+ usage();
+ dnsclass = classes[i].value;
+ break;
+
+ case 't':
+ /* Set the query type. */
+ for (i = 0; i < ntypes; i++)
+ {
+ if (strcasecmp(types[i].name, optarg) == 0)
+ break;
+ }
+ if (i == ntypes)
+ usage();
+ type = types[i].value;
+ break;
+
+ case 'T':
+ /* Set the TCP port number. */
+ if (!isdigit((unsigned char)*optarg))
+ usage();
+ options.tcp_port = strtol(optarg, NULL, 0);
+ optmask |= ARES_OPT_TCP_PORT;
+ break;
+
+ case 'U':
+ /* Set the UDP port number. */
+ if (!isdigit((unsigned char)*optarg))
+ usage();
+ options.udp_port = strtol(optarg, NULL, 0);
+ optmask |= ARES_OPT_UDP_PORT;
+ break;
+ }
}
argc -= optind;
argv += optind;
@@ -239,7 +239,7 @@ int main(int argc, char **argv)
if (status != ARES_SUCCESS)
{
fprintf(stderr, "ares_init_options: %s\n",
- ares_strerror(status));
+ ares_strerror(status));
return 1;
}
@@ -253,7 +253,7 @@ int main(int argc, char **argv)
else
{
for (; *argv; argv++)
- ares_query(channel, *argv, dnsclass, type, callback, *argv);
+ ares_query(channel, *argv, dnsclass, type, callback, *argv);
}
/* Wait for all queries to complete. */
@@ -263,14 +263,14 @@ int main(int argc, char **argv)
FD_ZERO(&write_fds);
nfds = ares_fds(channel, &read_fds, &write_fds);
if (nfds == 0)
- break;
+ break;
tvp = ares_timeout(channel, NULL, &tv);
count = select(nfds, &read_fds, &write_fds, NULL, tvp);
if (count < 0 && errno != EINVAL)
- {
- perror("select");
- return 1;
- }
+ {
+ perror("select");
+ return 1;
+ }
ares_process(channel, &read_fds, &write_fds);
}
@@ -296,7 +296,7 @@ static void callback(void *arg, int status, unsigned char *abuf, int alen)
{
printf("%s\n", ares_strerror(status));
if (!abuf)
- return;
+ return;
}
/* Won't happen, but check anyway, for safety. */
@@ -320,11 +320,11 @@ static void callback(void *arg, int status, unsigned char *abuf, int alen)
/* Display the answer header. */
printf("id: %d\n", id);
printf("flags: %s%s%s%s%s\n",
- qr ? "qr " : "",
- aa ? "aa " : "",
- tc ? "tc " : "",
- rd ? "rd " : "",
- ra ? "ra " : "");
+ qr ? "qr " : "",
+ aa ? "aa " : "",
+ tc ? "tc " : "",
+ rd ? "rd " : "",
+ ra ? "ra " : "");
printf("opcode: %s\n", opcodes[opcode]);
printf("rcode: %s\n", rcodes[rcode]);
@@ -335,7 +335,7 @@ static void callback(void *arg, int status, unsigned char *abuf, int alen)
{
aptr = display_question(aptr, abuf, alen);
if (aptr == NULL)
- return;
+ return;
}
/* Display the answers. */
@@ -344,7 +344,7 @@ static void callback(void *arg, int status, unsigned char *abuf, int alen)
{
aptr = display_rr(aptr, abuf, alen);
if (aptr == NULL)
- return;
+ return;
}
/* Display the NS records. */
@@ -353,7 +353,7 @@ static void callback(void *arg, int status, unsigned char *abuf, int alen)
{
aptr = display_rr(aptr, abuf, alen);
if (aptr == NULL)
- return;
+ return;
}
/* Display the additional records. */
@@ -362,13 +362,13 @@ static void callback(void *arg, int status, unsigned char *abuf, int alen)
{
aptr = display_rr(aptr, abuf, alen);
if (aptr == NULL)
- return;
+ return;
}
}
static const unsigned char *display_question(const unsigned char *aptr,
- const unsigned char *abuf,
- int alen)
+ const unsigned char *abuf,
+ int alen)
{
char *name;
int type, dnsclass, status;
@@ -406,7 +406,7 @@ static const unsigned char *display_question(const unsigned char *aptr,
}
static const unsigned char *display_rr(const unsigned char *aptr,
- const unsigned char *abuf, int alen)
+ const unsigned char *abuf, int alen)
{
const unsigned char *p;
char *name;
@@ -463,7 +463,7 @@ static const unsigned char *display_rr(const unsigned char *aptr,
/* For these types, the RR data is just a domain name. */
status = ares_expand_name(aptr, abuf, alen, &name, &len);
if (status != ARES_SUCCESS)
- return NULL;
+ return NULL;
printf("\t%s.", name);
free(name);
break;
@@ -473,12 +473,12 @@ static const unsigned char *display_rr(const unsigned char *aptr,
p = aptr;
len = *p;
if (p + len + 1 > aptr + dlen)
- return NULL;
+ return NULL;
printf("\t%.*s", len, p + 1);
p += len + 1;
len = *p;
if (p + len + 1 > aptr + dlen)
- return NULL;
+ return NULL;
printf("\t%.*s", len, p + 1);
break;
@@ -487,13 +487,13 @@ static const unsigned char *display_rr(const unsigned char *aptr,
p = aptr;
status = ares_expand_name(p, abuf, alen, &name, &len);
if (status != ARES_SUCCESS)
- return NULL;
+ return NULL;
printf("\t%s.", name);
free(name);
p += len;
status = ares_expand_name(p, abuf, alen, &name, &len);
if (status != ARES_SUCCESS)
- return NULL;
+ return NULL;
printf("\t%s.", name);
free(name);
break;
@@ -503,11 +503,11 @@ static const unsigned char *display_rr(const unsigned char *aptr,
* then a domain name.
*/
if (dlen < 2)
- return NULL;
+ return NULL;
printf("\t%d", (aptr[0] << 8) | aptr[1]);
status = ares_expand_name(aptr + 2, abuf, alen, &name, &len);
if (status != ARES_SUCCESS)
- return NULL;
+ return NULL;
printf("\t%s.", name);
free(name);
break;
@@ -519,24 +519,24 @@ static const unsigned char *display_rr(const unsigned char *aptr,
p = aptr;
status = ares_expand_name(p, abuf, alen, &name, &len);
if (status != ARES_SUCCESS)
- return NULL;
+ return NULL;
printf("\t%s.\n", name);
free(name);
p += len;
status = ares_expand_name(p, abuf, alen, &name, &len);
if (status != ARES_SUCCESS)
- return NULL;
+ return NULL;
printf("\t\t\t\t\t\t%s.\n", name);
free(name);
p += len;
if (p + 20 > aptr + dlen)
- return NULL;
+ return NULL;
printf("\t\t\t\t\t\t( %d %d %d %d %d )",
- (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3],
- (p[4] << 24) | (p[5] << 16) | (p[6] << 8) | p[7],
- (p[8] << 24) | (p[9] << 16) | (p[10] << 8) | p[11],
- (p[12] << 24) | (p[13] << 16) | (p[14] << 8) | p[15],
- (p[16] << 24) | (p[17] << 16) | (p[18] << 8) | p[19]);
+ (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3],
+ (p[4] << 24) | (p[5] << 16) | (p[6] << 8) | p[7],
+ (p[8] << 24) | (p[9] << 16) | (p[10] << 8) | p[11],
+ (p[12] << 24) | (p[13] << 16) | (p[14] << 8) | p[15],
+ (p[16] << 24) | (p[17] << 16) | (p[18] << 8) | p[19]);
break;
case T_TXT:
@@ -544,19 +544,19 @@ static const unsigned char *display_rr(const unsigned char *aptr,
* strings. */
p = aptr;
while (p < aptr + dlen)
- {
- len = *p;
- if (p + len + 1 > aptr + dlen)
- return NULL;
- printf("\t%.*s", len, p + 1);
- p += len + 1;
- }
+ {
+ len = *p;
+ if (p + len + 1 > aptr + dlen)
+ return NULL;
+ printf("\t%.*s", len, p + 1);
+ p += len + 1;
+ }
break;
case T_A:
/* The RR data is a four-byte Internet address. */
if (dlen != 4)
- return NULL;
+ return NULL;
memcpy(&addr, aptr, sizeof(struct in_addr));
printf("\t%s", inet_ntoa(addr));
break;
@@ -569,18 +569,18 @@ static const unsigned char *display_rr(const unsigned char *aptr,
/* The RR data is three two-byte numbers representing the
* priority, weight, and port, followed by a domain name.
*/
-
+
printf("\t%d", DNS__16BIT(aptr));
printf(" %d", DNS__16BIT(aptr + 2));
printf(" %d", DNS__16BIT(aptr + 4));
-
+
status = ares_expand_name(aptr + 6, abuf, alen, &name, &len);
if (status != ARES_SUCCESS)
return NULL;
printf("\t%s.", name);
free(name);
break;
-
+
default:
printf("\t[Unknown RR; cannot parse]");
}
@@ -596,7 +596,7 @@ static const char *type_name(int type)
for (i = 0; i < ntypes; i++)
{
if (types[i].value == type)
- return types[i].name;
+ return types[i].name;
}
return "(unknown)";
}
@@ -608,7 +608,7 @@ static const char *class_name(int dnsclass)
for (i = 0; i < nclasses; i++)
{
if (classes[i].value == dnsclass)
- return classes[i].name;
+ return classes[i].name;
}
return "(unknown)";
}
@@ -616,6 +616,6 @@ static const char *class_name(int dnsclass)
static void usage(void)
{
fprintf(stderr, "usage: adig [-f flag] [-s server] [-c class] "
- "[-t type] [-p port] name ...\n");
+ "[-t type] [-p port] name ...\n");
exit(1);
}
diff --git a/ares/ahost.c b/ares/ahost.c
index 7ec0e4ace..f27b1c4b1 100644
--- a/ares/ahost.c
+++ b/ares/ahost.c
@@ -33,7 +33,7 @@
#include "ares_dns.h"
#ifndef INADDR_NONE
-#define INADDR_NONE 0xffffffff
+#define INADDR_NONE 0xffffffff
#endif
static void callback(void *arg, int status, struct hostent *host);
@@ -51,7 +51,7 @@ int main(int argc, char **argv)
WORD wVersionRequested = MAKEWORD(1,1);
WSADATA wsaData;
WSAStartup(wVersionRequested, &wsaData);
-#endif
+#endif
if (argc <= 1)
usage();
@@ -68,12 +68,12 @@ int main(int argc, char **argv)
{
addr.s_addr = inet_addr(*argv);
if (addr.s_addr == INADDR_NONE)
- ares_gethostbyname(channel, *argv, AF_INET, callback, *argv);
+ ares_gethostbyname(channel, *argv, AF_INET, callback, *argv);
else
- {
- ares_gethostbyaddr(channel, &addr, sizeof(addr), AF_INET, callback,
- *argv);
- }
+ {
+ ares_gethostbyaddr(channel, &addr, sizeof(addr), AF_INET, callback,
+ *argv);
+ }
}
/* Wait for all queries to complete. */
@@ -83,7 +83,7 @@ int main(int argc, char **argv)
FD_ZERO(&write_fds);
nfds = ares_fds(channel, &read_fds, &write_fds);
if (nfds == 0)
- break;
+ break;
tvp = ares_timeout(channel, NULL, &tv);
select(nfds, &read_fds, &write_fds, NULL, tvp);
ares_process(channel, &read_fds, &write_fds);
diff --git a/ares/ares.h b/ares/ares.h
index 44a9d087c..745b233db 100644
--- a/ares/ares.h
+++ b/ares/ares.h
@@ -37,49 +37,49 @@
#include <netinet/in.h>
#endif
-#define ARES_SUCCESS 0
+#define ARES_SUCCESS 0
/* Server error codes (ARES_ENODATA indicates no relevant answer) */
-#define ARES_ENODATA 1
-#define ARES_EFORMERR 2
-#define ARES_ESERVFAIL 3
-#define ARES_ENOTFOUND 4
-#define ARES_ENOTIMP 5
-#define ARES_EREFUSED 6
+#define ARES_ENODATA 1
+#define ARES_EFORMERR 2
+#define ARES_ESERVFAIL 3
+#define ARES_ENOTFOUND 4
+#define ARES_ENOTIMP 5
+#define ARES_EREFUSED 6
/* Locally generated error codes */
-#define ARES_EBADQUERY 7
-#define ARES_EBADNAME 8
-#define ARES_EBADFAMILY 9
-#define ARES_EBADRESP 10
-#define ARES_ECONNREFUSED 11
-#define ARES_ETIMEOUT 12
-#define ARES_EOF 13
-#define ARES_EFILE 14
-#define ARES_ENOMEM 15
-#define ARES_EDESTRUCTION 16
-#define ARES_EBADSTR 17
+#define ARES_EBADQUERY 7
+#define ARES_EBADNAME 8
+#define ARES_EBADFAMILY 9
+#define ARES_EBADRESP 10
+#define ARES_ECONNREFUSED 11
+#define ARES_ETIMEOUT 12
+#define ARES_EOF 13
+#define ARES_EFILE 14
+#define ARES_ENOMEM 15
+#define ARES_EDESTRUCTION 16
+#define ARES_EBADSTR 17
/* Flag values */
-#define ARES_FLAG_USEVC (1 << 0)
-#define ARES_FLAG_PRIMARY (1 << 1)
-#define ARES_FLAG_IGNTC (1 << 2)
-#define ARES_FLAG_NORECURSE (1 << 3)
-#define ARES_FLAG_STAYOPEN (1 << 4)
-#define ARES_FLAG_NOSEARCH (1 << 5)
-#define ARES_FLAG_NOALIASES (1 << 6)
-#define ARES_FLAG_NOCHECKRESP (1 << 7)
+#define ARES_FLAG_USEVC (1 << 0)
+#define ARES_FLAG_PRIMARY (1 << 1)
+#define ARES_FLAG_IGNTC (1 << 2)
+#define ARES_FLAG_NORECURSE (1 << 3)
+#define ARES_FLAG_STAYOPEN (1 << 4)
+#define ARES_FLAG_NOSEARCH (1 << 5)
+#define ARES_FLAG_NOALIASES (1 << 6)
+#define ARES_FLAG_NOCHECKRESP (1 << 7)
/* Option mask values */
-#define ARES_OPT_FLAGS (1 << 0)
-#define ARES_OPT_TIMEOUT (1 << 1)
-#define ARES_OPT_TRIES (1 << 2)
-#define ARES_OPT_NDOTS (1 << 3)
-#define ARES_OPT_UDP_PORT (1 << 4)
-#define ARES_OPT_TCP_PORT (1 << 5)
-#define ARES_OPT_SERVERS (1 << 6)
-#define ARES_OPT_DOMAINS (1 << 7)
-#define ARES_OPT_LOOKUPS (1 << 8)
+#define ARES_OPT_FLAGS (1 << 0)
+#define ARES_OPT_TIMEOUT (1 << 1)
+#define ARES_OPT_TRIES (1 << 2)
+#define ARES_OPT_NDOTS (1 << 3)
+#define ARES_OPT_UDP_PORT (1 << 4)
+#define ARES_OPT_TCP_PORT (1 << 5)
+#define ARES_OPT_SERVERS (1 << 6)
+#define ARES_OPT_DOMAINS (1 << 7)
+#define ARES_OPT_LOOKUPS (1 << 8)
struct ares_options {
int flags;
@@ -100,41 +100,41 @@ struct timeval;
struct ares_channeldata;
typedef struct ares_channeldata *ares_channel;
typedef void (*ares_callback)(void *arg, int status, unsigned char *abuf,
- int alen);
+ int alen);
typedef void (*ares_host_callback)(void *arg, int status,
- struct hostent *hostent);
+ struct hostent *hostent);
int ares_init(ares_channel *channelptr);
int ares_init_options(ares_channel *channelptr, struct ares_options *options,
- int optmask);
+ int optmask);
void ares_destroy(ares_channel channel);
void ares_cancel(ares_channel channel);
void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen,
- ares_callback callback, void *arg);
+ ares_callback callback, void *arg);
void ares_query(ares_channel channel, const char *name, int dnsclass,
- int type, ares_callback callback, void *arg);
+ int type, ares_callback callback, void *arg);
void ares_search(ares_channel channel, const char *name, int dnsclass,
- int type, ares_callback callback, void *arg);
+ int type, ares_callback callback, void *arg);
void ares_gethostbyname(ares_channel channel, const char *name, int family,
- ares_host_callback callback, void *arg);
+ ares_host_callback callback, void *arg);
void ares_gethostbyaddr(ares_channel channel, const void *addr, int addrlen,
- int family, ares_host_callback callback, void *arg);
+ int family, ares_host_callback callback, void *arg);
int ares_fds(ares_channel channel, fd_set *read_fds, fd_set *write_fds);
struct timeval *ares_timeout(ares_channel channel, struct timeval *maxtv,
- struct timeval *tv);
+ struct timeval *tv);
void ares_process(ares_channel channel, fd_set *read_fds, fd_set *write_fds);
int ares_mkquery(const char *name, int dnsclass, int type, unsigned short id,
- int rd, unsigned char **buf, int *buflen);
+ int rd, unsigned char **buf, int *buflen);
int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
- int alen, char **s, long *enclen);
+ int alen, char **s, long *enclen);
int ares_expand_string(const unsigned char *encoded, const unsigned char *abuf,
- int alen, unsigned char **s, long *enclen);
+ int alen, unsigned char **s, long *enclen);
int ares_parse_a_reply(const unsigned char *abuf, int alen,
- struct hostent **host);
+ struct hostent **host);
int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
- int addrlen, int family, struct hostent **host);
+ int addrlen, int family, struct hostent **host);
void ares_free_string(void *str);
void ares_free_hostent(struct hostent *host);
const char *ares_strerror(int code);
diff --git a/ares/ares__get_hostent.c b/ares/ares__get_hostent.c
index 551b597c0..0b043423e 100644
--- a/ares/ares__get_hostent.c
+++ b/ares/ares__get_hostent.c
@@ -42,96 +42,96 @@ int ares__get_hostent(FILE *fp, struct hostent **host)
{
/* Skip comment lines; terminate line at comment character. */
if (*line == '#' || !*line)
- continue;
+ continue;
p = strchr(line, '#');
if (p)
- *p = 0;
+ *p = 0;
/* Get the address part. */
p = line;
while (*p && !isspace((unsigned char)*p))
- p++;
+ p++;
if (!*p)
- continue;
+ continue;
*p = 0;
addr.s_addr = inet_addr(line);
if (addr.s_addr == INADDR_NONE)
- continue;
+ continue;
/* Get the canonical hostname. */
p++;
while (isspace((unsigned char)*p))
- p++;
+ p++;
if (!*p)
- continue;
+ continue;
q = p;
while (*q && !isspace((unsigned char)*q))
- q++;
+ q++;
end_at_hostname = (*q == 0);
*q = 0;
canonical = p;
naliases = 0;
if (!end_at_hostname)
- {
- /* Count the aliases. */
- p = q + 1;
- while (isspace((unsigned char)*p))
- p++;
- while (*p)
- {
- while (*p && !isspace((unsigned char)*p))
- p++;
- while (isspace((unsigned char)*p))
- p++;
- naliases++;
- }
- }
+ {
+ /* Count the aliases. */
+ p = q + 1;
+ while (isspace((unsigned char)*p))
+ p++;
+ while (*p)
+ {
+ while (*p && !isspace((unsigned char)*p))
+ p++;
+ while (isspace((unsigned char)*p))
+ p++;
+ naliases++;
+ }
+ }
/* Allocate memory for the host structure. */
hostent = malloc(sizeof(struct hostent));
if (!hostent)
- break;
+ break;
hostent->h_aliases = NULL;
hostent->h_addr_list = NULL;
hostent->h_name = strdup(canonical);
if (!hostent->h_name)
- break;
+ break;
hostent->h_addr_list = malloc(2 * sizeof(char *));
if (!hostent->h_addr_list)
- break;
+ break;
hostent->h_addr_list[0] = malloc(sizeof(struct in_addr));
if (!hostent->h_addr_list[0])
- break;
+ break;
hostent->h_aliases = malloc((naliases + 1) * sizeof(char *));
if (!hostent->h_aliases)
- break;
+ break;
/* Copy in aliases. */
naliases = 0;
if (!end_at_hostname)
- {
- p = canonical + strlen(canonical) + 1;
- while (isspace((unsigned char)*p))
- p++;
- while (*p)
- {
- q = p;
- while (*q && !isspace((unsigned char)*q))
- q++;
- hostent->h_aliases[naliases] = malloc(q - p + 1);
- if (hostent->h_aliases[naliases] == NULL)
- break;
- memcpy(hostent->h_aliases[naliases], p, q - p);
- hostent->h_aliases[naliases][q - p] = 0;
- p = q;
- while (isspace((unsigned char)*p))
- p++;
- naliases++;
- }
- if (*p)
- break;
- }
+ {
+ p = canonical + strlen(canonical) + 1;
+ while (isspace((unsigned char)*p))
+ p++;
+ while (*p)
+ {
+ q = p;
+ while (*q && !isspace((unsigned char)*q))
+ q++;
+ hostent->h_aliases[naliases] = malloc(q - p + 1);
+ if (hostent->h_aliases[naliases] == NULL)
+ break;
+ memcpy(hostent->h_aliases[naliases], p, q - p);
+ hostent->h_aliases[naliases][q - p] = 0;
+ p = q;
+ while (isspace((unsigned char)*p))
+ p++;
+ naliases++;
+ }
+ if (*p)
+ break;
+ }
hostent->h_aliases[naliases] = NULL;
hostent->h_addrtype = AF_INET;
@@ -149,22 +149,22 @@ int ares__get_hostent(FILE *fp, struct hostent **host)
{
/* Memory allocation failure; clean up. */
if (hostent)
- {
+ {
if(hostent->h_name)
free((char *) hostent->h_name);
- if (hostent->h_aliases)
- {
- for (alias = hostent->h_aliases; *alias; alias++)
- free(*alias);
- }
+ if (hostent->h_aliases)
+ {
+ for (alias = hostent->h_aliases; *alias; alias++)
+ free(*alias);
+ }
if(hostent->h_aliases)
free(hostent->h_aliases);
- if (hostent->h_addr_list && hostent->h_addr_list[0])
- free(hostent->h_addr_list[0]);
+ if (hostent->h_addr_list && hostent->h_addr_list[0])
+ free(hostent->h_addr_list[0]);
if(hostent->h_addr_list)
free(hostent->h_addr_list);
free(hostent);
- }
+ }
return ARES_ENOMEM;
}
diff --git a/ares/ares__read_line.c b/ares/ares__read_line.c
index 8558557fa..5a66c63ba 100644
--- a/ares/ares__read_line.c
+++ b/ares/ares__read_line.c
@@ -38,26 +38,26 @@ int ares__read_line(FILE *fp, char **buf, int *bufsize)
{
*buf = malloc(128);
if (!*buf)
- return ARES_ENOMEM;
+ return ARES_ENOMEM;
*bufsize = 128;
}
while (1)
{
if (!fgets(*buf + offset, *bufsize - (int)offset, fp))
- return (offset != 0) ? 0 : (ferror(fp)) ? ARES_EFILE : ARES_EOF;
+ return (offset != 0) ? 0 : (ferror(fp)) ? ARES_EFILE : ARES_EOF;
len = offset + strlen(*buf + offset);
if ((*buf)[len - 1] == '\n')
- {
- (*buf)[len - 1] = 0;
- return ARES_SUCCESS;
- }
+ {
+ (*buf)[len - 1] = 0;
+ return ARES_SUCCESS;
+ }
offset = len;
/* Allocate more space. */
newbuf = realloc(*buf, *bufsize * 2);
if (!newbuf)
- return ARES_ENOMEM;
+ return ARES_ENOMEM;
*buf = newbuf;
*bufsize *= 2;
}
diff --git a/ares/ares_dns.h b/ares/ares_dns.h
index cfab47352..adac9d663 100644
--- a/ares/ares_dns.h
+++ b/ares/ares_dns.h
@@ -18,64 +18,64 @@
#ifndef ARES__DNS_H
#define ARES__DNS_H
-#define DNS__16BIT(p) (((p)[0] << 8) | (p)[1])
-#define DNS__32BIT(p) (((p)[0] << 24) | ((p)[1] << 16) | \
- ((p)[2] << 8) | (p)[3])
-#define DNS__SET16BIT(p, v) (((p)[0] = ((v) >> 8) & 0xff), \
- ((p)[1] = (v) & 0xff))
-#define DNS__SET32BIT(p, v) (((p)[0] = ((v) >> 24) & 0xff), \
- ((p)[1] = ((v) >> 16) & 0xff), \
- ((p)[2] = ((v) >> 8) & 0xff), \
- ((p)[3] = (v) & 0xff))
+#define DNS__16BIT(p) (((p)[0] << 8) | (p)[1])
+#define DNS__32BIT(p) (((p)[0] << 24) | ((p)[1] << 16) | \
+ ((p)[2] << 8) | (p)[3])
+#define DNS__SET16BIT(p, v) (((p)[0] = ((v) >> 8) & 0xff), \
+ ((p)[1] = (v) & 0xff))
+#define DNS__SET32BIT(p, v) (((p)[0] = ((v) >> 24) & 0xff), \
+ ((p)[1] = ((v) >> 16) & 0xff), \
+ ((p)[2] = ((v) >> 8) & 0xff), \
+ ((p)[3] = (v) & 0xff))
/* Macros for parsing a DNS header */
-#define DNS_HEADER_QID(h) DNS__16BIT(h)
-#define DNS_HEADER_QR(h) (((h)[2] >> 7) & 0x1)
-#define DNS_HEADER_OPCODE(h) (((h)[2] >> 3) & 0xf)
-#define DNS_HEADER_AA(h) (((h)[2] >> 2) & 0x1)
-#define DNS_HEADER_TC(h) (((h)[2] >> 1) & 0x1)
-#define DNS_HEADER_RD(h) ((h)[2] & 0x1)
-#define DNS_HEADER_RA(h) (((h)[3] >> 7) & 0x1)
-#define DNS_HEADER_Z(h) (((h)[3] >> 4) & 0x7)
-#define DNS_HEADER_RCODE(h) ((h)[3] & 0xf)
-#define DNS_HEADER_QDCOUNT(h) DNS__16BIT((h) + 4)
-#define DNS_HEADER_ANCOUNT(h) DNS__16BIT((h) + 6)
-#define DNS_HEADER_NSCOUNT(h) DNS__16BIT((h) + 8)
-#define DNS_HEADER_ARCOUNT(h) DNS__16BIT((h) + 10)
+#define DNS_HEADER_QID(h) DNS__16BIT(h)
+#define DNS_HEADER_QR(h) (((h)[2] >> 7) & 0x1)
+#define DNS_HEADER_OPCODE(h) (((h)[2] >> 3) & 0xf)
+#define DNS_HEADER_AA(h) (((h)[2] >> 2) & 0x1)
+#define DNS_HEADER_TC(h) (((h)[2] >> 1) & 0x1)
+#define DNS_HEADER_RD(h) ((h)[2] & 0x1)
+#define DNS_HEADER_RA(h) (((h)[3] >> 7) & 0x1)
+#define DNS_HEADER_Z(h) (((h)[3] >> 4) & 0x7)
+#define DNS_HEADER_RCODE(h) ((h)[3] & 0xf)
+#define DNS_HEADER_QDCOUNT(h) DNS__16BIT((h) + 4)
+#define DNS_HEADER_ANCOUNT(h) DNS__16BIT((h) + 6)
+#define DNS_HEADER_NSCOUNT(h) DNS__16BIT((h) + 8)
+#define DNS_HEADER_ARCOUNT(h) DNS__16BIT((h) + 10)
/* Macros for constructing a DNS header */
-#define DNS_HEADER_SET_QID(h, v) DNS__SET16BIT(h, v)
-#define DNS_HEADER_SET_QR(h, v) ((h)[2] |= (((v) & 0x1) << 7))
-#define DNS_HEADER_SET_OPCODE(h, v) ((h)[2] |= (((v) & 0xf) << 3))
-#define DNS_HEADER_SET_AA(h, v) ((h)[2] |= (((v) & 0x1) << 2))
-#define DNS_HEADER_SET_TC(h, v) ((h)[2] |= (((v) & 0x1) << 1))
-#define DNS_HEADER_SET_RD(h, v) ((h)[2] |= (((v) & 0x1)))
-#define DNS_HEADER_SET_RA(h, v) ((h)[3] |= (((v) & 0x1) << 7))
-#define DNS_HEADER_SET_Z(h, v) ((h)[3] |= (((v) & 0x7) << 4))
-#define DNS_HEADER_SET_RCODE(h, v) ((h)[3] |= (((v) & 0xf)))
-#define DNS_HEADER_SET_QDCOUNT(h, v) DNS__SET16BIT((h) + 4, v)
-#define DNS_HEADER_SET_ANCOUNT(h, v) DNS__SET16BIT((h) + 6, v)
-#define DNS_HEADER_SET_NSCOUNT(h, v) DNS__SET16BIT((h) + 8, v)
-#define DNS_HEADER_SET_ARCOUNT(h, v) DNS__SET16BIT((h) + 10, v)
+#define DNS_HEADER_SET_QID(h, v) DNS__SET16BIT(h, v)
+#define DNS_HEADER_SET_QR(h, v) ((h)[2] |= (((v) & 0x1) << 7))
+#define DNS_HEADER_SET_OPCODE(h, v) ((h)[2] |= (((v) & 0xf) << 3))
+#define DNS_HEADER_SET_AA(h, v) ((h)[2] |= (((v) & 0x1) << 2))
+#define DNS_HEADER_SET_TC(h, v) ((h)[2] |= (((v) & 0x1) << 1))
+#define DNS_HEADER_SET_RD(h, v) ((h)[2] |= (((v) & 0x1)))
+#define DNS_HEADER_SET_RA(h, v) ((h)[3] |= (((v) & 0x1) << 7))
+#define DNS_HEADER_SET_Z(h, v) ((h)[3] |= (((v) & 0x7) << 4))
+#define DNS_HEADER_SET_RCODE(h, v) ((h)[3] |= (((v) & 0xf)))
+#define DNS_HEADER_SET_QDCOUNT(h, v) DNS__SET16BIT((h) + 4, v)
+#define DNS_HEADER_SET_ANCOUNT(h, v) DNS__SET16BIT((h) + 6, v)
+#define DNS_HEADER_SET_NSCOUNT(h, v) DNS__SET16BIT((h) + 8, v)
+#define DNS_HEADER_SET_ARCOUNT(h, v) DNS__SET16BIT((h) + 10, v)
/* Macros for parsing the fixed part of a DNS question */
-#define DNS_QUESTION_TYPE(q) DNS__16BIT(q)
-#define DNS_QUESTION_CLASS(q) DNS__16BIT((q) + 2)
+#define DNS_QUESTION_TYPE(q) DNS__16BIT(q)
+#define DNS_QUESTION_CLASS(q) DNS__16BIT((q) + 2)
/* Macros for constructing the fixed part of a DNS question */
-#define DNS_QUESTION_SET_TYPE(q, v) DNS__SET16BIT(q, v)
-#define DNS_QUESTION_SET_CLASS(q, v) DNS__SET16BIT((q) + 2, v)
+#define DNS_QUESTION_SET_TYPE(q, v) DNS__SET16BIT(q, v)
+#define DNS_QUESTION_SET_CLASS(q, v) DNS__SET16BIT((q) + 2, v)
/* Macros for parsing the fixed part of a DNS resource record */
-#define DNS_RR_TYPE(r) DNS__16BIT(r)
-#define DNS_RR_CLASS(r) DNS__16BIT((r) + 2)
-#define DNS_RR_TTL(r) DNS__32BIT((r) + 4)
-#define DNS_RR_LEN(r) DNS__16BIT((r) + 8)
+#define DNS_RR_TYPE(r) DNS__16BIT(r)
+#define DNS_RR_CLASS(r) DNS__16BIT((r) + 2)
+#define DNS_RR_TTL(r) DNS__32BIT((r) + 4)
+#define DNS_RR_LEN(r) DNS__16BIT((r) + 8)
/* Macros for constructing the fixed part of a DNS resource record */
-#define DNS_RR_SET_TYPE(r) DNS__SET16BIT(r, v)
-#define DNS_RR_SET_CLASS(r) DNS__SET16BIT((r) + 2, v)
-#define DNS_RR_SET_TTL(r) DNS__SET32BIT((r) + 4, v)
-#define DNS_RR_SET_LEN(r) DNS__SET16BIT((r) + 8, v)
+#define DNS_RR_SET_TYPE(r) DNS__SET16BIT(r, v)
+#define DNS_RR_SET_CLASS(r) DNS__SET16BIT((r) + 2, v)
+#define DNS_RR_SET_TTL(r) DNS__SET32BIT((r) + 4, v)
+#define DNS_RR_SET_LEN(r) DNS__SET16BIT((r) + 8, v)
#endif /* ARES__DNS_H */
diff --git a/ares/ares_expand_name.c b/ares/ares_expand_name.c
index 0f95c07e3..0942bfa98 100644
--- a/ares/ares_expand_name.c
+++ b/ares/ares_expand_name.c
@@ -28,7 +28,7 @@
#include "ares_private.h" /* for the memdebug */
static int name_length(const unsigned char *encoded, const unsigned char *abuf,
- int alen);
+ int alen);
/* Expand an RFC1035-encoded domain name given by encoded. The
* containing message is given by abuf and alen. The result given by
@@ -55,7 +55,7 @@ static int name_length(const unsigned char *encoded, const unsigned char *abuf,
*/
int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
- int alen, char **s, long *enclen)
+ int alen, char **s, long *enclen)
{
int len, indir = 0;
char *q;
@@ -75,27 +75,27 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
while (*p)
{
if ((*p & INDIR_MASK) == INDIR_MASK)
- {
- if (!indir)
- {
- *enclen = p + 2 - encoded;
- indir = 1;
- }
- p = abuf + ((*p & ~INDIR_MASK) << 8 | *(p + 1));
- }
+ {
+ if (!indir)
+ {
+ *enclen = p + 2 - encoded;
+ indir = 1;
+ }
+ p = abuf + ((*p & ~INDIR_MASK) << 8 | *(p + 1));
+ }
else
- {
- len = *p;
- p++;
- while (len--)
- {
- if (*p == '.' || *p == '\\')
- *q++ = '\\';
- *q++ = *p;
- p++;
- }
- *q++ = '.';
- }
+ {
+ len = *p;
+ p++;
+ while (len--)
+ {
+ if (*p == '.' || *p == '\\')
+ *q++ = '\\';
+ *q++ = *p;
+ p++;
+ }
+ *q++ = '.';
+ }
}
if (!indir)
*enclen = p + 1 - encoded;
@@ -111,7 +111,7 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
* -1 if the encoding is invalid.
*/
static int name_length(const unsigned char *encoded, const unsigned char *abuf,
- int alen)
+ int alen)
{
int n = 0, offset, indir = 0;
@@ -122,34 +122,34 @@ static int name_length(const unsigned char *encoded, const unsigned char *abuf,
while (*encoded)
{
if ((*encoded & INDIR_MASK) == INDIR_MASK)
- {
- /* Check the offset and go there. */
- if (encoded + 1 >= abuf + alen)
- return -1;
- offset = (*encoded & ~INDIR_MASK) << 8 | *(encoded + 1);
- if (offset >= alen)
- return -1;
- encoded = abuf + offset;
-
- /* If we've seen more indirects than the message length,
- * then there's a loop.
- */
- if (++indir > alen)
- return -1;
- }
+ {
+ /* Check the offset and go there. */
+ if (encoded + 1 >= abuf + alen)
+ return -1;
+ offset = (*encoded & ~INDIR_MASK) << 8 | *(encoded + 1);
+ if (offset >= alen)
+ return -1;
+ encoded = abuf + offset;
+
+ /* If we've seen more indirects than the message length,
+ * then there's a loop.
+ */
+ if (++indir > alen)
+ return -1;
+ }
else
- {
- offset = *encoded;
- if (encoded + offset + 1 >= abuf + alen)
- return -1;
- encoded++;
- while (offset--)
- {
- n += (*encoded == '.' || *encoded == '\\') ? 2 : 1;
- encoded++;
- }
- n++;
- }
+ {
+ offset = *encoded;
+ if (encoded + offset + 1 >= abuf + alen)
+ return -1;
+ encoded++;
+ while (offset--)
+ {
+ n += (*encoded == '.' || *encoded == '\\') ? 2 : 1;
+ encoded++;
+ }
+ n++;
+ }
}
/* If there were any labels at all, then the number of dots is one
diff --git a/ares/ares_fds.c b/ares/ares_fds.c
index 58cf67a3e..dd9174501 100644
--- a/ares/ares_fds.c
+++ b/ares/ares_fds.c
@@ -37,19 +37,19 @@ int ares_fds(ares_channel channel, fd_set *read_fds, fd_set *write_fds)
{
server = &channel->servers[i];
if (server->udp_socket != ARES_SOCKET_BAD)
- {
- FD_SET(server->udp_socket, read_fds);
- if (server->udp_socket >= nfds)
- nfds = server->udp_socket + 1;
- }
+ {
+ FD_SET(server->udp_socket, read_fds);
+ if (server->udp_socket >= nfds)
+ nfds = server->udp_socket + 1;
+ }
if (server->tcp_socket != ARES_SOCKET_BAD)
- {
- FD_SET(server->tcp_socket, read_fds);
- if (server->qhead)
- FD_SET(server->tcp_socket, write_fds);
- if (server->tcp_socket >= nfds)
- nfds = server->tcp_socket + 1;
- }
+ {
+ FD_SET(server->tcp_socket, read_fds);
+ if (server->qhead)
+ FD_SET(server->tcp_socket, write_fds);
+ if (server->tcp_socket >= nfds)
+ nfds = server->tcp_socket + 1;
+ }
}
return nfds;
}
diff --git a/ares/ares_gethostbyaddr.c b/ares/ares_gethostbyaddr.c
index 978beba47..827ccfeda 100644
--- a/ares/ares_gethostbyaddr.c
+++ b/ares/ares_gethostbyaddr.c
@@ -48,13 +48,13 @@ struct addr_query {
static void next_lookup(struct addr_query *aquery);
static void addr_callback(void *arg, int status, unsigned char *abuf,
- int alen);
+ int alen);
static void end_aquery(struct addr_query *aquery, int status,
- struct hostent *host);
+ struct hostent *host);
static int file_lookup(struct in_addr *addr, struct hostent **host);
void ares_gethostbyaddr(ares_channel channel, const void *addr, int addrlen,
- int family, ares_host_callback callback, void *arg)
+ int family, ares_host_callback callback, void *arg)
{
struct addr_query *aquery;
@@ -90,27 +90,27 @@ static void next_lookup(struct addr_query *aquery)
for (p = aquery->remaining_lookups; *p; p++)
{
switch (*p)
- {
- case 'b':
- addr = ntohl(aquery->addr.s_addr);
- a1 = (int)((addr >> 24) & 0xff);
- a2 = (int)((addr >> 16) & 0xff);
- a3 = (int)((addr >> 8) & 0xff);
- a4 = (int)(addr & 0xff);
- sprintf(name, "%d.%d.%d.%d.in-addr.arpa", a4, a3, a2, a1);
- aquery->remaining_lookups = p + 1;
- ares_query(aquery->channel, name, C_IN, T_PTR, addr_callback,
- aquery);
- return;
- case 'f':
- status = file_lookup(&aquery->addr, &host);
- if (status != ARES_ENOTFOUND)
- {
- end_aquery(aquery, status, host);
- return;
- }
- break;
- }
+ {
+ case 'b':
+ addr = ntohl(aquery->addr.s_addr);
+ a1 = (int)((addr >> 24) & 0xff);
+ a2 = (int)((addr >> 16) & 0xff);
+ a3 = (int)((addr >> 8) & 0xff);
+ a4 = (int)(addr & 0xff);
+ sprintf(name, "%d.%d.%d.%d.in-addr.arpa", a4, a3, a2, a1);
+ aquery->remaining_lookups = p + 1;
+ ares_query(aquery->channel, name, C_IN, T_PTR, addr_callback,
+ aquery);
+ return;
+ case 'f':
+ status = file_lookup(&aquery->addr, &host);
+ if (status != ARES_ENOTFOUND)
+ {
+ end_aquery(aquery, status, host);
+ return;
+ }
+ break;
+ }
}
end_aquery(aquery, ARES_ENOTFOUND, NULL);
}
@@ -123,7 +123,7 @@ static void addr_callback(void *arg, int status, unsigned char *abuf, int alen)
if (status == ARES_SUCCESS)
{
status = ares_parse_ptr_reply(abuf, alen, &aquery->addr,
- sizeof(struct in_addr), AF_INET, &host);
+ sizeof(struct in_addr), AF_INET, &host);
end_aquery(aquery, status, host);
}
else if (status == ARES_EDESTRUCTION)
@@ -133,7 +133,7 @@ static void addr_callback(void *arg, int status, unsigned char *abuf, int alen)
}
static void end_aquery(struct addr_query *aquery, int status,
- struct hostent *host)
+ struct hostent *host)
{
aquery->callback(aquery->arg, status, host);
if (host)
@@ -150,19 +150,19 @@ static int file_lookup(struct in_addr *addr, struct hostent **host)
char PATH_HOSTS[MAX_PATH];
if (IsNT) {
- char tmp[MAX_PATH];
- HKEY hkeyHosts;
-
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, &hkeyHosts)
- == ERROR_SUCCESS)
- {
- DWORD dwLength = MAX_PATH;
- RegQueryValueEx(hkeyHosts, DATABASEPATH, NULL, NULL, tmp,
- &dwLength);
- ExpandEnvironmentStrings(tmp, PATH_HOSTS, MAX_PATH);
- RegCloseKey(hkeyHosts);
- }
- }
+ char tmp[MAX_PATH];
+ HKEY hkeyHosts;
+
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, &hkeyHosts)
+ == ERROR_SUCCESS)
+ {
+ DWORD dwLength = MAX_PATH;
+ RegQueryValueEx(hkeyHosts, DATABASEPATH, NULL, NULL, tmp,
+ &dwLength);
+ ExpandEnvironmentStrings(tmp, PATH_HOSTS, MAX_PATH);
+ RegCloseKey(hkeyHosts);
+ }
+ }
else
GetWindowsDirectory(PATH_HOSTS, MAX_PATH);
@@ -183,7 +183,7 @@ static int file_lookup(struct in_addr *addr, struct hostent **host)
while ((status = ares__get_hostent(fp, host)) == ARES_SUCCESS)
{
if (memcmp((*host)->h_addr, addr, sizeof(struct in_addr)) == 0)
- break;
+ break;
ares_free_hostent(*host);
}
fclose(fp);
diff --git a/ares/ares_gethostbyname.c b/ares/ares_gethostbyname.c
index decac5583..adf2f78ee 100644
--- a/ares/ares_gethostbyname.c
+++ b/ares/ares_gethostbyname.c
@@ -50,19 +50,19 @@ struct host_query {
static void next_lookup(struct host_query *hquery);
static void host_callback(void *arg, int status, unsigned char *abuf,
- int alen);
+ int alen);
static void end_hquery(struct host_query *hquery, int status,
- struct hostent *host);
+ struct hostent *host);
static int fake_hostent(const char *name, ares_host_callback callback,
- void *arg);
+ void *arg);
static int file_lookup(const char *name, struct hostent **host);
static void sort_addresses(struct hostent *host, struct apattern *sortlist,
- int nsort);
+ int nsort);
static int get_address_index(struct in_addr *addr, struct apattern *sortlist,
- int nsort);
+ int nsort);
void ares_gethostbyname(ares_channel channel, const char *name, int family,
- ares_host_callback callback, void *arg)
+ ares_host_callback callback, void *arg)
{
struct host_query *hquery;
@@ -106,26 +106,26 @@ static void next_lookup(struct host_query *hquery)
struct hostent *host;
for (p = hquery->remaining_lookups; *p; p++)
- {
+ {
switch (*p)
- {
- case 'b':
- /* DNS lookup */
- hquery->remaining_lookups = p + 1;
- ares_search(hquery->channel, hquery->name, C_IN, T_A, host_callback,
- hquery);
- return;
-
- case 'f':
- /* Host file lookup */
- status = file_lookup(hquery->name, &host);
- if (status != ARES_ENOTFOUND)
- {
- end_hquery(hquery, status, host);
- return;
- }
- break;
- }
+ {
+ case 'b':
+ /* DNS lookup */
+ hquery->remaining_lookups = p + 1;
+ ares_search(hquery->channel, hquery->name, C_IN, T_A, host_callback,
+ hquery);
+ return;
+
+ case 'f':
+ /* Host file lookup */
+ status = file_lookup(hquery->name, &host);
+ if (status != ARES_ENOTFOUND)
+ {
+ end_hquery(hquery, status, host);
+ return;
+ }
+ break;
+ }
}
end_hquery(hquery, ARES_ENOTFOUND, NULL);
}
@@ -140,7 +140,7 @@ static void host_callback(void *arg, int status, unsigned char *abuf, int alen)
{
status = ares_parse_a_reply(abuf, alen, &host);
if (host && channel->nsort)
- sort_addresses(host, channel->sortlist, channel->nsort);
+ sort_addresses(host, channel->sortlist, channel->nsort);
end_hquery(hquery, status, host);
}
else if (status == ARES_EDESTRUCTION)
@@ -150,7 +150,7 @@ static void host_callback(void *arg, int status, unsigned char *abuf, int alen)
}
static void end_hquery(struct host_query *hquery, int status,
- struct hostent *host)
+ struct hostent *host)
{
hquery->callback(hquery->arg, status, host);
if (host)
@@ -163,7 +163,7 @@ static void end_hquery(struct host_query *hquery, int status,
* query immediately, and return true. Otherwise return false.
*/
static int fake_hostent(const char *name, ares_host_callback callback,
- void *arg)
+ void *arg)
{
struct in_addr addr;
struct hostent hostent;
@@ -175,7 +175,7 @@ static int fake_hostent(const char *name, ares_host_callback callback,
for (p = name; *p; p++)
{
if (!isdigit((unsigned char)*p) && *p != '.')
- return 0;
+ return 0;
}
/* It also only looks like an IP address if it's non-zero-length and
@@ -222,19 +222,19 @@ static int file_lookup(const char *name, struct hostent **host)
#ifdef WIN32
char PATH_HOSTS[MAX_PATH];
if (IsNT) {
- char tmp[MAX_PATH];
- HKEY hkeyHosts;
-
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, &hkeyHosts)
- == ERROR_SUCCESS)
- {
- DWORD dwLength = MAX_PATH;
- RegQueryValueEx(hkeyHosts, DATABASEPATH, NULL, NULL, tmp,
- &dwLength);
- ExpandEnvironmentStrings(tmp, PATH_HOSTS, MAX_PATH);
- RegCloseKey(hkeyHosts);
- }
- }
+ char tmp[MAX_PATH];
+ HKEY hkeyHosts;
+
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, &hkeyHosts)
+ == ERROR_SUCCESS)
+ {
+ DWORD dwLength = MAX_PATH;
+ RegQueryValueEx(hkeyHosts, DATABASEPATH, NULL, NULL, tmp,
+ &dwLength);
+ ExpandEnvironmentStrings(tmp, PATH_HOSTS, MAX_PATH);
+ RegCloseKey(hkeyHosts);
+ }
+ }
else
GetWindowsDirectory(PATH_HOSTS, MAX_PATH);
@@ -255,14 +255,14 @@ static int file_lookup(const char *name, struct hostent **host)
while ((status = ares__get_hostent(fp, host)) == ARES_SUCCESS)
{
if (strcasecmp((*host)->h_name, name) == 0)
- break;
+ break;
for (alias = (*host)->h_aliases; *alias; alias++)
- {
- if (strcasecmp(*alias, name) == 0)
- break;
- }
+ {
+ if (strcasecmp(*alias, name) == 0)
+ break;
+ }
if (*alias)
- break;
+ break;
ares_free_hostent(*host);
}
fclose(fp);
@@ -274,7 +274,7 @@ static int file_lookup(const char *name, struct hostent **host)
}
static void sort_addresses(struct hostent *host, struct apattern *sortlist,
- int nsort)
+ int nsort)
{
struct in_addr a1, a2;
int i1, i2, ind1, ind2;
@@ -289,13 +289,13 @@ static void sort_addresses(struct hostent *host, struct apattern *sortlist,
memcpy(&a1, host->h_addr_list[i1], sizeof(struct in_addr));
ind1 = get_address_index(&a1, sortlist, nsort);
for (i2 = i1 - 1; i2 >= 0; i2--)
- {
- memcpy(&a2, host->h_addr_list[i2], sizeof(struct in_addr));
- ind2 = get_address_index(&a2, sortlist, nsort);
- if (ind2 <= ind1)
- break;
- memcpy(host->h_addr_list[i2 + 1], &a2, sizeof(struct in_addr));
- }
+ {
+ memcpy(&a2, host->h_addr_list[i2], sizeof(struct in_addr));
+ ind2 = get_address_index(&a2, sortlist, nsort);
+ if (ind2 <= ind1)
+ break;
+ memcpy(host->h_addr_list[i2 + 1], &a2, sizeof(struct in_addr));
+ }
memcpy(host->h_addr_list[i2 + 1], &a1, sizeof(struct in_addr));
}
}
@@ -304,14 +304,14 @@ static void sort_addresses(struct hostent *host, struct apattern *sortlist,
* if none of them match.
*/
static int get_address_index(struct in_addr *addr, struct apattern *sortlist,
- int nsort)
+ int nsort)
{
int i;
for (i = 0; i < nsort; i++)
{
if ((addr->s_addr & sortlist[i].mask.s_addr) == sortlist[i].addr.s_addr)
- break;
+ break;
}
return i;
}
diff --git a/ares/ares_init.c b/ares/ares_init.c
index 227067ea2..c24523351 100644
--- a/ares/ares_init.c
+++ b/ares/ares_init.c
@@ -50,7 +50,7 @@
#endif
static int init_by_options(ares_channel channel, struct ares_options *options,
- int optmask);
+ int optmask);
static int init_by_environment(ares_channel channel);
static int init_by_resolv_conf(ares_channel channel);
static int init_by_defaults(ares_channel channel);
@@ -58,9 +58,9 @@ static int config_domain(ares_channel channel, char *str);
static int config_lookup(ares_channel channel, const char *str,
const char *bindch, const char *filech);
static int config_nameserver(struct server_state **servers, int *nservers,
- char *str);
+ char *str);
static int config_sortlist(struct apattern **sortlist, int *nsort,
- const char *str);
+ const char *str);
static int set_search(ares_channel channel, const char *str);
static int set_options(ares_channel channel, const char *str);
static char *try_config(char *s, const char *opt);
@@ -74,7 +74,7 @@ int ares_init(ares_channel *channelptr)
}
int ares_init_options(ares_channel *channelptr, struct ares_options *options,
- int optmask)
+ int optmask)
{
ares_channel channel;
int i, status;
@@ -116,15 +116,15 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
{
/* Something failed; clean up memory we may have allocated. */
if (channel->nservers != -1)
- free(channel->servers);
+ free(channel->servers);
if (channel->domains)
- {
- for (i = 0; i < channel->ndomains; i++)
- free(channel->domains[i]);
- free(channel->domains);
- }
+ {
+ for (i = 0; i < channel->ndomains; i++)
+ free(channel->domains[i]);
+ free(channel->domains);
+ }
if (channel->sortlist)
- free(channel->sortlist);
+ free(channel->sortlist);
if(channel->lookups)
free(channel->lookups);
free(channel);
@@ -163,7 +163,7 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
}
static int init_by_options(ares_channel channel, struct ares_options *options,
- int optmask)
+ int optmask)
{
int i;
@@ -185,11 +185,11 @@ static int init_by_options(ares_channel channel, struct ares_options *options,
if ((optmask & ARES_OPT_SERVERS) && channel->nservers == -1)
{
channel->servers =
- malloc(options->nservers * sizeof(struct server_state));
+ malloc(options->nservers * sizeof(struct server_state));
if (!channel->servers && options->nservers != 0)
- return ARES_ENOMEM;
+ return ARES_ENOMEM;
for (i = 0; i < options->nservers; i++)
- channel->servers[i].addr = options->servers[i];
+ channel->servers[i].addr = options->servers[i];
channel->nservers = options->nservers;
}
@@ -200,14 +200,14 @@ static int init_by_options(ares_channel channel, struct ares_options *options,
{
channel->domains = malloc(options->ndomains * sizeof(char *));
if (!channel->domains && options->ndomains != 0)
- return ARES_ENOMEM;
+ return ARES_ENOMEM;
for (i = 0; i < options->ndomains; i++)
- {
- channel->ndomains = i;
- channel->domains[i] = strdup(options->domains[i]);
- if (!channel->domains[i])
- return ARES_ENOMEM;
- }
+ {
+ channel->ndomains = i;
+ channel->domains[i] = strdup(options->domains[i]);
+ if (!channel->domains[i])
+ return ARES_ENOMEM;
+ }
channel->ndomains = options->ndomains;
}
@@ -216,7 +216,7 @@ static int init_by_options(ares_channel channel, struct ares_options *options,
{
channel->lookups = strdup(options->lookups);
if (!channel->lookups)
- return ARES_ENOMEM;
+ return ARES_ENOMEM;
}
return ARES_SUCCESS;
@@ -232,7 +232,7 @@ static int init_by_environment(ares_channel channel)
{
status = set_search(channel, localdomain);
if (status != ARES_SUCCESS)
- return status;
+ return status;
}
res_options = getenv("RES_OPTIONS");
@@ -240,7 +240,7 @@ static int init_by_environment(ares_channel channel)
{
status = set_options(channel, res_options);
if (status != ARES_SUCCESS)
- return status;
+ return status;
}
return ARES_SUCCESS;
@@ -392,14 +392,14 @@ static int init_by_resolv_conf(ares_channel channel)
On Windows 9X, the DNS server can be found in:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP\NameServer
- On Windows NT/2000/XP/2003:
+ On Windows NT/2000/XP/2003:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\NameServer
- or
+ or
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DhcpNameServer
- or
+ or
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\{AdapterID}\
NameServer
- or
+ or
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\{AdapterID}\
DhcpNameServer
*/
@@ -663,7 +663,7 @@ static int init_by_defaults(ares_channel channel)
/* If nobody specified servers, try a local named. */
channel->servers = malloc(sizeof(struct server_state));
if (!channel->servers)
- return ARES_ENOMEM;
+ return ARES_ENOMEM;
channel->servers[0].addr.s_addr = htonl(INADDR_LOOPBACK);
channel->nservers = 1;
}
@@ -674,22 +674,22 @@ static int init_by_defaults(ares_channel channel)
* or set it to empty if the hostname isn't helpful.
*/
if (gethostname(hostname, sizeof(hostname)) == -1
- || !strchr(hostname, '.'))
- {
- channel->domains = malloc(0);
- channel->ndomains = 0;
- }
+ || !strchr(hostname, '.'))
+ {
+ channel->domains = malloc(0);
+ channel->ndomains = 0;
+ }
else
- {
- channel->domains = malloc(sizeof(char *));
- if (!channel->domains)
- return ARES_ENOMEM;
- channel->ndomains = 0;
- channel->domains[0] = strdup(strchr(hostname, '.') + 1);
- if (!channel->domains[0])
- return ARES_ENOMEM;
- channel->ndomains = 1;
- }
+ {
+ channel->domains = malloc(sizeof(char *));
+ if (!channel->domains)
+ return ARES_ENOMEM;
+ channel->ndomains = 0;
+ channel->domains[0] = strdup(strchr(hostname, '.') + 1);
+ if (!channel->domains[0])
+ return ARES_ENOMEM;
+ channel->ndomains = 1;
+ }
}
if (channel->nsort == -1)
@@ -702,7 +702,7 @@ static int init_by_defaults(ares_channel channel)
{
channel->lookups = strdup("fb");
if (!channel->lookups)
- return ARES_ENOMEM;
+ return ARES_ENOMEM;
}
return ARES_SUCCESS;
@@ -735,13 +735,13 @@ static int config_lookup(ares_channel channel, const char *str,
while (*p)
{
if ((*p == *bindch || *p == *filech) && l < lookups + 2) {
- if (*p == *bindch) *l++ = 'b';
+ if (*p == *bindch) *l++ = 'b';
else *l++ = 'f';
}
while (*p && !isspace((unsigned char)*p) && (*p != ','))
- p++;
+ p++;
while (*p && (isspace((unsigned char)*p) || (*p == ',')))
- p++;
+ p++;
}
*l = 0;
channel->lookups = strdup(lookups);
@@ -749,7 +749,7 @@ static int config_lookup(ares_channel channel, const char *str,
}
static int config_nameserver(struct server_state **servers, int *nservers,
- char *str)
+ char *str)
{
struct in_addr addr;
struct server_state *newserv;
@@ -810,7 +810,7 @@ static int config_nameserver(struct server_state **servers, int *nservers,
}
static int config_sortlist(struct apattern **sortlist, int *nsort,
- const char *str)
+ const char *str)
{
struct apattern pat, *newsort;
const char *q;
@@ -820,37 +820,37 @@ static int config_sortlist(struct apattern **sortlist, int *nsort,
{
q = str;
while (*q && *q != '/' && *q != ';' && !isspace((unsigned char)*q))
- q++;
+ q++;
if (ip_addr(str, (int)(q - str), &pat.addr) == 0)
- {
- /* We have a pattern address; now determine the mask. */
- if (*q == '/')
- {
- str = q + 1;
- while (*q && *q != ';' && !isspace((unsigned char)*q))
- q++;
- if (ip_addr(str, (int)(q - str), &pat.mask) != 0)
- natural_mask(&pat);
- }
- else
- natural_mask(&pat);
-
- /* Add this pattern to our list. */
- newsort = realloc(*sortlist, (*nsort + 1) * sizeof(struct apattern));
- if (!newsort)
- return ARES_ENOMEM;
- newsort[*nsort] = pat;
- *sortlist = newsort;
- (*nsort)++;
- }
+ {
+ /* We have a pattern address; now determine the mask. */
+ if (*q == '/')
+ {
+ str = q + 1;
+ while (*q && *q != ';' && !isspace((unsigned char)*q))
+ q++;
+ if (ip_addr(str, (int)(q - str), &pat.mask) != 0)
+ natural_mask(&pat);
+ }
+ else
+ natural_mask(&pat);
+
+ /* Add this pattern to our list. */
+ newsort = realloc(*sortlist, (*nsort + 1) * sizeof(struct apattern));
+ if (!newsort)
+ return ARES_ENOMEM;
+ newsort[*nsort] = pat;
+ *sortlist = newsort;
+ (*nsort)++;
+ }
else
- {
- while (*q && *q != ';' && !isspace((unsigned char)*q))
- q++;
- }
+ {
+ while (*q && *q != ';' && !isspace((unsigned char)*q))
+ q++;
+ }
str = q;
while (isspace((unsigned char)*str))
- str++;
+ str++;
}
return ARES_SUCCESS;
@@ -875,9 +875,9 @@ static int set_search(ares_channel channel, const char *str)
while (*p)
{
while (*p && !isspace((unsigned char)*p))
- p++;
+ p++;
while (isspace((unsigned char)*p))
- p++;
+ p++;
n++;
}
@@ -893,15 +893,15 @@ static int set_search(ares_channel channel, const char *str)
channel->ndomains = n;
q = p;
while (*q && !isspace((unsigned char)*q))
- q++;
+ q++;
channel->domains[n] = malloc(q - p + 1);
if (!channel->domains[n])
- return ARES_ENOMEM;
+ return ARES_ENOMEM;
memcpy(channel->domains[n], p, q - p);
channel->domains[n][q - p] = 0;
p = q;
while (isspace((unsigned char)*p))
- p++;
+ p++;
n++;
}
channel->ndomains = n;
@@ -918,19 +918,19 @@ static int set_options(ares_channel channel, const char *str)
{
q = p;
while (*q && !isspace((unsigned char)*q))
- q++;
+ q++;
val = try_option(p, q, "ndots:");
if (val && channel->ndots == -1)
- channel->ndots = atoi(val);
+ channel->ndots = atoi(val);
val = try_option(p, q, "retrans:");
if (val && channel->timeout == -1)
- channel->timeout = atoi(val);
+ channel->timeout = atoi(val);
val = try_option(p, q, "retry:");
if (val && channel->tries == -1)
- channel->tries = atoi(val);
+ channel->tries = atoi(val);
p = q;
while (isspace((unsigned char)*p))
- p++;
+ p++;
}
return ARES_SUCCESS;
diff --git a/ares/ares_mkquery.c b/ares/ares_mkquery.c
index d2ae66be9..fd9c369fb 100644
--- a/ares/ares_mkquery.c
+++ b/ares/ares_mkquery.c
@@ -47,15 +47,15 @@
*
* AA, TC, RA, and RCODE are only set in responses. Brief description
* of the remaining fields:
- * ID Identifier to match responses with queries
- * QR Query (0) or response (1)
- * Opcode For our purposes, always QUERY
- * RD Recursion desired
- * Z Reserved (zero)
- * QDCOUNT Number of queries
- * ANCOUNT Number of answers
- * NSCOUNT Number of name server records
- * ARCOUNT Number of additional records
+ * ID Identifier to match responses with queries
+ * QR Query (0) or response (1)
+ * Opcode For our purposes, always QUERY
+ * RD Recursion desired
+ * Z Reserved (zero)
+ * QDCOUNT Number of queries
+ * ANCOUNT Number of answers
+ * NSCOUNT Number of name server records
+ * ARCOUNT Number of additional records
*
* Question format, from RFC 1035:
* 1 1 1 1 1 1
@@ -77,7 +77,7 @@
*/
int ares_mkquery(const char *name, int dnsclass, int type, unsigned short id,
- int rd, unsigned char **buf, int *buflen)
+ int rd, unsigned char **buf, int *buflen)
{
int len;
unsigned char *q;
@@ -89,7 +89,7 @@ int ares_mkquery(const char *name, int dnsclass, int type, unsigned short id,
for (p = name; *p; p++)
{
if (*p == '\\' && *(p + 1) != 0)
- p++;
+ p++;
len++;
}
/* If there are n periods in the name, there are n + 1 labels, and
@@ -121,31 +121,31 @@ int ares_mkquery(const char *name, int dnsclass, int type, unsigned short id,
while (*name)
{
if (*name == '.')
- return ARES_EBADNAME;
+ return ARES_EBADNAME;
/* Count the number of bytes in this label. */
len = 0;
for (p = name; *p && *p != '.'; p++)
- {
- if (*p == '\\' && *(p + 1) != 0)
- p++;
- len++;
- }
+ {
+ if (*p == '\\' && *(p + 1) != 0)
+ p++;
+ len++;
+ }
if (len > MAXLABEL)
- return ARES_EBADNAME;
+ return ARES_EBADNAME;
/* Encode the length and copy the data. */
*q++ = len;
for (p = name; *p && *p != '.'; p++)
- {
- if (*p == '\\' && *(p + 1) != 0)
- p++;
- *q++ = *p;
- }
+ {
+ if (*p == '\\' && *(p + 1) != 0)
+ p++;
+ *q++ = *p;
+ }
/* Go to the next label and repeat, unless we hit the end. */
if (!*p)
- break;
+ break;
name = p + 1;
}
diff --git a/ares/ares_parse_a_reply.c b/ares/ares_parse_a_reply.c
index 3e55d8756..296168765 100644
--- a/ares/ares_parse_a_reply.c
+++ b/ares/ares_parse_a_reply.c
@@ -33,7 +33,7 @@
#include "ares_private.h"
int ares_parse_a_reply(const unsigned char *abuf, int alen,
- struct hostent **host)
+ struct hostent **host)
{
unsigned int qdcount, ancount;
int status, i, rr_type, rr_class, rr_len, naddrs;
@@ -92,49 +92,49 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
/* Decode the RR up to the data field. */
status = ares_expand_name(aptr, abuf, alen, &rr_name, &len);
if (status != ARES_SUCCESS)
- break;
+ break;
aptr += len;
if (aptr + RRFIXEDSZ > abuf + alen)
- {
- status = ARES_EBADRESP;
- break;
- }
+ {
+ status = ARES_EBADRESP;
+ break;
+ }
rr_type = DNS_RR_TYPE(aptr);
rr_class = DNS_RR_CLASS(aptr);
rr_len = DNS_RR_LEN(aptr);
aptr += RRFIXEDSZ;
if (rr_class == C_IN && rr_type == T_A
- && rr_len == sizeof(struct in_addr)
- && strcasecmp(rr_name, hostname) == 0)
- {
- memcpy(&addrs[naddrs], aptr, sizeof(struct in_addr));
- naddrs++;
- status = ARES_SUCCESS;
- }
+ && rr_len == sizeof(struct in_addr)
+ && strcasecmp(rr_name, hostname) == 0)
+ {
+ memcpy(&addrs[naddrs], aptr, sizeof(struct in_addr));
+ naddrs++;
+ status = ARES_SUCCESS;
+ }
if (rr_class == C_IN && rr_type == T_CNAME)
- {
- /* Record the RR name as an alias. */
- aliases[naliases] = rr_name;
- naliases++;
+ {
+ /* Record the RR name as an alias. */
+ aliases[naliases] = rr_name;
+ naliases++;
- /* Decode the RR data and replace the hostname with it. */
- status = ares_expand_name(aptr, abuf, alen, &rr_data, &len);
- if (status != ARES_SUCCESS)
- break;
- free(hostname);
- hostname = rr_data;
- }
+ /* Decode the RR data and replace the hostname with it. */
+ status = ares_expand_name(aptr, abuf, alen, &rr_data, &len);
+ if (status != ARES_SUCCESS)
+ break;
+ free(hostname);
+ hostname = rr_data;
+ }
else
- free(rr_name);
+ free(rr_name);
aptr += rr_len;
if (aptr > abuf + alen)
- {
- status = ARES_EBADRESP;
- break;
- }
+ {
+ status = ARES_EBADRESP;
+ break;
+ }
}
if (status == ARES_SUCCESS && naddrs == 0)
@@ -145,23 +145,23 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
aliases[naliases] = NULL;
hostent = malloc(sizeof(struct hostent));
if (hostent)
- {
- hostent->h_addr_list = malloc((naddrs + 1) * sizeof(char *));
- if (hostent->h_addr_list)
- {
- /* Fill in the hostent and return successfully. */
- hostent->h_name = hostname;
- hostent->h_aliases = aliases;
- hostent->h_addrtype = AF_INET;
- hostent->h_length = sizeof(struct in_addr);
- for (i = 0; i < naddrs; i++)
- hostent->h_addr_list[i] = (char *) &addrs[i];
- hostent->h_addr_list[naddrs] = NULL;
- *host = hostent;
- return ARES_SUCCESS;
- }
- free(hostent);
- }
+ {
+ hostent->h_addr_list = malloc((naddrs + 1) * sizeof(char *));
+ if (hostent->h_addr_list)
+ {
+ /* Fill in the hostent and return successfully. */
+ hostent->h_name = hostname;
+ hostent->h_aliases = aliases;
+ hostent->h_addrtype = AF_INET;
+ hostent->h_length = sizeof(struct in_addr);
+ for (i = 0; i < naddrs; i++)
+ hostent->h_addr_list[i] = (char *) &addrs[i];
+ hostent->h_addr_list[naddrs] = NULL;
+ *host = hostent;
+ return ARES_SUCCESS;
+ }
+ free(hostent);
+ }
status = ARES_ENOMEM;
}
for (i = 0; i < naliases; i++)
diff --git a/ares/ares_parse_ptr_reply.c b/ares/ares_parse_ptr_reply.c
index 888b029cf..20df4114b 100644
--- a/ares/ares_parse_ptr_reply.c
+++ b/ares/ares_parse_ptr_reply.c
@@ -32,7 +32,7 @@
#include "ares_private.h"
int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
- int addrlen, int family, struct hostent **host)
+ int addrlen, int family, struct hostent **host)
{
unsigned int qdcount, ancount;
int status, i, rr_type, rr_class, rr_len;
@@ -73,47 +73,47 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
/* Decode the RR up to the data field. */
status = ares_expand_name(aptr, abuf, alen, &rr_name, &len);
if (status != ARES_SUCCESS)
- break;
+ break;
aptr += len;
if (aptr + RRFIXEDSZ > abuf + alen)
- {
- status = ARES_EBADRESP;
- break;
- }
+ {
+ status = ARES_EBADRESP;
+ break;
+ }
rr_type = DNS_RR_TYPE(aptr);
rr_class = DNS_RR_CLASS(aptr);
rr_len = DNS_RR_LEN(aptr);
aptr += RRFIXEDSZ;
if (rr_class == C_IN && rr_type == T_PTR
- && strcasecmp(rr_name, ptrname) == 0)
- {
- /* Decode the RR data and set hostname to it. */
- status = ares_expand_name(aptr, abuf, alen, &rr_data, &len);
- if (status != ARES_SUCCESS)
- break;
- if (hostname)
- free(hostname);
- hostname = rr_data;
- }
+ && strcasecmp(rr_name, ptrname) == 0)
+ {
+ /* Decode the RR data and set hostname to it. */
+ status = ares_expand_name(aptr, abuf, alen, &rr_data, &len);
+ if (status != ARES_SUCCESS)
+ break;
+ if (hostname)
+ free(hostname);
+ hostname = rr_data;
+ }
if (rr_class == C_IN && rr_type == T_CNAME)
- {
- /* Decode the RR data and replace ptrname with it. */
- status = ares_expand_name(aptr, abuf, alen, &rr_data, &len);
- if (status != ARES_SUCCESS)
- break;
- free(ptrname);
- ptrname = rr_data;
- }
+ {
+ /* Decode the RR data and replace ptrname with it. */
+ status = ares_expand_name(aptr, abuf, alen, &rr_data, &len);
+ if (status != ARES_SUCCESS)
+ break;
+ free(ptrname);
+ ptrname = rr_data;
+ }
free(rr_name);
aptr += rr_len;
if (aptr > abuf + alen)
- {
- status = ARES_EBADRESP;
- break;
- }
+ {
+ status = ARES_EBADRESP;
+ break;
+ }
}
if (status == ARES_SUCCESS && !hostname)
@@ -123,33 +123,33 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
/* We got our answer. Allocate memory to build the host entry. */
hostent = malloc(sizeof(struct hostent));
if (hostent)
- {
- hostent->h_addr_list = malloc(2 * sizeof(char *));
- if (hostent->h_addr_list)
- {
- hostent->h_addr_list[0] = malloc(addrlen);
- if (hostent->h_addr_list[0])
- {
- hostent->h_aliases = malloc(sizeof (char *));
- if (hostent->h_aliases)
- {
- /* Fill in the hostent and return successfully. */
- hostent->h_name = hostname;
- hostent->h_aliases[0] = NULL;
- hostent->h_addrtype = family;
- hostent->h_length = addrlen;
- memcpy(hostent->h_addr_list[0], addr, addrlen);
- hostent->h_addr_list[1] = NULL;
- *host = hostent;
- free(ptrname);
- return ARES_SUCCESS;
- }
- free(hostent->h_addr_list[0]);
- }
- free(hostent->h_addr_list);
- }
- free(hostent);
- }
+ {
+ hostent->h_addr_list = malloc(2 * sizeof(char *));
+ if (hostent->h_addr_list)
+ {
+ hostent->h_addr_list[0] = malloc(addrlen);
+ if (hostent->h_addr_list[0])
+ {
+ hostent->h_aliases = malloc(sizeof (char *));
+ if (hostent->h_aliases)
+ {
+ /* Fill in the hostent and return successfully. */
+ hostent->h_name = hostname;
+ hostent->h_aliases[0] = NULL;
+ hostent->h_addrtype = family;
+ hostent->h_length = addrlen;
+ memcpy(hostent->h_addr_list[0], addr, addrlen);
+ hostent->h_addr_list[1] = NULL;
+ *host = hostent;
+ free(ptrname);
+ return ARES_SUCCESS;
+ }
+ free(hostent->h_addr_list[0]);
+ }
+ free(hostent->h_addr_list);
+ }
+ free(hostent);
+ }
status = ARES_ENOMEM;
}
if (hostname)
diff --git a/ares/ares_private.h b/ares/ares_private.h
index 06f876836..47ec4022f 100644
--- a/ares/ares_private.h
+++ b/ares/ares_private.h
@@ -33,10 +33,10 @@
#define writev(s,v,c) writev_s(s,v,c)
#endif
-#define DEFAULT_TIMEOUT 5
-#define DEFAULT_TRIES 4
+#define DEFAULT_TIMEOUT 5
+#define DEFAULT_TRIES 4
#ifndef INADDR_NONE
-#define INADDR_NONE 0xffffffff
+#define INADDR_NONE 0xffffffff
#endif
#if defined(WIN32) && !defined(WATT32)
@@ -56,15 +56,15 @@
#elif defined(NETWARE)
#define PATH_RESOLV_CONF "sys:/etc/resolv.cfg"
-#define PATH_HOSTS "sys:/etc/hosts"
+#define PATH_HOSTS "sys:/etc/hosts"
#else
-#define PATH_RESOLV_CONF "/etc/resolv.conf"
+#define PATH_RESOLV_CONF "/etc/resolv.conf"
#ifdef ETC_INET
-#define PATH_HOSTS "/etc/inet/hosts"
+#define PATH_HOSTS "/etc/inet/hosts"
#else
-#define PATH_HOSTS "/etc/hosts"
+#define PATH_HOSTS "/etc/hosts"
#endif
#endif
diff --git a/ares/ares_process.c b/ares/ares_process.c
index 19fe08289..887149efb 100644
--- a/ares/ares_process.c
+++ b/ares/ares_process.c
@@ -49,21 +49,21 @@
#endif
static void write_tcp_data(ares_channel channel, fd_set *write_fds,
- time_t now);
+ time_t now);
static void read_tcp_data(ares_channel channel, fd_set *read_fds, time_t now);
static void read_udp_packets(ares_channel channel, fd_set *read_fds,
- time_t now);
+ time_t now);
static void process_timeouts(ares_channel channel, time_t now);
static void process_answer(ares_channel channel, unsigned char *abuf,
- int alen, int whichserver, int tcp, int now);
+ int alen, int whichserver, int tcp, int now);
static void handle_error(ares_channel channel, int whichserver, time_t now);
static struct query *next_server(ares_channel channel, struct query *query, time_t now);
static int open_tcp_socket(ares_channel channel, struct server_state *server);
static int open_udp_socket(ares_channel channel, struct server_state *server);
static int same_questions(const unsigned char *qbuf, int qlen,
- const unsigned char *abuf, int alen);
+ const unsigned char *abuf, int alen);
static struct query *end_query(ares_channel channel, struct query *query, int status,
- unsigned char *abuf, int alen);
+ unsigned char *abuf, int alen);
/* Something interesting happened on the wire, or there was a timeout.
* See what's up and respond accordingly.
@@ -97,81 +97,81 @@ static void write_tcp_data(ares_channel channel, fd_set *write_fds, time_t now)
/* Make sure server has data to send and is selected in write_fds. */
server = &channel->servers[i];
if (!server->qhead || server->tcp_socket == ARES_SOCKET_BAD
- || !FD_ISSET(server->tcp_socket, write_fds))
- continue;
+ || !FD_ISSET(server->tcp_socket, write_fds))
+ continue;
/* Count the number of send queue items. */
n = 0;
for (sendreq = server->qhead; sendreq; sendreq = sendreq->next)
- n++;
+ n++;
/* Allocate iovecs so we can send all our data at once. */
vec = malloc(n * sizeof(struct iovec));
if (vec)
- {
- /* Fill in the iovecs and send. */
- n = 0;
- for (sendreq = server->qhead; sendreq; sendreq = sendreq->next)
- {
- vec[n].iov_base = (char *) sendreq->data;
- vec[n].iov_len = sendreq->len;
- n++;
- }
- wcount = writev(server->tcp_socket, vec, n);
- free(vec);
- if (wcount < 0)
- {
- handle_error(channel, i, now);
- continue;
- }
-
- /* Advance the send queue by as many bytes as we sent. */
- while (wcount)
- {
- sendreq = server->qhead;
- if ((size_t)wcount >= sendreq->len)
- {
- wcount -= sendreq->len;
- server->qhead = sendreq->next;
- if (server->qhead == NULL)
- server->qtail = NULL;
- free(sendreq);
- }
- else
- {
- sendreq->data += wcount;
- sendreq->len -= wcount;
- break;
- }
- }
- }
+ {
+ /* Fill in the iovecs and send. */
+ n = 0;
+ for (sendreq = server->qhead; sendreq; sendreq = sendreq->next)
+ {
+ vec[n].iov_base = (char *) sendreq->data;
+ vec[n].iov_len = sendreq->len;
+ n++;
+ }
+ wcount = writev(server->tcp_socket, vec, n);
+ free(vec);
+ if (wcount < 0)
+ {
+ handle_error(channel, i, now);
+ continue;
+ }
+
+ /* Advance the send queue by as many bytes as we sent. */
+ while (wcount)
+ {
+ sendreq = server->qhead;
+ if ((size_t)wcount >= sendreq->len)
+ {
+ wcount -= sendreq->len;
+ server->qhead = sendreq->next;
+ if (server->qhead == NULL)
+ server->qtail = NULL;
+ free(sendreq);
+ }
+ else
+ {
+ sendreq->data += wcount;
+ sendreq->len -= wcount;
+ break;
+ }
+ }
+ }
else
- {
- /* Can't allocate iovecs; just send the first request. */
- sendreq = server->qhead;
+ {
+ /* Can't allocate iovecs; just send the first request. */
+ sendreq = server->qhead;
scount = send(server->tcp_socket, sendreq->data, sendreq->len, 0);
- if (scount < 0)
- {
- handle_error(channel, i, now);
- continue;
- }
-
- /* Advance the send queue by as many bytes as we sent. */
- if ((size_t)scount == sendreq->len)
- {
- server->qhead = sendreq->next;
- if (server->qhead == NULL)
- server->qtail = NULL;
- free(sendreq);
- }
- else
- {
- sendreq->data += scount;
- sendreq->len -= scount;
- }
- }
+ if (scount < 0)
+ {
+ handle_error(channel, i, now);
+ continue;
+ }
+
+ /* Advance the send queue by as many bytes as we sent. */
+ if ((size_t)scount == sendreq->len)
+ {
+ server->qhead = sendreq->next;
+ if (server->qhead == NULL)
+ server->qtail = NULL;
+ free(sendreq);
+ }
+ else
+ {
+ sendreq->data += scount;
+ sendreq->len -= scount;
+ }
+ }
}
}
@@ -190,68 +190,68 @@ static void read_tcp_data(ares_channel channel, fd_set *read_fds, time_t now)
server = &channel->servers[i];
if (server->tcp_socket == ARES_SOCKET_BAD ||
!FD_ISSET(server->tcp_socket, read_fds))
- continue;
+ continue;
if (server->tcp_lenbuf_pos != 2)
- {
- /* We haven't yet read a length word, so read that (or
- * what's left to read of it).
- */
+ {
+ /* We haven't yet read a length word, so read that (or
+ * what's left to read of it).
+ */
count = recv(server->tcp_socket,
server->tcp_lenbuf + server->tcp_buffer_pos,
2 - server->tcp_buffer_pos, 0);
- if (count <= 0)
- {
- handle_error(channel, i, now);
- continue;
- }
-
- server->tcp_lenbuf_pos += count;
- if (server->tcp_lenbuf_pos == 2)
- {
- /* We finished reading the length word. Decode the
+ if (count <= 0)
+ {
+ handle_error(channel, i, now);
+ continue;
+ }
+
+ server->tcp_lenbuf_pos += count;
+ if (server->tcp_lenbuf_pos == 2)
+ {
+ /* We finished reading the length word. Decode the
* length and allocate a buffer for the data.
- */
- server->tcp_length = server->tcp_lenbuf[0] << 8
- | server->tcp_lenbuf[1];
- server->tcp_buffer = malloc(server->tcp_length);
- if (!server->tcp_buffer)
- handle_error(channel, i, now);
- server->tcp_buffer_pos = 0;
- }
- }
+ */
+ server->tcp_length = server->tcp_lenbuf[0] << 8
+ | server->tcp_lenbuf[1];
+ server->tcp_buffer = malloc(server->tcp_length);
+ if (!server->tcp_buffer)
+ handle_error(channel, i, now);
+ server->tcp_buffer_pos = 0;
+ }
+ }
else
- {
- /* Read data into the allocated buffer. */
- count = recv(server->tcp_socket,
- server->tcp_buffer + server->tcp_buffer_pos,
- server->tcp_length - server->tcp_buffer_pos, 0);
- if (count <= 0)
- {
- handle_error(channel, i, now);
- continue;
- }
-
- server->tcp_buffer_pos += count;
- if (server->tcp_buffer_pos == server->tcp_length)
- {
- /* We finished reading this answer; process it and
+ {
+ /* Read data into the allocated buffer. */
+ count = recv(server->tcp_socket,
+ server->tcp_buffer + server->tcp_buffer_pos,
+ server->tcp_length - server->tcp_buffer_pos, 0);
+ if (count <= 0)
+ {
+ handle_error(channel, i, now);
+ continue;
+ }
+
+ server->tcp_buffer_pos += count;
+ if (server->tcp_buffer_pos == server->tcp_length)
+ {
+ /* We finished reading this answer; process it and
* prepare to read another length word.
- */
- process_answer(channel, server->tcp_buffer, server->tcp_length,
- i, 1, now);
+ */
+ process_answer(channel, server->tcp_buffer, server->tcp_length,
+ i, 1, now);
if (server->tcp_buffer)
- free(server->tcp_buffer);
- server->tcp_buffer = NULL;
- server->tcp_lenbuf_pos = 0;
- }
- }
+ free(server->tcp_buffer);
+ server->tcp_buffer = NULL;
+ server->tcp_lenbuf_pos = 0;
+ }
+ }
}
}
/* If any UDP sockets select true for reading, process them. */
static void read_udp_packets(ares_channel channel, fd_set *read_fds,
- time_t now)
+ time_t now)
{
struct server_state *server;
int i, count;
@@ -264,11 +264,11 @@ static void read_udp_packets(ares_channel channel, fd_set *read_fds,
if (server->udp_socket == ARES_SOCKET_BAD ||
!FD_ISSET(server->udp_socket, read_fds))
- continue;
+ continue;
count = recv(server->udp_socket, buf, sizeof(buf), 0);
if (count <= 0)
- handle_error(channel, i, now);
+ handle_error(channel, i, now);
process_answer(channel, buf, count, i, 0, now);
}
@@ -283,16 +283,16 @@ static void process_timeouts(ares_channel channel, time_t now)
{
next = query->next;
if (query->timeout != 0 && now >= query->timeout)
- {
- query->error_status = ARES_ETIMEOUT;
- next = next_server(channel, query, now);
- }
+ {
+ query->error_status = ARES_ETIMEOUT;
+ next = next_server(channel, query, now);
+ }
}
}
/* Handle an answer from a server. */
static void process_answer(ares_channel channel, unsigned char *abuf,
- int alen, int whichserver, int tcp, int now)
+ int alen, int whichserver, int tcp, int now)
{
int id, tc, rcode;
struct query *query;
@@ -311,7 +311,7 @@ static void process_answer(ares_channel channel, unsigned char *abuf,
for (query = channel->queries; query; query = query->next)
{
if (query->qid == id)
- break;
+ break;
}
if (!query)
return;
@@ -323,10 +323,10 @@ static void process_answer(ares_channel channel, unsigned char *abuf,
if ((tc || alen > PACKETSZ) && !tcp && !(channel->flags & ARES_FLAG_IGNTC))
{
if (!query->using_tcp)
- {
- query->using_tcp = 1;
- ares__send_query(channel, query, now);
- }
+ {
+ query->using_tcp = 1;
+ ares__send_query(channel, query, now);
+ }
return;
}
@@ -342,18 +342,18 @@ static void process_answer(ares_channel channel, unsigned char *abuf,
if (!(channel->flags & ARES_FLAG_NOCHECKRESP))
{
if (rcode == SERVFAIL || rcode == NOTIMP || rcode == REFUSED)
- {
- query->skip_server[whichserver] = 1;
- if (query->server == whichserver)
- next_server(channel, query, now);
- return;
- }
+ {
+ query->skip_server[whichserver] = 1;
+ if (query->server == whichserver)
+ next_server(channel, query, now);
+ return;
+ }
if (!same_questions(query->qbuf, query->qlen, abuf, alen))
- {
- if (query->server == whichserver)
- next_server(channel, query, now);
- return;
- }
+ {
+ if (query->server == whichserver)
+ next_server(channel, query, now);
+ return;
+ }
}
end_query(channel, query, ARES_SUCCESS, abuf, alen);
@@ -374,10 +374,10 @@ static void handle_error(ares_channel channel, int whichserver, time_t now)
{
next = query->next;
if (query->server == whichserver)
- {
- query->skip_server[whichserver] = 1;
- next = next_server(channel, query, now);
- }
+ {
+ query->skip_server[whichserver] = 1;
+ next = next_server(channel, query, now);
+ }
}
}
@@ -388,18 +388,18 @@ static struct query *next_server(ares_channel channel, struct query *query, time
for (; query->try < channel->tries; query->try++)
{
for (; query->server < channel->nservers; query->server++)
- {
- if (!query->skip_server[query->server])
- {
- ares__send_query(channel, query, now);
- return (query->next);
- }
- }
+ {
+ if (!query->skip_server[query->server])
+ {
+ ares__send_query(channel, query, now);
+ return (query->next);
+ }
+ }
query->server = 0;
/* Only one try if we're using TCP. */
if (query->using_tcp)
- break;
+ break;
}
return end_query(channel, query, query->error_status, NULL, 0);
}
@@ -416,50 +416,50 @@ void ares__send_query(ares_channel channel, struct query *query, time_t now)
* a send request.
*/
if (server->tcp_socket == ARES_SOCKET_BAD)
- {
- if (open_tcp_socket(channel, server) == -1)
- {
- query->skip_server[query->server] = 1;
- next_server(channel, query, now);
- return;
- }
- }
+ {
+ if (open_tcp_socket(channel, server) == -1)
+ {
+ query->skip_server[query->server] = 1;
+ next_server(channel, query, now);
+ return;
+ }
+ }
sendreq = calloc(sizeof(struct send_request), 1);
if (!sendreq)
{
- end_query(channel, query, ARES_ENOMEM, NULL, 0);
+ end_query(channel, query, ARES_ENOMEM, NULL, 0);
return;
}
sendreq->data = query->tcpbuf;
sendreq->len = query->tcplen;
sendreq->next = NULL;
if (server->qtail)
- server->qtail->next = sendreq;
+ server->qtail->next = sendreq;
else
- server->qhead = sendreq;
+ server->qhead = sendreq;
server->qtail = sendreq;
query->timeout = 0;
}
else
{
if (server->udp_socket == ARES_SOCKET_BAD)
- {
- if (open_udp_socket(channel, server) == -1)
- {
- query->skip_server[query->server] = 1;
- next_server(channel, query, now);
- return;
- }
- }
+ {
+ if (open_udp_socket(channel, server) == -1)
+ {
+ query->skip_server[query->server] = 1;
+ next_server(channel, query, now);
+ return;
+ }
+ }
if (send(server->udp_socket, query->qbuf, query->qlen, 0) == -1)
- {
- query->skip_server[query->server] = 1;
- next_server(channel, query, now);
- return;
- }
+ {
+ query->skip_server[query->server] = 1;
+ next_server(channel, query, now);
+ return;
+ }
query->timeout = now
- + ((query->try == 0) ? channel->timeout
- : channel->timeout << query->try / channel->nservers);
+ + ((query->try == 0) ? channel->timeout
+ : channel->timeout << query->try / channel->nservers);
}
}
@@ -540,7 +540,7 @@ static int open_udp_socket(ares_channel channel, struct server_state *server)
}
static int same_questions(const unsigned char *qbuf, int qlen,
- const unsigned char *abuf, int alen)
+ const unsigned char *abuf, int alen)
{
struct {
const unsigned char *p;
@@ -567,14 +567,14 @@ static int same_questions(const unsigned char *qbuf, int qlen,
{
/* Decode the question in the query. */
if (ares_expand_name(q.p, qbuf, qlen, &q.name, &q.namelen)
- != ARES_SUCCESS)
- return 0;
+ != ARES_SUCCESS)
+ return 0;
q.p += q.namelen;
if (q.p + QFIXEDSZ > qbuf + qlen)
- {
- free(q.name);
- return 0;
- }
+ {
+ free(q.name);
+ return 0;
+ }
q.type = DNS_QUESTION_TYPE(q.p);
q.dnsclass = DNS_QUESTION_CLASS(q.p);
q.p += QFIXEDSZ;
@@ -582,44 +582,44 @@ static int same_questions(const unsigned char *qbuf, int qlen,
/* Search for this question in the answer. */
a.p = abuf + HFIXEDSZ;
for (j = 0; j < a.qdcount; j++)
- {
- /* Decode the question in the answer. */
- if (ares_expand_name(a.p, abuf, alen, &a.name, &a.namelen)
- != ARES_SUCCESS)
- {
- free(q.name);
- return 0;
- }
- a.p += a.namelen;
- if (a.p + QFIXEDSZ > abuf + alen)
- {
- free(q.name);
- free(a.name);
- return 0;
- }
- a.type = DNS_QUESTION_TYPE(a.p);
- a.dnsclass = DNS_QUESTION_CLASS(a.p);
- a.p += QFIXEDSZ;
-
- /* Compare the decoded questions. */
- if (strcasecmp(q.name, a.name) == 0 && q.type == a.type
- && q.dnsclass == a.dnsclass)
- {
- free(a.name);
- break;
- }
- free(a.name);
- }
+ {
+ /* Decode the question in the answer. */
+ if (ares_expand_name(a.p, abuf, alen, &a.name, &a.namelen)
+ != ARES_SUCCESS)
+ {
+ free(q.name);
+ return 0;
+ }
+ a.p += a.namelen;
+ if (a.p + QFIXEDSZ > abuf + alen)
+ {
+ free(q.name);
+ free(a.name);
+ return 0;
+ }
+ a.type = DNS_QUESTION_TYPE(a.p);
+ a.dnsclass = DNS_QUESTION_CLASS(a.p);
+ a.p += QFIXEDSZ;
+
+ /* Compare the decoded questions. */
+ if (strcasecmp(q.name, a.name) == 0 && q.type == a.type
+ && q.dnsclass == a.dnsclass)
+ {
+ free(a.name);
+ break;
+ }
+ free(a.name);
+ }
free(q.name);
if (j == a.qdcount)
- return 0;
+ return 0;
}
return 1;
}
static struct query *end_query (ares_channel channel, struct query *query, int status,
- unsigned char *abuf, int alen)
+ unsigned char *abuf, int alen)
{
struct query **q, *next;
int i;
@@ -628,7 +628,7 @@ static struct query *end_query (ares_channel channel, struct query *query, int s
for (q = &channel->queries; *q; q = &(*q)->next)
{
if (*q == query)
- break;
+ break;
}
*q = query->next;
if (*q)
@@ -645,7 +645,7 @@ static struct query *end_query (ares_channel channel, struct query *query, int s
if (!channel->queries && !(channel->flags & ARES_FLAG_STAYOPEN))
{
for (i = 0; i < channel->nservers; i++)
- ares__close_sockets(&channel->servers[i]);
+ ares__close_sockets(&channel->servers[i]);
}
return (next);
}
diff --git a/ares/ares_query.c b/ares/ares_query.c
index 2b832654f..b39dc6d5c 100644
--- a/ares/ares_query.c
+++ b/ares/ares_query.c
@@ -36,7 +36,7 @@ struct qquery {
static void qcallback(void *arg, int status, unsigned char *abuf, int alen);
void ares_query(ares_channel channel, const char *name, int dnsclass,
- int type, ares_callback callback, void *arg)
+ int type, ares_callback callback, void *arg)
{
struct qquery *qquery;
unsigned char *qbuf;
@@ -45,7 +45,7 @@ void ares_query(ares_channel channel, const char *name, int dnsclass,
/* Compose the query. */
rd = !(channel->flags & ARES_FLAG_NORECURSE);
status = ares_mkquery(name, dnsclass, type, channel->next_id, rd, &qbuf,
- &qlen);
+ &qlen);
channel->next_id++;
if (status != ARES_SUCCESS)
{
@@ -85,26 +85,26 @@ static void qcallback(void *arg, int status, unsigned char *abuf, int alen)
/* Convert errors. */
switch (rcode)
- {
- case NOERROR:
- status = (ancount > 0) ? ARES_SUCCESS : ARES_ENODATA;
- break;
- case FORMERR:
- status = ARES_EFORMERR;
- break;
- case SERVFAIL:
- status = ARES_ESERVFAIL;
- break;
- case NXDOMAIN:
- status = ARES_ENOTFOUND;
- break;
- case NOTIMP:
- status = ARES_ENOTIMP;
- break;
- case REFUSED:
- status = ARES_EREFUSED;
- break;
- }
+ {
+ case NOERROR:
+ status = (ancount > 0) ? ARES_SUCCESS : ARES_ENODATA;
+ break;
+ case FORMERR:
+ status = ARES_EFORMERR;
+ break;
+ case SERVFAIL:
+ status = ARES_ESERVFAIL;
+ break;
+ case NXDOMAIN:
+ status = ARES_ENOTFOUND;
+ break;
+ case NOTIMP:
+ status = ARES_ENOTIMP;
+ break;
+ case REFUSED:
+ status = ARES_EREFUSED;
+ break;
+ }
qquery->callback(qquery->arg, status, abuf, alen);
}
free(qquery);
diff --git a/ares/ares_search.c b/ares/ares_search.c
index 37826ee39..dc416c026 100644
--- a/ares/ares_search.c
+++ b/ares/ares_search.c
@@ -29,26 +29,26 @@
struct search_query {
/* Arguments passed to ares_search */
ares_channel channel;
- char *name; /* copied into an allocated buffer */
+ char *name; /* copied into an allocated buffer */
int dnsclass;
int type;
ares_callback callback;
void *arg;
- int status_as_is; /* error status from trying as-is */
- int next_domain; /* next search domain to try */
- int trying_as_is; /* current query is for name as-is */
+ int status_as_is; /* error status from trying as-is */
+ int next_domain; /* next search domain to try */
+ int trying_as_is; /* current query is for name as-is */
};
static void search_callback(void *arg, int status, unsigned char *abuf,
- int alen);
+ int alen);
static void end_squery(struct search_query *squery, int status,
- unsigned char *abuf, int alen);
+ unsigned char *abuf, int alen);
static int cat_domain(const char *name, const char *domain, char **s);
static int single_domain(ares_channel channel, const char *name, char **s);
void ares_search(ares_channel channel, const char *name, int dnsclass,
- int type, ares_callback callback, void *arg)
+ int type, ares_callback callback, void *arg)
{
struct search_query *squery;
char *s;
@@ -99,7 +99,7 @@ void ares_search(ares_channel channel, const char *name, int dnsclass,
for (p = name; *p; p++)
{
if (*p == '.')
- ndots++;
+ ndots++;
}
/* If ndots is at least the channel ndots threshold (usually 1),
@@ -120,22 +120,22 @@ void ares_search(ares_channel channel, const char *name, int dnsclass,
squery->trying_as_is = 0;
status = cat_domain(name, channel->domains[0], &s);
if (status == ARES_SUCCESS)
- {
- ares_query(channel, s, dnsclass, type, search_callback, squery);
- free(s);
- }
+ {
+ ares_query(channel, s, dnsclass, type, search_callback, squery);
+ free(s);
+ }
else
{
/* failed, free the malloc()ed memory */
free(squery->name);
free(squery);
- callback(arg, status, NULL, 0);
+ callback(arg, status, NULL, 0);
}
}
}
static void search_callback(void *arg, int status, unsigned char *abuf,
- int alen)
+ int alen)
{
struct search_query *squery = (struct search_query *) arg;
ares_channel channel = squery->channel;
@@ -149,37 +149,37 @@ static void search_callback(void *arg, int status, unsigned char *abuf,
{
/* Save the status if we were trying as-is. */
if (squery->trying_as_is)
- squery->status_as_is = status;
+ squery->status_as_is = status;
if (squery->next_domain < channel->ndomains)
- {
- /* Try the next domain. */
- status = cat_domain(squery->name,
- channel->domains[squery->next_domain], &s);
- if (status != ARES_SUCCESS)
- end_squery(squery, status, NULL, 0);
- else
- {
- squery->trying_as_is = 0;
- squery->next_domain++;
- ares_query(channel, s, squery->dnsclass, squery->type,
- search_callback, squery);
- free(s);
- }
- }
+ {
+ /* Try the next domain. */
+ status = cat_domain(squery->name,
+ channel->domains[squery->next_domain], &s);
+ if (status != ARES_SUCCESS)
+ end_squery(squery, status, NULL, 0);
+ else
+ {
+ squery->trying_as_is = 0;
+ squery->next_domain++;
+ ares_query(channel, s, squery->dnsclass, squery->type,
+ search_callback, squery);
+ free(s);
+ }
+ }
else if (squery->status_as_is == -1)
- {
- /* Try the name as-is at the end. */
- squery->trying_as_is = 1;
- ares_query(channel, squery->name, squery->dnsclass, squery->type,
- search_callback, squery);
- }
+ {
+ /* Try the name as-is at the end. */
+ squery->trying_as_is = 1;
+ ares_query(channel, squery->name, squery->dnsclass, squery->type,
+ search_callback, squery);
+ }
else
- end_squery(squery, squery->status_as_is, NULL, 0);
+ end_squery(squery, squery->status_as_is, NULL, 0);
}
}
static void end_squery(struct search_query *squery, int status,
- unsigned char *abuf, int alen)
+ unsigned char *abuf, int alen)
{
squery->callback(squery->arg, status, abuf, alen);
free(squery->name);
@@ -229,41 +229,41 @@ static int single_domain(ares_channel channel, const char *name, char **s)
/* The name might be a host alias. */
hostaliases = getenv("HOSTALIASES");
if (hostaliases)
- {
- fp = fopen(hostaliases, "r");
- if (fp)
- {
- while ((status = ares__read_line(fp, &line, &linesize))
- == ARES_SUCCESS)
- {
- if (strncasecmp(line, name, len) != 0 ||
- !isspace((unsigned char)line[len]))
- continue;
- p = line + len;
- while (isspace((unsigned char)*p))
- p++;
- if (*p)
- {
- q = p + 1;
- while (*q && !isspace((unsigned char)*q))
- q++;
- *s = malloc(q - p + 1);
- if (*s)
- {
- memcpy(*s, p, q - p);
- (*s)[q - p] = 0;
- }
- free(line);
- fclose(fp);
- return (*s) ? ARES_SUCCESS : ARES_ENOMEM;
- }
- }
- free(line);
- fclose(fp);
- if (status != ARES_SUCCESS)
- return status;
- }
- }
+ {
+ fp = fopen(hostaliases, "r");
+ if (fp)
+ {
+ while ((status = ares__read_line(fp, &line, &linesize))
+ == ARES_SUCCESS)
+ {
+ if (strncasecmp(line, name, len) != 0 ||
+ !isspace((unsigned char)line[len]))
+ continue;
+ p = line + len;
+ while (isspace((unsigned char)*p))
+ p++;
+ if (*p)
+ {
+ q = p + 1;
+ while (*q && !isspace((unsigned char)*q))
+ q++;
+ *s = malloc(q - p + 1);
+ if (*s)
+ {
+ memcpy(*s, p, q - p);
+ (*s)[q - p] = 0;
+ }
+ free(line);
+ fclose(fp);
+ return (*s) ? ARES_SUCCESS : ARES_ENOMEM;
+ }
+ }
+ free(line);
+ fclose(fp);
+ if (status != ARES_SUCCESS)
+ return status;
+ }
+ }
}
if (channel->flags & ARES_FLAG_NOSEARCH || channel->ndomains == 0)
diff --git a/ares/ares_send.c b/ares/ares_send.c
index 6f0a31d58..99f303966 100644
--- a/ares/ares_send.c
+++ b/ares/ares_send.c
@@ -31,7 +31,7 @@
#include "ares_private.h"
void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen,
- ares_callback callback, void *arg)
+ ares_callback callback, void *arg)
{
struct query *query;
int i;
diff --git a/ares/ares_timeout.c b/ares/ares_timeout.c
index 775b0a915..c550218da 100644
--- a/ares/ares_timeout.c
+++ b/ares/ares_timeout.c
@@ -26,7 +26,7 @@
#include "ares_private.h"
struct timeval *ares_timeout(ares_channel channel, struct timeval *maxtv,
- struct timeval *tvbuf)
+ struct timeval *tvbuf)
{
struct query *query;
time_t now;
@@ -42,12 +42,12 @@ struct timeval *ares_timeout(ares_channel channel, struct timeval *maxtv,
for (query = channel->queries; query; query = query->next)
{
if (query->timeout == 0)
- continue;
+ continue;
offset = query->timeout - now;
if (offset < 0)
- offset = 0;
+ offset = 0;
if (min_offset == -1 || offset < min_offset)
- min_offset = offset;
+ min_offset = offset;
}
/* If we found a minimum timeout and it's sooner than the one
diff --git a/curl-style.el b/curl-style.el
index 0069bbc69..25bcd1a37 100644
--- a/curl-style.el
+++ b/curl-style.el
@@ -20,6 +20,13 @@
)
"Curl C Programming Style")
+(defun curl-code-cleanup ()
+ "no docs"
+ (interactive)
+ (untabify (point-min) (point-max))
+ (delete-trailing-whitespace)
+)
+
;; Customizations for all of c-mode, c++-mode, and objc-mode
(defun curl-c-mode-common-hook ()
"Curl C mode hook"
@@ -33,7 +40,7 @@
;; keybindings for C, C++, and Objective-C. We can put these in
;; c-mode-base-map because of inheritance ...
(define-key c-mode-base-map "\M-q" 'c-fill-paragraph)
- (define-key c-mode-base-map "\M-m" 'delete-trailing-whitespace)
+ (define-key c-mode-base-map "\M-m" 'curl-code-cleanup)
(setq c-recognize-knr-p nil)
;;; (add-hook 'write-file-hooks 'delete-trailing-whitespace t)
(setq show-trailing-whitespace t)
diff --git a/docs/MANUAL b/docs/MANUAL
index 7ea420d45..7eac93a00 100644
--- a/docs/MANUAL
+++ b/docs/MANUAL
@@ -580,11 +580,11 @@ NETWORK INTERFACE
Get a web page from a server using a specified port for the interface:
- curl --interface eth0:1 http://www.netscape.com/
+ curl --interface eth0:1 http://www.netscape.com/
or
- curl --interface 192.168.1.10 http://www.netscape.com/
+ curl --interface 192.168.1.10 http://www.netscape.com/
HTTPS
diff --git a/docs/examples/curlx.c b/docs/examples/curlx.c
index c5aabd344..2bb9a064d 100644
--- a/docs/examples/curlx.c
+++ b/docs/examples/curlx.c
@@ -1,4 +1,4 @@
-/*
+/*
curlx.c Authors: Peter Sylvester, Jean-Paul Merlin
This is a little program to demonstrate the usage of
@@ -6,7 +6,7 @@
- an ssl initialisation callback setting a user key and trustbases
coming from a pkcs12 file
- using an ssl application callback to find a URI in the
- certificate presented during ssl session establishment.
+ certificate presented during ssl session establishment.
*/
@@ -20,13 +20,13 @@
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, the following disclaimer,
- * and the original OpenSSL and SSLeay Licences below.
+ * and the original OpenSSL and SSLeay Licences below.
*
* 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions, the following disclaimer
+ * notice, this list of conditions, the following disclaimer
* and the original OpenSSL and SSLeay Licences below in
* the documentation and/or other materials provided with the
- * distribution.
+ * distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgments:
@@ -100,7 +100,7 @@ static char *curlx_usage[]={
" -envpass arg - environement variable which content the tia private key password",
" -out arg - output file (response)- default stdout",
" -in arg - input file (request)- default stdin",
-" -connect arg - URL of the server for the connection ex: www.openevidenve.org",
+" -connect arg - URL of the server for the connection ex: www.openevidenve.org",
" -mimetype arg - MIME type for data in ex : application/timestamp-query or application/dvcs -default application/timestamp-query",
" -acceptmime arg - MIME type acceptable for the response ex : application/timestamp-response or application/dvcs -default none",
" -accesstype arg - an Object identifier in an AIA/SIA method, e.g. AD_DVCS or ad_timestamping",
@@ -109,7 +109,7 @@ NULL
/*
- ./curlx -p12 psy.p12 -envpass XX -in request -verbose -accesstype AD_DVCS
+ ./curlx -p12 psy.p12 -envpass XX -in request -verbose -accesstype AD_DVCS
-mimetype application/dvcs -acceptmime application/dvcs -out response
*/
@@ -134,33 +134,33 @@ typedef struct sslctxparm_st {
static char *i2s_ASN1_IA5STRING( ASN1_IA5STRING *ia5)
{
- char *tmp;
- if(!ia5 || !ia5->length) return NULL;
- tmp = OPENSSL_malloc(ia5->length + 1);
- memcpy(tmp, ia5->data, ia5->length);
- tmp[ia5->length] = 0;
- return tmp;
+ char *tmp;
+ if(!ia5 || !ia5->length) return NULL;
+ tmp = OPENSSL_malloc(ia5->length + 1);
+ memcpy(tmp, ia5->data, ia5->length);
+ tmp[ia5->length] = 0;
+ return tmp;
}
/* A conveniance routine to get an access URI. */
static unsigned char *my_get_ext(X509 * cert, const int type, int extensiontype) {
- int i;
- STACK_OF(ACCESS_DESCRIPTION) * accessinfo ;
- accessinfo = X509_get_ext_d2i(cert, extensiontype, NULL, NULL) ;
-
- if (!sk_ACCESS_DESCRIPTION_num(accessinfo)) return NULL;
- for (i = 0; i < sk_ACCESS_DESCRIPTION_num(accessinfo); i++) {
- ACCESS_DESCRIPTION * ad = sk_ACCESS_DESCRIPTION_value(accessinfo, i);
- if (OBJ_obj2nid(ad->method) == type) {
- if (ad->location->type == GEN_URI) {
- return i2s_ASN1_IA5STRING(ad->location->d.ia5);
- }
- return NULL;
- }
- }
- return NULL;
+ int i;
+ STACK_OF(ACCESS_DESCRIPTION) * accessinfo ;
+ accessinfo = X509_get_ext_d2i(cert, extensiontype, NULL, NULL) ;
+
+ if (!sk_ACCESS_DESCRIPTION_num(accessinfo)) return NULL;
+ for (i = 0; i < sk_ACCESS_DESCRIPTION_num(accessinfo); i++) {
+ ACCESS_DESCRIPTION * ad = sk_ACCESS_DESCRIPTION_value(accessinfo, i);
+ if (OBJ_obj2nid(ad->method) == type) {
+ if (ad->location->type == GEN_URI) {
+ return i2s_ASN1_IA5STRING(ad->location->d.ia5);
+ }
+ return NULL;
+ }
+ }
+ return NULL;
}
/* This is an application verification call back, it does not
@@ -170,192 +170,192 @@ static unsigned char *my_get_ext(X509 * cert, const int type, int extensiontype)
*/
static int ssl_app_verify_callback(X509_STORE_CTX *ctx, void *arg) {
- sslctxparm * p = (sslctxparm *) arg;
- int ok;
-
- if (p->verbose > 2) BIO_printf(p->errorbio,"entering ssl_app_verify_callback\n");
- if ((ok= X509_verify_cert(ctx)) && ctx->cert) {
- unsigned char * accessinfo ;
- if (p->verbose > 1) X509_print_ex(p->errorbio,ctx->cert,0,0);
- if (accessinfo = my_get_ext(ctx->cert,p->accesstype ,NID_sinfo_access)) {
- if (p->verbose) BIO_printf(p->errorbio,"Setting URL from SIA to: %s\n",accessinfo);
- curl_easy_setopt(p->curl, CURLOPT_URL,accessinfo);
- } else if (accessinfo = my_get_ext(ctx->cert,p->accesstype ,NID_info_access)) {
- if (p->verbose) BIO_printf(p->errorbio,"Setting URL from AIA to: %s\n",accessinfo);
- curl_easy_setopt(p->curl, CURLOPT_URL,accessinfo);
- }
- }
- if (p->verbose > 2) BIO_printf(p->errorbio,"leaving ssl_app_verify_callback with %d\n",ok);
- return(ok);
+ sslctxparm * p = (sslctxparm *) arg;
+ int ok;
+
+ if (p->verbose > 2) BIO_printf(p->errorbio,"entering ssl_app_verify_callback\n");
+ if ((ok= X509_verify_cert(ctx)) && ctx->cert) {
+ unsigned char * accessinfo ;
+ if (p->verbose > 1) X509_print_ex(p->errorbio,ctx->cert,0,0);
+ if (accessinfo = my_get_ext(ctx->cert,p->accesstype ,NID_sinfo_access)) {
+ if (p->verbose) BIO_printf(p->errorbio,"Setting URL from SIA to: %s\n",accessinfo);
+ curl_easy_setopt(p->curl, CURLOPT_URL,accessinfo);
+ } else if (accessinfo = my_get_ext(ctx->cert,p->accesstype ,NID_info_access)) {
+ if (p->verbose) BIO_printf(p->errorbio,"Setting URL from AIA to: %s\n",accessinfo);
+ curl_easy_setopt(p->curl, CURLOPT_URL,accessinfo);
+ }
+ }
+ if (p->verbose > 2) BIO_printf(p->errorbio,"leaving ssl_app_verify_callback with %d\n",ok);
+ return(ok);
}
/* This is an example of an curl SSL initialisation call back. The callback sets:
- - a private key and certificate
+ - a private key and certificate
- a trusted ca certificate
- a preferred cipherlist
- an application verification callback (the function above)
*/
static CURLcode sslctxfun(CURL * curl, void * sslctx, void * parm) {
-
- sslctxparm * p = (sslctxparm *) parm;
- SSL_CTX * ctx = (SSL_CTX *) sslctx ;
-
- if (!SSL_CTX_use_certificate(ctx,p->usercert)) {
- BIO_printf(p->errorbio, "SSL_CTX_use_certificate problem\n"); goto err;
- }
- if (!SSL_CTX_use_PrivateKey(ctx,p->pkey)) {
- BIO_printf(p->errorbio, "SSL_CTX_use_PrivateKey\n"); goto err;
- }
-
- if (!SSL_CTX_check_private_key(ctx)) {
- BIO_printf(p->errorbio, "SSL_CTX_check_private_key\n"); goto err;
- }
-
- SSL_CTX_set_quiet_shutdown(ctx,1);
- SSL_CTX_set_cipher_list(ctx,"RC4-MD5");
- SSL_CTX_set_mode(ctx, SSL_MODE_AUTO_RETRY);
-
- X509_STORE_add_cert(ctx->cert_store,sk_X509_value(p->ca,sk_X509_num(p->ca)-1));
-
- SSL_CTX_set_verify_depth(ctx,2);
-
- SSL_CTX_set_verify(ctx,SSL_VERIFY_PEER,NULL);
-
- SSL_CTX_set_cert_verify_callback(ctx, ssl_app_verify_callback, parm);
-
-
- return CURLE_OK ;
-err:
- ERR_print_errors(p->errorbio);
- return CURLE_SSL_CERTPROBLEM;
+
+ sslctxparm * p = (sslctxparm *) parm;
+ SSL_CTX * ctx = (SSL_CTX *) sslctx ;
+
+ if (!SSL_CTX_use_certificate(ctx,p->usercert)) {
+ BIO_printf(p->errorbio, "SSL_CTX_use_certificate problem\n"); goto err;
+ }
+ if (!SSL_CTX_use_PrivateKey(ctx,p->pkey)) {
+ BIO_printf(p->errorbio, "SSL_CTX_use_PrivateKey\n"); goto err;
+ }
+
+ if (!SSL_CTX_check_private_key(ctx)) {
+ BIO_printf(p->errorbio, "SSL_CTX_check_private_key\n"); goto err;
+ }
+
+ SSL_CTX_set_quiet_shutdown(ctx,1);
+ SSL_CTX_set_cipher_list(ctx,"RC4-MD5");
+ SSL_CTX_set_mode(ctx, SSL_MODE_AUTO_RETRY);
+
+ X509_STORE_add_cert(ctx->cert_store,sk_X509_value(p->ca,sk_X509_num(p->ca)-1));
+
+ SSL_CTX_set_verify_depth(ctx,2);
+
+ SSL_CTX_set_verify(ctx,SSL_VERIFY_PEER,NULL);
+
+ SSL_CTX_set_cert_verify_callback(ctx, ssl_app_verify_callback, parm);
+
+
+ return CURLE_OK ;
+err:
+ ERR_print_errors(p->errorbio);
+ return CURLE_SSL_CERTPROBLEM;
}
int main(int argc, char **argv) {
- BIO* in=NULL;
- BIO* out=NULL;
-
-
- char * outfile = NULL;
- char * infile = NULL ;
-
- int tabLength=100;
- char *binaryptr;
- char* mimetype;
- char* mimetypeaccept=NULL;
- char* contenttype;
- char** pp;
- unsigned char* hostporturl = NULL;
- binaryptr=(char*)malloc(tabLength);
- BIO * p12bio ;
- char **args = argv + 1;
- unsigned char * serverurl;
- sslctxparm p;
- char *response;
- p.verbose = 0;
-
- CURLcode res;
- struct curl_slist * headers=NULL;
-
- p.errorbio = BIO_new_fp (stderr, BIO_NOCLOSE);
-
- curl_global_init(CURL_GLOBAL_DEFAULT);
-
+ BIO* in=NULL;
+ BIO* out=NULL;
+
+
+ char * outfile = NULL;
+ char * infile = NULL ;
+
+ int tabLength=100;
+ char *binaryptr;
+ char* mimetype;
+ char* mimetypeaccept=NULL;
+ char* contenttype;
+ char** pp;
+ unsigned char* hostporturl = NULL;
+ binaryptr=(char*)malloc(tabLength);
+ BIO * p12bio ;
+ char **args = argv + 1;
+ unsigned char * serverurl;
+ sslctxparm p;
+ char *response;
+ p.verbose = 0;
+
+ CURLcode res;
+ struct curl_slist * headers=NULL;
+
+ p.errorbio = BIO_new_fp (stderr, BIO_NOCLOSE);
+
+ curl_global_init(CURL_GLOBAL_DEFAULT);
+
/* we need some more for the P12 decoding */
OpenSSL_add_all_ciphers();
- OpenSSL_add_all_digests();
- ERR_load_crypto_strings();
-
-
- int badarg=0;
-
- while (*args && *args[0] == '-') {
- if (!strcmp (*args, "-in")) {
- if (args[1]) {
- infile=*(++args);
- } else badarg=1;
- } else if (!strcmp (*args, "-out")) {
- if (args[1]) {
- outfile=*(++args);
- } else badarg=1;
- } else if (!strcmp (*args, "-p12")) {
- if (args[1]) {
- p.p12file = *(++args);
- } else badarg=1;
- } else if (strcmp(*args,"-envpass") == 0) {
- if (args[1]) {
- p.pst = getenv(*(++args));
- } else badarg=1;
- } else if (strcmp(*args,"-connect") == 0) {
- if (args[1]) {
- hostporturl = *(++args);
- } else badarg=1;
- } else if (strcmp(*args,"-mimetype") == 0) {
- if (args[1]) {
- mimetype = *(++args);
- } else badarg=1;
- } else if (strcmp(*args,"-acceptmime") == 0) {
- if (args[1]) {
- mimetypeaccept = *(++args);
- } else badarg=1;
- } else if (strcmp(*args,"-accesstype") == 0) {
- if (args[1]) {
- if ((p.accesstype = OBJ_obj2nid(OBJ_txt2obj(*++args,0))) == 0) badarg=1;
- } else badarg=1;
- } else if (strcmp(*args,"-verbose") == 0) {
- p.verbose++;
- } else badarg=1;
- args++;
- }
-
- if (mimetype==NULL || mimetypeaccept == NULL) badarg = 1;
-
- if (badarg) {
- for (pp=curlx_usage; (*pp != NULL); pp++)
- BIO_printf(p.errorbio,"%s\n",*pp);
- BIO_printf(p.errorbio,"\n");
- goto err;
- }
-
-
-
- /* set input */
-
- if ((in=BIO_new(BIO_s_file())) == NULL) {
- BIO_printf(p.errorbio, "Error setting input bio\n");
- goto err;
- } else if (infile == NULL)
- BIO_set_fp(in,stdin,BIO_NOCLOSE|BIO_FP_TEXT);
- else if (BIO_read_filename(in,infile) <= 0) {
- BIO_printf(p.errorbio, "Error opening input file %s\n", infile);
- BIO_free(in);
- goto err;
- }
-
- /* set output */
-
- if ((out=BIO_new(BIO_s_file())) == NULL) {
- BIO_printf(p.errorbio, "Error setting output bio.\n");
- goto err;
- } else if (outfile == NULL)
- BIO_set_fp(out,stdout,BIO_NOCLOSE|BIO_FP_TEXT);
- else if (BIO_write_filename(out,outfile) <= 0) {
- BIO_printf(p.errorbio, "Error opening output file %s\n", outfile);
- BIO_free(out);
- goto err;
- }
-
-
- p.errorbio = BIO_new_fp (stderr, BIO_NOCLOSE);
-
- if (!(p.curl = curl_easy_init())) {
- BIO_printf(p.errorbio, "Cannot init curl lib\n");
- goto err;
- }
+ OpenSSL_add_all_digests();
+ ERR_load_crypto_strings();
+
+
+ int badarg=0;
+
+ while (*args && *args[0] == '-') {
+ if (!strcmp (*args, "-in")) {
+ if (args[1]) {
+ infile=*(++args);
+ } else badarg=1;
+ } else if (!strcmp (*args, "-out")) {
+ if (args[1]) {
+ outfile=*(++args);
+ } else badarg=1;
+ } else if (!strcmp (*args, "-p12")) {
+ if (args[1]) {
+ p.p12file = *(++args);
+ } else badarg=1;
+ } else if (strcmp(*args,"-envpass") == 0) {
+ if (args[1]) {
+ p.pst = getenv(*(++args));
+ } else badarg=1;
+ } else if (strcmp(*args,"-connect") == 0) {
+ if (args[1]) {
+ hostporturl = *(++args);
+ } else badarg=1;
+ } else if (strcmp(*args,"-mimetype") == 0) {
+ if (args[1]) {
+ mimetype = *(++args);
+ } else badarg=1;
+ } else if (strcmp(*args,"-acceptmime") == 0) {
+ if (args[1]) {
+ mimetypeaccept = *(++args);
+ } else badarg=1;
+ } else if (strcmp(*args,"-accesstype") == 0) {
+ if (args[1]) {
+ if ((p.accesstype = OBJ_obj2nid(OBJ_txt2obj(*++args,0))) == 0) badarg=1;
+ } else badarg=1;
+ } else if (strcmp(*args,"-verbose") == 0) {
+ p.verbose++;
+ } else badarg=1;
+ args++;
+ }
+
+ if (mimetype==NULL || mimetypeaccept == NULL) badarg = 1;
+
+ if (badarg) {
+ for (pp=curlx_usage; (*pp != NULL); pp++)
+ BIO_printf(p.errorbio,"%s\n",*pp);
+ BIO_printf(p.errorbio,"\n");
+ goto err;
+ }
+
+
+
+ /* set input */
+
+ if ((in=BIO_new(BIO_s_file())) == NULL) {
+ BIO_printf(p.errorbio, "Error setting input bio\n");
+ goto err;
+ } else if (infile == NULL)
+ BIO_set_fp(in,stdin,BIO_NOCLOSE|BIO_FP_TEXT);
+ else if (BIO_read_filename(in,infile) <= 0) {
+ BIO_printf(p.errorbio, "Error opening input file %s\n", infile);
+ BIO_free(in);
+ goto err;
+ }
+
+ /* set output */
+
+ if ((out=BIO_new(BIO_s_file())) == NULL) {
+ BIO_printf(p.errorbio, "Error setting output bio.\n");
+ goto err;
+ } else if (outfile == NULL)
+ BIO_set_fp(out,stdout,BIO_NOCLOSE|BIO_FP_TEXT);
+ else if (BIO_write_filename(out,outfile) <= 0) {
+ BIO_printf(p.errorbio, "Error opening output file %s\n", outfile);
+ BIO_free(out);
+ goto err;
+ }
+
+
+ p.errorbio = BIO_new_fp (stderr, BIO_NOCLOSE);
+
+ if (!(p.curl = curl_easy_init())) {
+ BIO_printf(p.errorbio, "Cannot init curl lib\n");
+ goto err;
+ }
@@ -365,112 +365,112 @@ int main(int argc, char **argv) {
if (!(p.p12 = d2i_PKCS12_bio (p12bio, NULL))) {
BIO_printf(p.errorbio, "Cannot decode P12 structure %s\n", p.p12file); goto err;
}
-
- p.ca= NULL;
- if (!(PKCS12_parse (p.p12, p.pst, &(p.pkey), &(p.usercert), &(p.ca) ) )) {
+
+ p.ca= NULL;
+ if (!(PKCS12_parse (p.p12, p.pst, &(p.pkey), &(p.usercert), &(p.ca) ) )) {
BIO_printf(p.errorbio,"Invalid P12 structure in %s\n", p.p12file); goto err;
- }
+ }
- if (sk_X509_num(p.ca) <= 0) {
+ if (sk_X509_num(p.ca) <= 0) {
BIO_printf(p.errorbio,"No trustworthy CA given.%s\n", p.p12file); goto err;
- }
-
- if (p.verbose > 1) X509_print_ex(p.errorbio,p.usercert,0,0);
-
- /* determine URL to go */
-
- if (hostporturl) {
- serverurl=(char*) malloc(9+strlen(hostporturl));
- sprintf(serverurl,"https://%s",hostporturl);
- } else if (p.accesstype != 0) { /* see whether we can find an AIA or SIA for a given access type */
- if (!(serverurl = my_get_ext(p.usercert,p.accesstype,NID_info_access))) {
- BIO_printf(p.errorbio,"no service URL in user cert cherching in others certificats\n");
- int j=0;
- int find=0;
- for (j=0;j<sk_X509_num(p.ca);j++) {
- if ((serverurl = my_get_ext(sk_X509_value(p.ca,j),p.accesstype,NID_info_access))) break;
- if ((serverurl = my_get_ext(sk_X509_value(p.ca,j),p.accesstype,NID_sinfo_access))) break;
- }
- }
- }
-
- if (!serverurl) {
- BIO_printf(p.errorbio, "no service URL in certificats, check '-accesstype (AD_DVCS | ad_timestamping)' or use '-connect'\n"); goto err;
- }
-
- if (p.verbose) BIO_printf(p.errorbio, "Service URL: <%s>\n", serverurl);
- curl_easy_setopt(p.curl, CURLOPT_URL, serverurl);
-
- /* Now specify the POST binary data */
-
- curl_easy_setopt(p.curl, CURLOPT_POSTFIELDS, binaryptr);
- curl_easy_setopt(p.curl, CURLOPT_POSTFIELDSIZE,tabLength);
-
- /* pass our list of custom made headers */
-
- contenttype=(char*) malloc(15+strlen(mimetype));
- sprintf(contenttype,"Content-type: %s",mimetype);
- headers = curl_slist_append(headers,contenttype);
- curl_easy_setopt(p.curl, CURLOPT_HTTPHEADER, headers);
-
- if (p.verbose) BIO_printf(p.errorbio, "Service URL: <%s>\n", serverurl);
-
- {
- FILE *outfp;
- BIO_get_fp(out,&outfp);
- curl_easy_setopt(p.curl, CURLOPT_FILE,outfp);
- }
-
- res = curl_easy_setopt(p.curl, CURLOPT_SSL_CTX_FUNCTION, sslctxfun) ;
-
- if (res != CURLE_OK)
- BIO_printf(p.errorbio,"%d %s=%d %d\n", __LINE__, "CURLOPT_SSL_CTX_FUNCTION",CURLOPT_SSL_CTX_FUNCTION,res);
-
- curl_easy_setopt(p.curl, CURLOPT_SSL_CTX_DATA, &p);
-
- {
- int lu; int i=0;
- while ((lu = BIO_read (in,&binaryptr[i],tabLength-i)) >0 ) {
- i+=lu;
- if (i== tabLength) {
- tabLength+=100;
- binaryptr=(char*)realloc(binaryptr,tabLength); /* should be more careful */
- }
- }
- tabLength = i;
- }
- /* Now specify the POST binary data */
-
- curl_easy_setopt(p.curl, CURLOPT_POSTFIELDS, binaryptr);
- curl_easy_setopt(p.curl, CURLOPT_POSTFIELDSIZE,tabLength);
-
-
+ }
+
+ if (p.verbose > 1) X509_print_ex(p.errorbio,p.usercert,0,0);
+
+ /* determine URL to go */
+
+ if (hostporturl) {
+ serverurl=(char*) malloc(9+strlen(hostporturl));
+ sprintf(serverurl,"https://%s",hostporturl);
+ } else if (p.accesstype != 0) { /* see whether we can find an AIA or SIA for a given access type */
+ if (!(serverurl = my_get_ext(p.usercert,p.accesstype,NID_info_access))) {
+ BIO_printf(p.errorbio,"no service URL in user cert cherching in others certificats\n");
+ int j=0;
+ int find=0;
+ for (j=0;j<sk_X509_num(p.ca);j++) {
+ if ((serverurl = my_get_ext(sk_X509_value(p.ca,j),p.accesstype,NID_info_access))) break;
+ if ((serverurl = my_get_ext(sk_X509_value(p.ca,j),p.accesstype,NID_sinfo_access))) break;
+ }
+ }
+ }
+
+ if (!serverurl) {
+ BIO_printf(p.errorbio, "no service URL in certificats, check '-accesstype (AD_DVCS | ad_timestamping)' or use '-connect'\n"); goto err;
+ }
+
+ if (p.verbose) BIO_printf(p.errorbio, "Service URL: <%s>\n", serverurl);
+ curl_easy_setopt(p.curl, CURLOPT_URL, serverurl);
+
+ /* Now specify the POST binary data */
+
+ curl_easy_setopt(p.curl, CURLOPT_POSTFIELDS, binaryptr);
+ curl_easy_setopt(p.curl, CURLOPT_POSTFIELDSIZE,tabLength);
+
+ /* pass our list of custom made headers */
+
+ contenttype=(char*) malloc(15+strlen(mimetype));
+ sprintf(contenttype,"Content-type: %s",mimetype);
+ headers = curl_slist_append(headers,contenttype);
+ curl_easy_setopt(p.curl, CURLOPT_HTTPHEADER, headers);
+
+ if (p.verbose) BIO_printf(p.errorbio, "Service URL: <%s>\n", serverurl);
+
+ {
+ FILE *outfp;
+ BIO_get_fp(out,&outfp);
+ curl_easy_setopt(p.curl, CURLOPT_FILE,outfp);
+ }
+
+ res = curl_easy_setopt(p.curl, CURLOPT_SSL_CTX_FUNCTION, sslctxfun) ;
+
+ if (res != CURLE_OK)
+ BIO_printf(p.errorbio,"%d %s=%d %d\n", __LINE__, "CURLOPT_SSL_CTX_FUNCTION",CURLOPT_SSL_CTX_FUNCTION,res);
+
+ curl_easy_setopt(p.curl, CURLOPT_SSL_CTX_DATA, &p);
+
+ {
+ int lu; int i=0;
+ while ((lu = BIO_read (in,&binaryptr[i],tabLength-i)) >0 ) {
+ i+=lu;
+ if (i== tabLength) {
+ tabLength+=100;
+ binaryptr=(char*)realloc(binaryptr,tabLength); /* should be more careful */
+ }
+ }
+ tabLength = i;
+ }
+ /* Now specify the POST binary data */
+
+ curl_easy_setopt(p.curl, CURLOPT_POSTFIELDS, binaryptr);
+ curl_easy_setopt(p.curl, CURLOPT_POSTFIELDSIZE,tabLength);
+
+
/* Perform the request, res will get the return code */
- BIO_printf(p.errorbio,"%d %s %d\n", __LINE__, "curl_easy_perform", res = curl_easy_perform(p.curl));
+ BIO_printf(p.errorbio,"%d %s %d\n", __LINE__, "curl_easy_perform", res = curl_easy_perform(p.curl));
{
- int result =curl_easy_getinfo(p.curl,CURLINFO_CONTENT_TYPE,&response);
- if( mimetypeaccept && p.verbose)
- if(!strcmp(mimetypeaccept,response))
- BIO_printf(p.errorbio,"the response has a correct mimetype : %s\n",response);
- else
- BIO_printf(p.errorbio,"the reponse doesn\'t has an acceptable mime type, it is %s instead of %s\n",response,mimetypeaccept);
- }
+ int result =curl_easy_getinfo(p.curl,CURLINFO_CONTENT_TYPE,&response);
+ if( mimetypeaccept && p.verbose)
+ if(!strcmp(mimetypeaccept,response))
+ BIO_printf(p.errorbio,"the response has a correct mimetype : %s\n",response);
+ else
+ BIO_printf(p.errorbio,"the reponse doesn\'t has an acceptable mime type, it is %s instead of %s\n",response,mimetypeaccept);
+ }
- /*** code d'erreur si accept mime ***, egalement code return HTTP != 200 ***/
+ /*** code d'erreur si accept mime ***, egalement code return HTTP != 200 ***/
/* free the header list*/
curl_slist_free_all(headers);
-
+
/* always cleanup */
curl_easy_cleanup(p.curl);
-
+
BIO_free(in);
BIO_free(out);
return (EXIT_SUCCESS);
-
-
+
+
err: BIO_printf(p.errorbio,"error");
exit(1);
}
diff --git a/docs/examples/fopen.c b/docs/examples/fopen.c
index eb5501628..88729e72d 100644
--- a/docs/examples/fopen.c
+++ b/docs/examples/fopen.c
@@ -55,16 +55,16 @@ enum fcurl_type_e { CFTYPE_NONE=0, CFTYPE_FILE=1, CFTYPE_CURL=2 };
struct fcurl_data
{
- enum fcurl_type_e type; /* type of handle */
+ enum fcurl_type_e type; /* type of handle */
union {
- CURL *curl;
- FILE *file;
- } handle; /* handle */
-
- char *buffer; /* buffer to store cached data*/
- int buffer_len; /* currently allocated buffers length */
- int buffer_pos; /* end of data in buffer*/
- int still_running; /* Is background url fetch still in progress */
+ CURL *curl;
+ FILE *file;
+ } handle; /* handle */
+
+ char *buffer; /* buffer to store cached data*/
+ int buffer_len; /* currently allocated buffers length */
+ int buffer_pos; /* end of data in buffer*/
+ int still_running; /* Is background url fetch still in progress */
};
typedef struct fcurl_data URL_FILE;
@@ -83,9 +83,9 @@ CURLM *multi_handle;
/* curl calls this routine to get more data */
static size_t
write_callback(char *buffer,
- size_t size,
- size_t nitems,
- void *userp)
+ size_t size,
+ size_t nitems,
+ void *userp)
{
char *newbuff;
int rembuff;
@@ -97,21 +97,21 @@ write_callback(char *buffer,
if(size > rembuff)
{
- //not enuf space in buffer
- newbuff=realloc(url->buffer,url->buffer_len + (size - rembuff));
- if(newbuff==NULL)
- {
- fprintf(stderr,"callback buffer grow failed\n");
- size=rembuff;
- }
- else
- {
- /* realloc suceeded increase buffer size*/
- url->buffer_len+=size - rembuff;
- url->buffer=newbuff;
-
- /*printf("Callback buffer grown to %d bytes\n",url->buffer_len);*/
- }
+ //not enuf space in buffer
+ newbuff=realloc(url->buffer,url->buffer_len + (size - rembuff));
+ if(newbuff==NULL)
+ {
+ fprintf(stderr,"callback buffer grow failed\n");
+ size=rembuff;
+ }
+ else
+ {
+ /* realloc suceeded increase buffer size*/
+ url->buffer_len+=size - rembuff;
+ url->buffer=newbuff;
+
+ /*printf("Callback buffer grown to %d bytes\n",url->buffer_len);*/
+ }
}
memcpy(&url->buffer[url->buffer_pos], buffer, size);
@@ -137,42 +137,42 @@ curl_fill_buffer(URL_FILE *file,int want,int waittime)
* doesnt exceed required size already
*/
if((!file->still_running) || (file->buffer_pos > want))
- return 0;
+ return 0;
/* attempt to fill buffer */
do
{
- FD_ZERO(&fdread);
- FD_ZERO(&fdwrite);
- FD_ZERO(&fdexcep);
+ FD_ZERO(&fdread);
+ FD_ZERO(&fdwrite);
+ FD_ZERO(&fdexcep);
- /* set a suitable timeout to fail on */
- timeout.tv_sec = 60; /* 1 minute */
- timeout.tv_usec = 0;
+ /* set a suitable timeout to fail on */
+ timeout.tv_sec = 60; /* 1 minute */
+ timeout.tv_usec = 0;
- /* get file descriptors from the transfers */
- curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
+ /* get file descriptors from the transfers */
+ curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
- rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
+ rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
- switch(rc) {
- case -1:
- /* select error */
- break;
+ switch(rc) {
+ case -1:
+ /* select error */
+ break;
- case 0:
- break;
+ case 0:
+ break;
- default:
- /* timeout or readable/writable sockets */
- /* note we *could* be more efficient and not wait for
- * CURLM_CALL_MULTI_PERFORM to clear here and check it on re-entry
- * but that gets messy */
- while(curl_multi_perform(multi_handle, &file->still_running) ==
- CURLM_CALL_MULTI_PERFORM);
+ default:
+ /* timeout or readable/writable sockets */
+ /* note we *could* be more efficient and not wait for
+ * CURLM_CALL_MULTI_PERFORM to clear here and check it on re-entry
+ * but that gets messy */
+ while(curl_multi_perform(multi_handle, &file->still_running) ==
+ CURLM_CALL_MULTI_PERFORM);
- break;
- }
+ break;
+ }
} while(file->still_running && (file->buffer_pos < want));
return 1;
}
@@ -184,22 +184,22 @@ curl_use_buffer(URL_FILE *file,int want)
/* sort out buffer */
if((file->buffer_pos - want) <=0)
{
- /* ditch buffer - write will recreate */
- if(file->buffer)
- free(file->buffer);
+ /* ditch buffer - write will recreate */
+ if(file->buffer)
+ free(file->buffer);
- file->buffer=NULL;
- file->buffer_pos=0;
- file->buffer_len=0;
+ file->buffer=NULL;
+ file->buffer_pos=0;
+ file->buffer_len=0;
}
else
{
- /* move rest down make it available for later */
- memmove(file->buffer,
- &file->buffer[want],
- (file->buffer_pos - want));
+ /* move rest down make it available for later */
+ memmove(file->buffer,
+ &file->buffer[want],
+ (file->buffer_pos - want));
- file->buffer_pos -= want;
+ file->buffer_pos -= want;
}
return 0;
}
@@ -217,47 +217,47 @@ url_fopen(char *url,const char *operation)
file = (URL_FILE *)malloc(sizeof(URL_FILE));
if(!file)
- return NULL;
+ return NULL;
memset(file, 0, sizeof(URL_FILE));
if((file->handle.file=fopen(url,operation)))
{
- file->type = CFTYPE_FILE; /* marked as URL */
+ file->type = CFTYPE_FILE; /* marked as URL */
}
else
{
- file->type = CFTYPE_CURL; /* marked as URL */
- file->handle.curl = curl_easy_init();
+ file->type = CFTYPE_CURL; /* marked as URL */
+ file->handle.curl = curl_easy_init();
- curl_easy_setopt(file->handle.curl, CURLOPT_URL, url);
- curl_easy_setopt(file->handle.curl, CURLOPT_WRITEDATA, file);
- curl_easy_setopt(file->handle.curl, CURLOPT_VERBOSE, FALSE);
- curl_easy_setopt(file->handle.curl, CURLOPT_WRITEFUNCTION, write_callback);
+ curl_easy_setopt(file->handle.curl, CURLOPT_URL, url);
+ curl_easy_setopt(file->handle.curl, CURLOPT_WRITEDATA, file);
+ curl_easy_setopt(file->handle.curl, CURLOPT_VERBOSE, FALSE);
+ curl_easy_setopt(file->handle.curl, CURLOPT_WRITEFUNCTION, write_callback);
- if(!multi_handle)
- multi_handle = curl_multi_init();
+ if(!multi_handle)
+ multi_handle = curl_multi_init();
- curl_multi_add_handle(multi_handle, file->handle.curl);
+ curl_multi_add_handle(multi_handle, file->handle.curl);
- /* lets start the fetch */
- while(curl_multi_perform(multi_handle, &file->still_running) ==
- CURLM_CALL_MULTI_PERFORM );
+ /* lets start the fetch */
+ while(curl_multi_perform(multi_handle, &file->still_running) ==
+ CURLM_CALL_MULTI_PERFORM );
- if((file->buffer_pos == 0) && (!file->still_running))
- {
- /* if still_running is 0 now, we should return NULL */
+ if((file->buffer_pos == 0) && (!file->still_running))
+ {
+ /* if still_running is 0 now, we should return NULL */
- /* make sure the easy handle is not in the multi handle anymore */
- curl_multi_remove_handle(multi_handle, file->handle.curl);
+ /* make sure the easy handle is not in the multi handle anymore */
+ curl_multi_remove_handle(multi_handle, file->handle.curl);
- /* cleanup */
- curl_easy_cleanup(file->handle.curl);
+ /* cleanup */
+ curl_easy_cleanup(file->handle.curl);
- free(file);
+ free(file);
- file = NULL;
- }
+ file = NULL;
+ }
}
return file;
}
@@ -270,26 +270,26 @@ url_fclose(URL_FILE *file)
switch(file->type)
{
case CFTYPE_FILE:
- ret=fclose(file->handle.file); /* passthrough */
- break;
+ ret=fclose(file->handle.file); /* passthrough */
+ break;
case CFTYPE_CURL:
- /* make sure the easy handle is not in the multi handle anymore */
- curl_multi_remove_handle(multi_handle, file->handle.curl);
+ /* make sure the easy handle is not in the multi handle anymore */
+ curl_multi_remove_handle(multi_handle, file->handle.curl);
- /* cleanup */
- curl_easy_cleanup(file->handle.curl);
- break;
+ /* cleanup */
+ curl_easy_cleanup(file->handle.curl);
+ break;
default: /* unknown or supported type - oh dear */
- ret=EOF;
- errno=EBADF;
- break;
+ ret=EOF;
+ errno=EBADF;
+ break;
}
if(file->buffer)
- free(file->buffer);/* free any allocated buffer space */
+ free(file->buffer);/* free any allocated buffer space */
free(file);
@@ -304,17 +304,17 @@ url_feof(URL_FILE *file)
switch(file->type)
{
case CFTYPE_FILE:
- ret=feof(file->handle.file);
- break;
+ ret=feof(file->handle.file);
+ break;
case CFTYPE_CURL:
- if((file->buffer_pos == 0) && (!file->still_running))
- ret = 1;
- break;
+ if((file->buffer_pos == 0) && (!file->still_running))
+ ret = 1;
+ break;
default: /* unknown or supported type - oh dear */
- ret=-1;
- errno=EBADF;
- break;
+ ret=-1;
+ errno=EBADF;
+ break;
}
return ret;
}
@@ -327,38 +327,38 @@ url_fread(void *ptr, size_t size, size_t nmemb, URL_FILE *file)
switch(file->type)
{
case CFTYPE_FILE:
- want=fread(ptr,size,nmemb,file->handle.file);
- break;
+ want=fread(ptr,size,nmemb,file->handle.file);
+ break;
case CFTYPE_CURL:
- want = nmemb * size;
+ want = nmemb * size;
- curl_fill_buffer(file,want,1);
+ curl_fill_buffer(file,want,1);
- /* check if theres data in the buffer - if not curl_fill_buffer()
- * either errored or EOF */
- if(!file->buffer_pos)
- return 0;
+ /* check if theres data in the buffer - if not curl_fill_buffer()
+ * either errored or EOF */
+ if(!file->buffer_pos)
+ return 0;
- /* ensure only available data is considered */
- if(file->buffer_pos < want)
- want = file->buffer_pos;
+ /* ensure only available data is considered */
+ if(file->buffer_pos < want)
+ want = file->buffer_pos;
- /* xfer data to caller */
- memcpy(ptr, file->buffer, want);
+ /* xfer data to caller */
+ memcpy(ptr, file->buffer, want);
- curl_use_buffer(file,want);
+ curl_use_buffer(file,want);
- want = want / size; /* number of items - nb correct op - checked
- * with glibc code*/
+ want = want / size; /* number of items - nb correct op - checked
+ * with glibc code*/
- /*printf("(fread) return %d bytes %d left\n", want,file->buffer_pos);*/
- break;
+ /*printf("(fread) return %d bytes %d left\n", want,file->buffer_pos);*/
+ break;
default: /* unknown or supported type - oh dear */
- want=0;
- errno=EBADF;
- break;
+ want=0;
+ errno=EBADF;
+ break;
}
return want;
@@ -373,45 +373,45 @@ url_fgets(char *ptr, int size, URL_FILE *file)
switch(file->type)
{
case CFTYPE_FILE:
- ptr = fgets(ptr,size,file->handle.file);
- break;
+ ptr = fgets(ptr,size,file->handle.file);
+ break;
case CFTYPE_CURL:
- curl_fill_buffer(file,want,1);
+ curl_fill_buffer(file,want,1);
- /* check if theres data in the buffer - if not fill either errored or
- * EOF */
- if(!file->buffer_pos)
- return NULL;
+ /* check if theres data in the buffer - if not fill either errored or
+ * EOF */
+ if(!file->buffer_pos)
+ return NULL;
- /* ensure only available data is considered */
- if(file->buffer_pos < want)
- want = file->buffer_pos;
+ /* ensure only available data is considered */
+ if(file->buffer_pos < want)
+ want = file->buffer_pos;
- /*buffer contains data */
- /* look for newline or eof */
- for(loop=0;loop < want;loop++)
- {
- if(file->buffer[loop] == '\n')
- {
- want=loop+1;/* include newline */
- break;
- }
- }
+ /*buffer contains data */
+ /* look for newline or eof */
+ for(loop=0;loop < want;loop++)
+ {
+ if(file->buffer[loop] == '\n')
+ {
+ want=loop+1;/* include newline */
+ break;
+ }
+ }
- /* xfer data to caller */
- memcpy(ptr, file->buffer, want);
- ptr[want]=0;/* allways null terminate */
+ /* xfer data to caller */
+ memcpy(ptr, file->buffer, want);
+ ptr[want]=0;/* allways null terminate */
- curl_use_buffer(file,want);
+ curl_use_buffer(file,want);
- /*printf("(fgets) return %d bytes %d left\n", want,file->buffer_pos);*/
- break;
+ /*printf("(fgets) return %d bytes %d left\n", want,file->buffer_pos);*/
+ break;
default: /* unknown or supported type - oh dear */
- ptr=NULL;
- errno=EBADF;
- break;
+ ptr=NULL;
+ errno=EBADF;
+ break;
}
return ptr;/*success */
@@ -423,28 +423,28 @@ url_rewind(URL_FILE *file)
switch(file->type)
{
case CFTYPE_FILE:
- rewind(file->handle.file); /* passthrough */
- break;
+ rewind(file->handle.file); /* passthrough */
+ break;
case CFTYPE_CURL:
- /* halt transaction */
- curl_multi_remove_handle(multi_handle, file->handle.curl);
+ /* halt transaction */
+ curl_multi_remove_handle(multi_handle, file->handle.curl);
- /* restart */
- curl_multi_add_handle(multi_handle, file->handle.curl);
+ /* restart */
+ curl_multi_add_handle(multi_handle, file->handle.curl);
- /* ditch buffer - write will recreate - resets stream pos*/
- if(file->buffer)
- free(file->buffer);
+ /* ditch buffer - write will recreate - resets stream pos*/
+ if(file->buffer)
+ free(file->buffer);
- file->buffer=NULL;
- file->buffer_pos=0;
- file->buffer_len=0;
+ file->buffer=NULL;
+ file->buffer_pos=0;
+ file->buffer_len=0;
- break;
+ break;
default: /* unknown or supported type - oh dear */
- break;
+ break;
}
@@ -466,33 +466,33 @@ main(int argc, char *argv[])
if(argc < 2)
{
- url="http://192.168.7.3/testfile";/* default to testurl */
+ url="http://192.168.7.3/testfile";/* default to testurl */
}
else
{
- url=argv[1];/* use passed url */
+ url=argv[1];/* use passed url */
}
/* copy from url line by line with fgets */
outf=fopen("fgets.test","w+");
if(!outf)
{
- perror("couldnt open fgets output file\n");
- return 1;
+ perror("couldnt open fgets output file\n");
+ return 1;
}
handle = url_fopen(url, "r");
if(!handle)
{
- printf("couldn't url_fopen()\n");
- fclose(outf);
- return 2;
+ printf("couldn't url_fopen()\n");
+ fclose(outf);
+ return 2;
}
while(!url_feof(handle))
{
- url_fgets(buffer,sizeof(buffer),handle);
- fwrite(buffer,1,strlen(buffer),outf);
+ url_fgets(buffer,sizeof(buffer),handle);
+ fwrite(buffer,1,strlen(buffer),outf);
}
url_fclose(handle);
@@ -504,20 +504,20 @@ main(int argc, char *argv[])
outf=fopen("fread.test","w+");
if(!outf)
{
- perror("couldnt open fread output file\n");
- return 1;
+ perror("couldnt open fread output file\n");
+ return 1;
}
handle = url_fopen("testfile", "r");
if(!handle) {
- printf("couldn't url_fopen()\n");
- fclose(outf);
- return 2;
+ printf("couldn't url_fopen()\n");
+ fclose(outf);
+ return 2;
}
do {
- nread = url_fread(buffer, 1,sizeof(buffer), handle);
- fwrite(buffer,1,nread,outf);
+ nread = url_fread(buffer, 1,sizeof(buffer), handle);
+ fwrite(buffer,1,nread,outf);
} while(nread);
url_fclose(handle);
@@ -529,26 +529,26 @@ main(int argc, char *argv[])
outf=fopen("rewind.test","w+");
if(!outf)
{
- perror("couldnt open fread output file\n");
- return 1;
+ perror("couldnt open fread output file\n");
+ return 1;
}
handle = url_fopen("testfile", "r");
if(!handle) {
- printf("couldn't url_fopen()\n");
- fclose(outf);
- return 2;
+ printf("couldn't url_fopen()\n");
+ fclose(outf);
+ return 2;
}
- nread = url_fread(buffer, 1,sizeof(buffer), handle);
- fwrite(buffer,1,nread,outf);
- url_rewind(handle);
+ nread = url_fread(buffer, 1,sizeof(buffer), handle);
+ fwrite(buffer,1,nread,outf);
+ url_rewind(handle);
- buffer[0]='\n';
- fwrite(buffer,1,1,outf);
+ buffer[0]='\n';
+ fwrite(buffer,1,1,outf);
- nread = url_fread(buffer, 1,sizeof(buffer), handle);
- fwrite(buffer,1,nread,outf);
+ nread = url_fread(buffer, 1,sizeof(buffer), handle);
+ fwrite(buffer,1,nread,outf);
url_fclose(handle);
diff --git a/docs/examples/multi-app.c b/docs/examples/multi-app.c
index 9e3d72703..ecb7e3814 100644
--- a/docs/examples/multi-app.c
+++ b/docs/examples/multi-app.c
@@ -1,8 +1,8 @@
/*****************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* $Id$
@@ -24,9 +24,9 @@
* Download a HTTP file and upload an FTP file simultaneously.
*/
-#define HANDLECOUNT 2 /* Number of simultaneous transfers */
-#define HTTP_HANDLE 0 /* Index for the HTTP transfer */
-#define FTP_HANDLE 1 /* Index for the FTP transfer */
+#define HANDLECOUNT 2 /* Number of simultaneous transfers */
+#define HTTP_HANDLE 0 /* Index for the HTTP transfer */
+#define FTP_HANDLE 1 /* Index for the FTP transfer */
int main(int argc, char **argv)
{
@@ -111,11 +111,11 @@ int main(int argc, char **argv)
switch (idx) {
case HTTP_HANDLE:
- printf("HTTP transfer completed with status %d\n", msg->data.result);
- break;
- case FTP_HANDLE:
- printf("FTP transfer completed with status %d\n", msg->data.result);
- break;
+ printf("HTTP transfer completed with status %d\n", msg->data.result);
+ break;
+ case FTP_HANDLE:
+ printf("FTP transfer completed with status %d\n", msg->data.result);
+ break;
}
}
}
diff --git a/include/curl/curl.h b/include/curl/curl.h
index f6df95394..210d0631c 100644
--- a/include/curl/curl.h
+++ b/include/curl/curl.h
@@ -246,7 +246,7 @@ typedef enum {
CURLE_TOO_MANY_REDIRECTS , /* 47 - catch endless re-direct loops */
CURLE_UNKNOWN_TELNET_OPTION, /* 48 - User specified an unknown option */
CURLE_TELNET_OPTION_SYNTAX , /* 49 - Malformed telnet option */
- CURLE_OBSOLETE, /* 50 - NOT USED */
+ CURLE_OBSOLETE, /* 50 - NOT USED */
CURLE_SSL_PEER_CERTIFICATE, /* 51 - peer's certificate wasn't ok */
CURLE_GOT_NOTHING, /* 52 - when this is a specific error */
CURLE_SSL_ENGINE_NOTFOUND, /* 53 - SSL crypto engine not found */
@@ -1178,7 +1178,7 @@ typedef enum {
CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG + 22,
CURLINFO_HTTPAUTH_AVAIL = CURLINFO_LONG + 23,
CURLINFO_PROXYAUTH_AVAIL = CURLINFO_LONG + 24,
- CURLINFO_OS_ERRNO = CURLINFO_LONG + 25,
+ CURLINFO_OS_ERRNO = CURLINFO_LONG + 25,
/* Fill in new entries below here! */
CURLINFO_LASTONE = 26
diff --git a/lib/amigaos.c b/lib/amigaos.c
index d81384618..13336ce05 100644
--- a/lib/amigaos.c
+++ b/lib/amigaos.c
@@ -30,7 +30,7 @@ void amiga_cleanup()
{
if(SocketBase)
CloseLibrary(SocketBase);
-
+
SocketBase = NULL;
}
@@ -38,12 +38,12 @@ BOOL amiga_init()
{
if(!SocketBase)
SocketBase = OpenLibrary("bsdsocket.library", 4);
-
+
if(!SocketBase) {
fprintf(stderr, "No TCP/IP Stack running!\n\a");
return FALSE;
}
-
+
atexit(amiga_cleanup);
return TRUE;
}
diff --git a/lib/amigaos.h b/lib/amigaos.h
index f8529c46e..0196eece7 100644
--- a/lib/amigaos.h
+++ b/lib/amigaos.h
@@ -36,10 +36,10 @@
#include "config-amigaos.h"
-#define select(args...) WaitSelect( args, NULL)
-#define inet_ntoa(x) Inet_NtoA( x ## .s_addr)
-#define ioctl(a,b,c,d) IoctlSocket( (LONG)a, (ULONG)b, (char*)c)
-#define _AMIGASF 1
+#define select(args...) WaitSelect( args, NULL)
+#define inet_ntoa(x) Inet_NtoA( x ## .s_addr)
+#define ioctl(a,b,c,d) IoctlSocket( (LONG)a, (ULONG)b, (char*)c)
+#define _AMIGASF 1
extern void amiga_cleanup();
extern BOOL amiga_init();
diff --git a/lib/config-mac.h b/lib/config-mac.h
index 2328ada13..8b0b0337c 100644
--- a/lib/config-mac.h
+++ b/lib/config-mac.h
@@ -1,45 +1,45 @@
#define OS "mac"
-#define HAVE_NETINET_IN_H 1
-#define HAVE_SYS_SOCKET_H 1
-#define HAVE_SYS_SELECT_H 1
-#define HAVE_NETDB_H 1
-#define HAVE_ARPA_INET_H 1
-#define HAVE_UNISTD_H 1
-#define HAVE_NET_IF_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_GETTIMEOFDAY 1
-#define HAVE_FCNTL_H 1
-#define HAVE_SYS_STAT_H 1
-#define HAVE_ALLOCA_H 1
-#define HAVE_TIME_H 1
-#define HAVE_STDLIB_H 1
-#define HAVE_UTIME_H 1
-
-#define TIME_WITH_SYS_TIME 1
-
-#define HAVE_STRDUP 1
-#define HAVE_UTIME 1
-#define HAVE_INET_NTOA 1
-#define HAVE_SETVBUF 1
-#define HAVE_STRFTIME 1
-#define HAVE_INET_ADDR 1
-#define HAVE_MEMCPY 1
-#define HAVE_SELECT 1
-#define HAVE_SOCKET 1
-
-//#define HAVE_STRICMP 1
-#define HAVE_SIGACTION 1
+#define HAVE_NETINET_IN_H 1
+#define HAVE_SYS_SOCKET_H 1
+#define HAVE_SYS_SELECT_H 1
+#define HAVE_NETDB_H 1
+#define HAVE_ARPA_INET_H 1
+#define HAVE_UNISTD_H 1
+#define HAVE_NET_IF_H 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_GETTIMEOFDAY 1
+#define HAVE_FCNTL_H 1
+#define HAVE_SYS_STAT_H 1
+#define HAVE_ALLOCA_H 1
+#define HAVE_TIME_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_UTIME_H 1
+
+#define TIME_WITH_SYS_TIME 1
+
+#define HAVE_STRDUP 1
+#define HAVE_UTIME 1
+#define HAVE_INET_NTOA 1
+#define HAVE_SETVBUF 1
+#define HAVE_STRFTIME 1
+#define HAVE_INET_ADDR 1
+#define HAVE_MEMCPY 1
+#define HAVE_SELECT 1
+#define HAVE_SOCKET 1
+
+//#define HAVE_STRICMP 1
+#define HAVE_SIGACTION 1
#ifdef MACOS_SSL_SUPPORT
-# define USE_SSLEAY 1
-# define USE_OPENSSL 1
+# define USE_SSLEAY 1
+# define USE_OPENSSL 1
#endif
-#define HAVE_RAND_STATUS 1
-#define HAVE_RAND_EGD 1
+#define HAVE_RAND_STATUS 1
+#define HAVE_RAND_EGD 1
-#define HAVE_FIONBIO 1
+#define HAVE_FIONBIO 1
#include <extra/stricmp.h>
#include <extra/strdup.h>
diff --git a/lib/config-vms.h b/lib/config-vms.h
index d29303fd2..83751073d 100755
--- a/lib/config-vms.h
+++ b/lib/config-vms.h
@@ -1,5 +1,3 @@
-/* config.h.in. Generated automatically from configure.in by autoheader. */
-
/* Define if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
@@ -224,19 +222,19 @@
#define HAVE_OPENSSL_CRYPTO_H 1
/* Define if you have the <openssl/err.h> header file. */
-#define HAVE_OPENSSL_ERR_H 1
+#define HAVE_OPENSSL_ERR_H 1
/* Define if you have the <openssl/pem.h> header file. */
-#define HAVE_OPENSSL_PEM_H 1
+#define HAVE_OPENSSL_PEM_H 1
/* Define if you have the <openssl/rsa.h> header file. */
#define HAVE_OPENSSL_RSA_H 1
/* Define if you have the <openssl/ssl.h> header file. */
-#define HAVE_OPENSSL_SSL_H 1
+#define HAVE_OPENSSL_SSL_H 1
/* Define if you have the <openssl/x509.h> header file. */
-#define HAVE_OPENSSL_X509_H 1
+#define HAVE_OPENSSL_X509_H 1
/* Define if you have the <pem.h> header file. */
#undef HAVE_PEM_H
@@ -314,7 +312,7 @@
#define HAVE_LIBSOCKET 1
/* Define if you have the ssl library (-lssl). */
-#define HAVE_LIBSSL 1
+#define HAVE_LIBSSL 1
/* Define if you have the ucb library (-lucb). */
#undef HAVE_LIBUCB
@@ -334,7 +332,7 @@
/* Set to explicitly specify we don't want to use thread-safe functions */
#undef DISABLED_THREADSAFE
-#define HAVE_TIMEVAL_H 1
+#define HAVE_TIMEVAL_H 1
/* Name of this package! */
#define PACKAGE "not-used"
@@ -346,7 +344,7 @@
#undef HAVE_GETPASS
/* Define if you have a working OpenSSL installation */
-#define OPENSSL_ENABLED 1
+#define OPENSSL_ENABLED 1
/* Define if you have the `dlopen' function. */
#undef HAVE_DLOPEN
@@ -368,7 +366,7 @@
#define HAVE_MEMORY_H 1
-#define HAVE_FIONBIO 1
+#define HAVE_FIONBIO 1
/* Define if you have the `sigsetjmp' function. */
#define HAVE_SIGSETJMP 1
diff --git a/lib/connect.c b/lib/connect.c
index 5e8c047bc..3ff73636d 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -67,7 +67,7 @@
#undef in_addr_t
#define in_addr_t unsigned long
#endif
-#ifdef VMS
+#ifdef VMS
#include <in.h>
#include <inet.h>
#endif
@@ -362,8 +362,8 @@ static CURLcode bindlocal(struct connectdata *conn,
} /* end of if h */
else {
- failf(data,"could't find my own IP address (%s)", myhost);
- return CURLE_HTTP_PORT_FAILED;
+ failf(data,"could't find my own IP address (%s)", myhost);
+ return CURLE_HTTP_PORT_FAILED;
}
} /* end of inet_addr */
diff --git a/lib/cookie.c b/lib/cookie.c
index 47ed95254..528d88f65 100644
--- a/lib/cookie.c
+++ b/lib/cookie.c
@@ -29,20 +29,20 @@ RECEIVING COOKIE INFORMATION
struct CookieInfo *cookie_init(char *file);
- Inits a cookie struct to store data in a local file. This is always
- called before any cookies are set.
+ Inits a cookie struct to store data in a local file. This is always
+ called before any cookies are set.
int cookies_set(struct CookieInfo *cookie, char *cookie_line);
- The 'cookie_line' parameter is a full "Set-cookie:" line as
- received from a server.
+ The 'cookie_line' parameter is a full "Set-cookie:" line as
+ received from a server.
- The function need to replace previously stored lines that this new
- line superceeds.
+ The function need to replace previously stored lines that this new
+ line superceeds.
- It may remove lines that are expired.
+ It may remove lines that are expired.
- It should return an indication of success/error.
+ It should return an indication of success/error.
SENDING COOKIE INFORMATION
@@ -51,12 +51,12 @@ SENDING COOKIE INFORMATION
struct Cookies *cookie_getlist(struct CookieInfo *cookie,
char *host, char *path, bool secure);
- For a given host and path, return a linked list of cookies that
- the client should send to the server if used now. The secure
- boolean informs the cookie if a secure connection is achieved or
- not.
+ For a given host and path, return a linked list of cookies that
+ the client should send to the server if used now. The secure
+ boolean informs the cookie if a secure connection is achieved or
+ not.
- It shall only return cookies that haven't expired.
+ It shall only return cookies that haven't expired.
Example set of cookies:
@@ -775,10 +775,10 @@ void Curl_cookie_freelist(struct Cookie *co)
struct Cookie *next;
if(co) {
while(co) {
- next = co->next;
- free(co); /* we only free the struct since the "members" are all
- just copied! */
- co = next;
+ next = co->next;
+ free(co); /* we only free the struct since the "members" are all
+ just copied! */
+ co = next;
}
}
}
@@ -796,13 +796,13 @@ void Curl_cookie_cleanup(struct CookieInfo *c)
struct Cookie *next;
if(c) {
if(c->filename)
- free(c->filename);
+ free(c->filename);
co = c->cookies;
while(co) {
- next = co->next;
+ next = co->next;
freecookie(co);
- co = next;
+ co = next;
}
free(c); /* free the base struct as well */
}
diff --git a/lib/cookie.h b/lib/cookie.h
index 48b9d20fa..6f8e8e5fc 100644
--- a/lib/cookie.h
+++ b/lib/cookie.h
@@ -36,7 +36,7 @@ struct Cookie {
struct Cookie *next; /* next in the chain */
char *name; /* <this> = value */
char *value; /* name = <this> */
- char *path; /* path = <this> */
+ char *path; /* path = <this> */
char *domain; /* domain = <this> */
long expires; /* expires = <this> */
char *expirestr; /* the plain text version */
diff --git a/lib/dict.c b/lib/dict.c
index 2a7ad22c7..1b3f00452 100644
--- a/lib/dict.c
+++ b/lib/dict.c
@@ -1,8 +1,8 @@
/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
@@ -10,7 +10,7 @@
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
- *
+ *
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
@@ -101,7 +101,7 @@ CURLcode Curl_dict(struct connectdata *conn)
if (strnequal(path, DICT_MATCH, sizeof(DICT_MATCH)-1) ||
strnequal(path, DICT_MATCH2, sizeof(DICT_MATCH2)-1) ||
strnequal(path, DICT_MATCH3, sizeof(DICT_MATCH3)-1)) {
-
+
word = strchr(path, ':');
if (word) {
word++;
@@ -118,7 +118,7 @@ CURLcode Curl_dict(struct connectdata *conn)
}
}
}
-
+
if ((word == NULL) || (*word == (char)0)) {
failf(data, "lookup word is missing");
}
@@ -128,7 +128,7 @@ CURLcode Curl_dict(struct connectdata *conn)
if ((strategy == NULL) || (*strategy == (char)0)) {
strategy = (char *)".";
}
-
+
result = Curl_sendf(sockfd, conn,
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
"MATCH "
@@ -136,7 +136,7 @@ CURLcode Curl_dict(struct connectdata *conn)
"%s " /* strategy */
"%s\n" /* word */
"QUIT\n",
-
+
database,
strategy,
word
@@ -145,14 +145,14 @@ CURLcode Curl_dict(struct connectdata *conn)
failf(data, "Failed sending DICT request");
else
result = Curl_Transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount,
- -1, NULL); /* no upload */
+ -1, NULL); /* no upload */
if(result)
return result;
}
else if (strnequal(path, DICT_DEFINE, sizeof(DICT_DEFINE)-1) ||
strnequal(path, DICT_DEFINE2, sizeof(DICT_DEFINE2)-1) ||
strnequal(path, DICT_DEFINE3, sizeof(DICT_DEFINE3)-1)) {
-
+
word = strchr(path, ':');
if (word) {
word++;
@@ -165,14 +165,14 @@ CURLcode Curl_dict(struct connectdata *conn)
}
}
}
-
+
if ((word == NULL) || (*word == (char)0)) {
failf(data, "lookup word is missing");
}
if ((database == NULL) || (*database == (char)0)) {
database = (char *)"!";
}
-
+
result = Curl_sendf(sockfd, conn,
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
"DEFINE "
@@ -186,17 +186,17 @@ CURLcode Curl_dict(struct connectdata *conn)
else
result = Curl_Transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount,
-1, NULL); /* no upload */
-
+
if(result)
return result;
-
+
}
else {
-
+
ppath = strchr(path, '/');
if (ppath) {
int i;
-
+
ppath++;
for (i = 0; ppath[i]; i++) {
if (ppath[i] == ':')
diff --git a/lib/file.c b/lib/file.c
index 57201d417..6d6287d74 100644
--- a/lib/file.c
+++ b/lib/file.c
@@ -148,7 +148,7 @@ CURLcode Curl_file_connect(struct connectdata *conn)
if (actual_path[i] == '/')
actual_path[i] = '\\';
- fd = open(actual_path, O_RDONLY | O_BINARY); /* no CR/LF translation! */
+ fd = open(actual_path, O_RDONLY | O_BINARY); /* no CR/LF translation! */
file->path = actual_path;
#else
fd = open(real_path, O_RDONLY);
diff --git a/lib/formdata.c b/lib/formdata.c
index 5297e68de..d7c741938 100644
--- a/lib/formdata.c
+++ b/lib/formdata.c
@@ -242,7 +242,7 @@ static FormInfo * AddFormInfo(char *value,
*
***************************************************************************/
static const char * ContentTypeForFilename (const char *filename,
- const char *prevtype)
+ const char *prevtype)
{
const char *contenttype = NULL;
unsigned int i;
@@ -273,10 +273,10 @@ static const char * ContentTypeForFilename (const char *filename,
for(i=0; i<sizeof(ctts)/sizeof(ctts[0]); i++) {
if(strlen(filename) >= strlen(ctts[i].extension)) {
if(strequal(filename +
- strlen(filename) - strlen(ctts[i].extension),
- ctts[i].extension)) {
- contenttype = ctts[i].type;
- break;
+ strlen(filename) - strlen(ctts[i].extension),
+ ctts[i].extension)) {
+ contenttype = ctts[i].type;
+ break;
}
}
}
@@ -606,23 +606,23 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
current_form)))
return_value = CURL_FORMADD_MEMORY;
}
- else
- return_value = CURL_FORMADD_NULL;
+ else
+ return_value = CURL_FORMADD_NULL;
}
else
return_value = CURL_FORMADD_OPTION_TWICE;
}
else {
- if (contenttype) {
- current_form->contenttype = strdup(contenttype);
+ if (contenttype) {
+ current_form->contenttype = strdup(contenttype);
if(!current_form->contenttype)
return_value = CURL_FORMADD_MEMORY;
else
current_form->contenttype_alloc = TRUE;
}
- else
- return_value = CURL_FORMADD_NULL;
- }
+ else
+ return_value = CURL_FORMADD_NULL;
+ }
break;
}
case CURLFORM_CONTENTHEADER:
@@ -1425,10 +1425,10 @@ int main()
name3[1] = '\0';
value3[1] = '\0';
if (FormAddTest("PTRNAME + NAMELENGTH + COPYNAME + CONTENTSLENGTH test",
- &httppost, &last_post,
+ &httppost, &last_post,
CURLFORM_PTRNAME, name3, CURLFORM_COPYCONTENTS, value3,
CURLFORM_CONTENTSLENGTH, value3length,
- CURLFORM_NAMELENGTH, name3length, CURLFORM_END))
+ CURLFORM_NAMELENGTH, name3length, CURLFORM_END))
++errors;
if (FormAddTest("simple PTRCONTENTS test", &httppost, &last_post,
CURLFORM_COPYNAME, name4, CURLFORM_PTRCONTENTS, value4,
@@ -1529,7 +1529,7 @@ char *Curl_FormBoundary(void)
{
char *retstring;
static int randomizer=0; /* this is just so that two boundaries within
- the same form won't be identical */
+ the same form won't be identical */
size_t i;
static char table16[]="abcdef0123456789";
diff --git a/lib/ftp.c b/lib/ftp.c
index 96ea84331..e6c979e6d 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -55,7 +55,7 @@
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
-#ifdef VMS
+#ifdef VMS
#include <in.h>
#include <inet.h>
#endif
@@ -207,7 +207,7 @@ static CURLcode AllowServerConnect(struct connectdata *conn)
if (CURL_SOCKET_BAD == s) {
/* DIE! */
failf(data, "Error accept()ing server connect");
- return CURLE_FTP_PORT_FAILED;
+ return CURLE_FTP_PORT_FAILED;
}
infof(data, "Connection accepted from server\n");
@@ -260,7 +260,7 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
if (ftpcode)
*ftpcode = 0; /* 0 for errors */
- FD_ZERO (&readfd); /* clear it */
+ FD_ZERO (&readfd); /* clear it */
FD_SET (sockfd, &readfd); /* read socket */
/* get this in a backup variable to be able to restore it on each lap in the
@@ -300,7 +300,7 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
}
if(!ftp->cache) {
- readfd = rkeepfd; /* set every lap */
+ readfd = rkeepfd; /* set every lap */
interval.tv_sec = 1; /* use 1 second timeout intervals */
interval.tv_usec = 0;
@@ -327,13 +327,13 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
if(ftp->cache) {
/* we had data in the "cache", copy that instead of doing an actual
* read
- *
- * Dave Meyer, December 2003:
- * ftp->cache_size is cast to int here. This should be safe,
- * because it would have been populated with something of size
- * int to begin with, even though its datatype may be larger
- * than an int.
- */
+ *
+ * Dave Meyer, December 2003:
+ * ftp->cache_size is cast to int here. This should be safe,
+ * because it would have been populated with something of size
+ * int to begin with, even though its datatype may be larger
+ * than an int.
+ */
memcpy(ptr, ftp->cache, (int)ftp->cache_size);
gotbytes = (int)ftp->cache_size;
free(ftp->cache); /* free the cache */
@@ -387,7 +387,7 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
return result;
#define lastline(line) (isdigit((int)line[0]) && isdigit((int)line[1]) && \
- isdigit((int)line[2]) && (' ' == line[3]))
+ isdigit((int)line[2]) && (' ' == line[3]))
if(perline>3 && lastline(line_start)) {
/* This is the end of the last line, copy the last
@@ -790,7 +790,7 @@ CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status)
!data->set.crlf) {
failf(data, "Uploaded unaligned file size (%" FORMAT_OFF_T
" out of %" FORMAT_OFF_T " bytes)",
- *ftp->bytecountp, data->set.infilesize);
+ *ftp->bytecountp, data->set.infilesize);
conn->bits.close = TRUE; /* close this connection since we don't
know what state this error leaves us in */
return CURLE_PARTIAL_FILE;
@@ -800,7 +800,7 @@ CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status)
if((-1 != conn->size) && (conn->size != *ftp->bytecountp) &&
(conn->maxdownload != *ftp->bytecountp)) {
failf(data, "Received only partial file: %" FORMAT_OFF_T " bytes",
- *ftp->bytecountp);
+ *ftp->bytecountp);
conn->bits.close = TRUE; /* close this connection since we don't
know what state this error leaves us in */
return CURLE_PARTIAL_FILE;
@@ -1777,11 +1777,11 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn)
if(conn->ssl[SECONDARYSOCKET].use) {
/* since we only have a plaintext TCP connection here, we must now
- do the TLS stuff */
+ do the TLS stuff */
infof(data, "Doing the SSL/TLS handshake on the data stream\n");
result = Curl_SSLConnect(conn, SECONDARYSOCKET);
if(result)
- return result;
+ return result;
}
*bytecountp=0;
@@ -1838,7 +1838,7 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn)
}
infof(data, "range-download from %" FORMAT_OFF_T
" to %" FORMAT_OFF_T ", totally %" FORMAT_OFF_T " bytes\n",
- from, to, conn->maxdownload);
+ from, to, conn->maxdownload);
ftp->dont_check = TRUE; /* dont check for successful transfer */
}
@@ -2045,12 +2045,12 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn)
}
if(conn->ssl[SECONDARYSOCKET].use) {
- /* since we only have a plaintext TCP connection here, we must now
- do the TLS stuff */
- infof(data, "Doing the SSL/TLS handshake on the data stream\n");
- result = Curl_SSLConnect(conn, SECONDARYSOCKET);
- if(result)
- return result;
+ /* since we only have a plaintext TCP connection here, we must now
+ do the TLS stuff */
+ infof(data, "Doing the SSL/TLS handshake on the data stream\n");
+ result = Curl_SSLConnect(conn, SECONDARYSOCKET);
+ if(result)
+ return result;
}
if(size > conn->maxdownload && conn->maxdownload > 0)
diff --git a/lib/getenv.c b/lib/getenv.c
index abea29a31..8f8311bf0 100644
--- a/lib/getenv.c
+++ b/lib/getenv.c
@@ -1,8 +1,8 @@
/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
@@ -10,7 +10,7 @@
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
- *
+ *
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
@@ -51,10 +51,10 @@ char *GetEnv(const char *variable)
if (temp != NULL)
ExpandEnvironmentStrings(temp, env, sizeof(env));
#else
-#ifdef VMS
+#ifdef VMS
char *env = getenv(variable);
if (env && strcmp("HOME",variable) == 0) {
- env = decc$translate_vms(env);
+ env = decc$translate_vms(env);
}
#else
/* no length control */
diff --git a/lib/hostares.c b/lib/hostares.c
index 80d1ecd6c..48d62115e 100644
--- a/lib/hostares.c
+++ b/lib/hostares.c
@@ -47,12 +47,12 @@
#include <arpa/inet.h>
#endif
#ifdef HAVE_STDLIB_H
-#include <stdlib.h> /* required for free() prototypes */
+#include <stdlib.h> /* required for free() prototypes */
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* for the close() proto */
#endif
-#ifdef VMS
+#ifdef VMS
#include <in.h>
#include <inet.h>
#include <stdlib.h>
diff --git a/lib/hostasyn.c b/lib/hostasyn.c
index 5a0397d7a..2abad14fd 100644
--- a/lib/hostasyn.c
+++ b/lib/hostasyn.c
@@ -47,12 +47,12 @@
#include <arpa/inet.h>
#endif
#ifdef HAVE_STDLIB_H
-#include <stdlib.h> /* required for free() prototypes */
+#include <stdlib.h> /* required for free() prototypes */
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* for the close() proto */
#endif
-#ifdef VMS
+#ifdef VMS
#include <in.h>
#include <inet.h>
#include <stdlib.h>
diff --git a/lib/hostip.c b/lib/hostip.c
index c9c78784f..3db704f44 100644
--- a/lib/hostip.c
+++ b/lib/hostip.c
@@ -47,12 +47,12 @@
#include <arpa/inet.h>
#endif
#ifdef HAVE_STDLIB_H
-#include <stdlib.h> /* required for free() prototypes */
+#include <stdlib.h> /* required for free() prototypes */
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* for the close() proto */
#endif
-#ifdef VMS
+#ifdef VMS
#include <in.h>
#include <inet.h>
#include <stdlib.h>
diff --git a/lib/hostip4.c b/lib/hostip4.c
index b0196d15a..50d2adaa8 100644
--- a/lib/hostip4.c
+++ b/lib/hostip4.c
@@ -47,12 +47,12 @@
#include <arpa/inet.h>
#endif
#ifdef HAVE_STDLIB_H
-#include <stdlib.h> /* required for free() prototypes */
+#include <stdlib.h> /* required for free() prototypes */
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* for the close() proto */
#endif
-#ifdef VMS
+#ifdef VMS
#include <in.h>
#include <inet.h>
#include <stdlib.h>
diff --git a/lib/hostip6.c b/lib/hostip6.c
index e72794251..e1a08f78a 100644
--- a/lib/hostip6.c
+++ b/lib/hostip6.c
@@ -47,12 +47,12 @@
#include <arpa/inet.h>
#endif
#ifdef HAVE_STDLIB_H
-#include <stdlib.h> /* required for free() prototypes */
+#include <stdlib.h> /* required for free() prototypes */
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* for the close() proto */
#endif
-#ifdef VMS
+#ifdef VMS
#include <in.h>
#include <inet.h>
#include <stdlib.h>
diff --git a/lib/hostsyn.c b/lib/hostsyn.c
index 559043d38..d2343b962 100644
--- a/lib/hostsyn.c
+++ b/lib/hostsyn.c
@@ -1,8 +1,8 @@
/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
@@ -10,7 +10,7 @@
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
- *
+ *
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
@@ -47,12 +47,12 @@
#include <arpa/inet.h>
#endif
#ifdef HAVE_STDLIB_H
-#include <stdlib.h> /* required for free() prototypes */
+#include <stdlib.h> /* required for free() prototypes */
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* for the close() proto */
#endif
-#ifdef VMS
+#ifdef VMS
#include <in.h>
#include <inet.h>
#include <stdlib.h>
diff --git a/lib/hostthre.c b/lib/hostthre.c
index 6ab070638..738efa52f 100644
--- a/lib/hostthre.c
+++ b/lib/hostthre.c
@@ -47,12 +47,12 @@
#include <arpa/inet.h>
#endif
#ifdef HAVE_STDLIB_H
-#include <stdlib.h> /* required for free() prototypes */
+#include <stdlib.h> /* required for free() prototypes */
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* for the close() proto */
#endif
-#ifdef VMS
+#ifdef VMS
#include <in.h>
#include <inet.h>
#include <stdlib.h>
diff --git a/lib/http.c b/lib/http.c
index 52dc8486b..80484975f 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -967,7 +967,7 @@ CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn,
if(result)
return result;
- FD_ZERO (&readfd); /* clear it */
+ FD_ZERO (&readfd); /* clear it */
FD_SET (tunnelsocket, &readfd); /* read socket */
/* get this in a backup variable to be able to restore it on each lap in
@@ -1555,17 +1555,17 @@ CURLcode Curl_http(struct connectdata *conn)
curl_off_t total_expected_size=
conn->resume_from + data->set.infilesize;
conn->allocptr.rangeline =
- aprintf("Content-Range: bytes %s%" FORMAT_OFF_T
+ aprintf("Content-Range: bytes %s%" FORMAT_OFF_T
"/%" FORMAT_OFF_T "\r\n",
- conn->range, total_expected_size-1,
- total_expected_size);
+ conn->range, total_expected_size-1,
+ total_expected_size);
}
else {
/* Range was selected and then we just pass the incoming range and
append total size */
conn->allocptr.rangeline =
- aprintf("Content-Range: bytes %s/%" FORMAT_OFF_T "\r\n",
- conn->range, data->set.infilesize);
+ aprintf("Content-Range: bytes %s/%" FORMAT_OFF_T "\r\n",
+ conn->range, data->set.infilesize);
}
}
}
diff --git a/lib/http_digest.c b/lib/http_digest.c
index cd224625c..20f5dc47b 100644
--- a/lib/http_digest.c
+++ b/lib/http_digest.c
@@ -314,7 +314,7 @@ CURLcode Curl_output_digest(struct connectdata *conn,
A2 = Method ":" digest-uri-value
- If the "qop" value is "auth-int", then A2 is:
+ If the "qop" value is "auth-int", then A2 is:
A2 = Method ":" digest-uri-value ":" H(entity-body)
diff --git a/lib/inet_ntop.c b/lib/inet_ntop.c
index 0408bfdee..6b15c025f 100644
--- a/lib/inet_ntop.c
+++ b/lib/inet_ntop.c
@@ -35,9 +35,9 @@
#include "inet_ntoa_r.h"
#endif
-#define IN6ADDRSZ 16
-#define INADDRSZ 4
-#define INT16SZ 2
+#define IN6ADDRSZ 16
+#define INADDRSZ 4
+#define INT16SZ 2
#ifdef WIN32
#define EAFNOSUPPORT WSAEAFNOSUPPORT
diff --git a/lib/inet_pton.c b/lib/inet_pton.c
index c79b46335..9eb199af5 100644
--- a/lib/inet_pton.c
+++ b/lib/inet_pton.c
@@ -40,9 +40,9 @@
#include "inet_pton.h"
-#define IN6ADDRSZ 16
-#define INADDRSZ 4
-#define INT16SZ 2
+#define IN6ADDRSZ 16
+#define INADDRSZ 4
+#define INT16SZ 2
#ifdef WIN32
#define EAFNOSUPPORT WSAEAFNOSUPPORT
@@ -53,21 +53,21 @@
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
*/
-static int inet_pton4(const char *src, unsigned char *dst);
+static int inet_pton4(const char *src, unsigned char *dst);
#ifdef ENABLE_IPV6
-static int inet_pton6(const char *src, unsigned char *dst);
+static int inet_pton6(const char *src, unsigned char *dst);
#endif
/* int
* inet_pton(af, src, dst)
- * convert from presentation format (which usually means ASCII printable)
- * to network format (which is usually some kind of binary format).
+ * convert from presentation format (which usually means ASCII printable)
+ * to network format (which is usually some kind of binary format).
* return:
- * 1 if the address was valid for the specified address family
- * 0 if the address wasn't valid (`dst' is untouched in this case)
- * -1 if some other error occurred (`dst' is untouched in this case, too)
+ * 1 if the address was valid for the specified address family
+ * 0 if the address wasn't valid (`dst' is untouched in this case)
+ * -1 if some other error occurred (`dst' is untouched in this case, too)
* author:
- * Paul Vixie, 1996.
+ * Paul Vixie, 1996.
*/
int
Curl_inet_pton(int af, const char *src, void *dst)
@@ -76,8 +76,8 @@ Curl_inet_pton(int af, const char *src, void *dst)
case AF_INET:
return (inet_pton4(src, dst));
#ifdef ENABLE_IPV6
-#ifndef AF_INET6
-#define AF_INET6 AF_MAX+1 /* just to let this compile */
+#ifndef AF_INET6
+#define AF_INET6 AF_MAX+1 /* just to let this compile */
#endif
case AF_INET6:
return (inet_pton6(src, dst));
@@ -91,13 +91,13 @@ Curl_inet_pton(int af, const char *src, void *dst)
/* int
* inet_pton4(src, dst)
- * like inet_aton() but without all the hexadecimal and shorthand.
+ * like inet_aton() but without all the hexadecimal and shorthand.
* return:
- * 1 if `src' is a valid dotted quad, else 0.
+ * 1 if `src' is a valid dotted quad, else 0.
* notice:
- * does not touch `dst' unless it's returning 1.
+ * does not touch `dst' unless it's returning 1.
* author:
- * Paul Vixie, 1996.
+ * Paul Vixie, 1996.
*/
static int
inet_pton4(const char *src, unsigned char *dst)
@@ -142,16 +142,16 @@ inet_pton4(const char *src, unsigned char *dst)
#ifdef ENABLE_IPV6
/* int
* inet_pton6(src, dst)
- * convert presentation level address to network order binary form.
+ * convert presentation level address to network order binary form.
* return:
- * 1 if `src' is a valid [RFC1884 2.2] address, else 0.
+ * 1 if `src' is a valid [RFC1884 2.2] address, else 0.
* notice:
- * (1) does not touch `dst' unless it's returning 1.
- * (2) :: in a full address is silently ignored.
+ * (1) does not touch `dst' unless it's returning 1.
+ * (2) :: in a full address is silently ignored.
* credit:
- * inspired by Mark Andrews.
+ * inspired by Mark Andrews.
* author:
- * Paul Vixie, 1996.
+ * Paul Vixie, 1996.
*/
static int
inet_pton6(const char *src, unsigned char *dst)
@@ -206,7 +206,7 @@ inet_pton6(const char *src, unsigned char *dst)
inet_pton4(curtok, tp) > 0) {
tp += INADDRSZ;
saw_xdigit = 0;
- break; /* '\0' was seen by inet_pton4(). */
+ break; /* '\0' was seen by inet_pton4(). */
}
return (0);
}
diff --git a/lib/krb4.c b/lib/krb4.c
index 743f3f121..904ca774f 100644
--- a/lib/krb4.c
+++ b/lib/krb4.c
@@ -115,7 +115,7 @@ krb4_check_prot(void *app_data, int level)
static int
krb4_decode(void *app_data, void *buf, int len, int level,
- struct connectdata *conn)
+ struct connectdata *conn)
{
MSG_DAT m;
int e;
@@ -150,7 +150,7 @@ krb4_overhead(void *app_data, int level, int len)
static int
krb4_encode(void *app_data, void *from, int length, int level, void **to,
- struct connectdata *conn)
+ struct connectdata *conn)
{
struct krb4_data *d = app_data;
*to = malloc(length + 31);
@@ -168,7 +168,7 @@ krb4_encode(void *app_data, void *from, int length, int level, void **to,
static int
mk_auth(struct krb4_data *d, KTEXT adat,
- const char *service, char *host, int checksum)
+ const char *service, char *host, int checksum)
{
int ret;
CREDENTIALS cred;
diff --git a/lib/ldap.c b/lib/ldap.c
index 3ea417f24..e140f4ffa 100644
--- a/lib/ldap.c
+++ b/lib/ldap.c
@@ -74,10 +74,10 @@
#define LDAP_SIZELIMIT_EXCEEDED 4
#endif
-#define DLOPEN_MODE RTLD_LAZY /*! assume all dlopen() implementations have
+#define DLOPEN_MODE RTLD_LAZY /*! assume all dlopen() implementations have
this */
-#if defined(RTLD_LAZY_GLOBAL) /* It turns out some systems use this: */
+#if defined(RTLD_LAZY_GLOBAL) /* It turns out some systems use this: */
# undef DLOPEN_MODE
# define DLOPEN_MODE RTLD_LAZY_GLOBAL
#elif defined(RTLD_GLOBAL)
@@ -621,5 +621,5 @@ static void _ldap_free_urldesc (LDAPURLDesc *ludp)
}
free (ludp);
}
-#endif /* WIN32 */
-#endif /* CURL_DISABLE_LDAP */
+#endif /* WIN32 */
+#endif /* CURL_DISABLE_LDAP */
diff --git a/lib/memory.h b/lib/memory.h
index 4e32a6772..076d20a28 100644
--- a/lib/memory.h
+++ b/lib/memory.h
@@ -1,10 +1,10 @@
#ifndef _CURL_MEMORY_H
#define _CURL_MEMORY_H
/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
@@ -12,7 +12,7 @@
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
- *
+ *
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
diff --git a/lib/netrc.c b/lib/netrc.c
index 233e9018f..e43140ac3 100644
--- a/lib/netrc.c
+++ b/lib/netrc.c
@@ -1,8 +1,8 @@
/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
@@ -10,7 +10,7 @@
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
- *
+ *
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
@@ -83,7 +83,7 @@ int Curl_parsenetrc(char *host,
FILE *file;
int retcode=1;
int specific_login = (login[0] != 0);
- char *home = NULL;
+ char *home = NULL;
bool home_alloc = FALSE;
bool netrc_alloc = FALSE;
int state=NOTHING;
@@ -119,7 +119,7 @@ int Curl_parsenetrc(char *host,
struct passwd *pw;
pw= getpwuid(geteuid());
if (pw) {
-#ifdef VMS
+#ifdef VMS
home = decc$translate_vms(pw->pw_dir);
#else
home = pw->pw_dir;
@@ -156,65 +156,65 @@ int Curl_parsenetrc(char *host,
break;
}
- switch(state) {
- case NOTHING:
- if(strequal("machine", tok)) {
- /* the next tok is the machine name, this is in itself the
- delimiter that starts the stuff entered for this machine,
- after this we need to search for 'login' and
- 'password'. */
- state=HOSTFOUND;
- }
- break;
- case HOSTFOUND:
- if(strequal(host, tok)) {
- /* and yes, this is our host! */
- state=HOSTVALID;
+ switch(state) {
+ case NOTHING:
+ if(strequal("machine", tok)) {
+ /* the next tok is the machine name, this is in itself the
+ delimiter that starts the stuff entered for this machine,
+ after this we need to search for 'login' and
+ 'password'. */
+ state=HOSTFOUND;
+ }
+ break;
+ case HOSTFOUND:
+ if(strequal(host, tok)) {
+ /* and yes, this is our host! */
+ state=HOSTVALID;
#ifdef _NETRC_DEBUG
- printf("HOST: %s\n", tok);
+ printf("HOST: %s\n", tok);
#endif
- retcode=0; /* we did find our host */
- }
- else
- /* not our host */
- state=NOTHING;
- break;
- case HOSTVALID:
- /* we are now parsing sub-keywords concerning "our" host */
- if(state_login) {
+ retcode=0; /* we did find our host */
+ }
+ else
+ /* not our host */
+ state=NOTHING;
+ break;
+ case HOSTVALID:
+ /* we are now parsing sub-keywords concerning "our" host */
+ if(state_login) {
if (specific_login) {
state_our_login = strequal(login, tok);
}
else {
strncpy(login, tok, LOGINSIZE-1);
#ifdef _NETRC_DEBUG
- printf("LOGIN: %s\n", login);
+ printf("LOGIN: %s\n", login);
#endif
}
- state_login=0;
- }
- else if(state_password) {
+ state_login=0;
+ }
+ else if(state_password) {
if (state_our_login || !specific_login) {
strncpy(password, tok, PASSWORDSIZE-1);
#ifdef _NETRC_DEBUG
printf("PASSWORD: %s\n", password);
#endif
}
- state_password=0;
- }
- else if(strequal("login", tok))
- state_login=1;
- else if(strequal("password", tok))
- state_password=1;
- else if(strequal("machine", tok)) {
- /* ok, there's machine here go => */
- state = HOSTFOUND;
+ state_password=0;
+ }
+ else if(strequal("login", tok))
+ state_login=1;
+ else if(strequal("password", tok))
+ state_password=1;
+ else if(strequal("machine", tok)) {
+ /* ok, there's machine here go => */
+ state = HOSTFOUND;
state_our_login = FALSE;
- }
- break;
- } /* switch (state) */
+ }
+ break;
+ } /* switch (state) */
- tok = strtok_r(NULL, " \t\n", &tok_buf);
+ tok = strtok_r(NULL, " \t\n", &tok_buf);
} /* while (tok) */
} /* while fgets() */
@@ -240,7 +240,7 @@ int main(int argc, char **argv)
if(0 == ParseNetrc(argv[1], login, password)) {
printf("HOST: %s LOGIN: %s PASSWORD: %s\n",
- argv[1], login, password);
+ argv[1], login, password);
}
}
diff --git a/lib/progress.c b/lib/progress.c
index 7294894a7..36be56ea4 100644
--- a/lib/progress.c
+++ b/lib/progress.c
@@ -256,7 +256,7 @@ int Curl_pgrsUpdate(struct connectdata *conn)
if (!data->progress.callback) {
if(conn->resume_from)
fprintf(data->set.err,
- "** Resuming transfer from byte position %" FORMAT_OFF_T
+ "** Resuming transfer from byte position %" FORMAT_OFF_T
"\n",
conn->resume_from);
fprintf(data->set.err,
diff --git a/lib/security.c b/lib/security.c
index 41dfa7311..3b2a39213 100644
--- a/lib/security.c
+++ b/lib/security.c
@@ -178,15 +178,15 @@ static size_t
buffer_write(struct krb4buffer *buf, void *data, size_t len)
{
if(buf->index + len > buf->size) {
- void *tmp;
- if(buf->data == NULL)
- tmp = malloc(1024);
- else
- tmp = realloc(buf->data, buf->index + len);
- if(tmp == NULL)
- return -1;
- buf->data = tmp;
- buf->size = buf->index + len;
+ void *tmp;
+ if(buf->data == NULL)
+ tmp = malloc(1024);
+ else
+ tmp = realloc(buf->data, buf->index + len);
+ if(tmp == NULL)
+ return -1;
+ buf->data = tmp;
+ buf->size = buf->index + len;
}
memcpy((char*)buf->data + buf->index, data, len);
buf->index += len;
diff --git a/lib/security.h b/lib/security.h
index 73afd3ab2..f92473fca 100644
--- a/lib/security.h
+++ b/lib/security.h
@@ -1,10 +1,10 @@
#ifndef __SECURITY_H
#define __SECURITY_H
/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
@@ -12,7 +12,7 @@
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
- *
+ *
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
@@ -41,9 +41,9 @@ struct Curl_sec_client_mech {
};
-#define AUTH_OK 0
-#define AUTH_CONTINUE 1
-#define AUTH_ERROR 2
+#define AUTH_OK 0
+#define AUTH_CONTINUE 1
+#define AUTH_ERROR 2
extern struct Curl_sec_client_mech Curl_krb4_client_mech;
diff --git a/lib/sendf.c b/lib/sendf.c
index 84e44688f..7d0f71de1 100644
--- a/lib/sendf.c
+++ b/lib/sendf.c
@@ -33,7 +33,7 @@
#endif
#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h> /* required for send() & recv() prototypes */
+#include <sys/socket.h> /* required for send() & recv() prototypes */
#endif
#ifdef HAVE_UNISTD_H
@@ -59,7 +59,7 @@
/* returns last node in linked list */
static struct curl_slist *slist_get_last(struct curl_slist *list)
{
- struct curl_slist *item;
+ struct curl_slist *item;
/* if caller passed us a NULL, return now */
if (!list)
@@ -83,8 +83,8 @@ static struct curl_slist *slist_get_last(struct curl_slist *list)
struct curl_slist *curl_slist_append(struct curl_slist *list,
const char *data)
{
- struct curl_slist *last;
- struct curl_slist *new_item;
+ struct curl_slist *last;
+ struct curl_slist *new_item;
new_item = (struct curl_slist *) malloc(sizeof(struct curl_slist));
if (new_item) {
@@ -114,8 +114,8 @@ struct curl_slist *curl_slist_append(struct curl_slist *list,
/* be nice and clean up resources */
void curl_slist_free_all(struct curl_slist *list)
{
- struct curl_slist *next;
- struct curl_slist *item;
+ struct curl_slist *next;
+ struct curl_slist *item;
if (!list)
return;
diff --git a/lib/speedcheck.c b/lib/speedcheck.c
index b8b45cad1..273cacb5a 100644
--- a/lib/speedcheck.c
+++ b/lib/speedcheck.c
@@ -1,8 +1,8 @@
/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
@@ -10,7 +10,7 @@
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
- *
+ *
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
@@ -47,15 +47,15 @@ CURLcode Curl_speedcheck(struct SessionHandle *data,
/* We are now below the "low speed limit". If we are below it
for "low speed time" seconds we consider that enough reason
to abort the download. */
-
+
if( (Curl_tvdiff(now, data->state.keeps_speed)/1000) >
data->set.low_speed_time) {
/* we have been this slow for long enough, now die */
failf(data,
- "Operation too slow. "
- "Less than %d bytes/sec transfered the last %d seconds",
- data->set.low_speed_limit,
- data->set.low_speed_time);
+ "Operation too slow. "
+ "Less than %d bytes/sec transfered the last %d seconds",
+ data->set.low_speed_limit,
+ data->set.low_speed_time);
return CURLE_OPERATION_TIMEOUTED;
}
}
diff --git a/lib/ssluse.c b/lib/ssluse.c
index aa77abba3..f48928c9c 100644
--- a/lib/ssluse.c
+++ b/lib/ssluse.c
@@ -775,7 +775,7 @@ static int hostmatch(const char *hostname, const char *pattern)
return HOST_MATCH;
while (*hostname) {
- /* The only recursive function in libcurl! */
+ /* The only recursive function in libcurl! */
if (hostmatch(hostname++,pattern) == HOST_MATCH)
return HOST_MATCH;
}
@@ -1197,7 +1197,7 @@ Curl_SSLConnect(struct connectdata *conn,
if (!SSL_CTX_load_verify_locations(connssl->ctx, data->set.ssl.CAfile,
data->set.ssl.CApath)) {
if (data->set.ssl.verifypeer) {
- /* Fail if we insist on successfully verifying the server. */
+ /* Fail if we insist on successfully verifying the server. */
failf(data,"error setting certificate verify locations:\n"
" CAfile: %s\n CApath: %s\n",
data->set.ssl.CAfile ? data->set.ssl.CAfile : "none",
@@ -1351,7 +1351,7 @@ Curl_SSLConnect(struct connectdata *conn,
* the SO_ERROR is also lost.
*/
if (CURLE_SSL_CONNECT_ERROR == rc && errdetail == 0) {
- failf(data, "Unknown SSL protocol error in connection to %s:%d ",
+ failf(data, "Unknown SSL protocol error in connection to %s:%d ",
conn->host.name, conn->port);
return rc;
}
diff --git a/lib/strequal.c b/lib/strequal.c
index ec4910281..f993e382a 100644
--- a/lib/strequal.c
+++ b/lib/strequal.c
@@ -135,6 +135,6 @@ size_t Curl_strlcat(char *dst, const char *src, size_t siz)
}
*d = '\0';
- return(dlen + (s - src)); /* count does not include NUL */
+ return(dlen + (s - src)); /* count does not include NUL */
}
#endif
diff --git a/lib/telnet.c b/lib/telnet.c
index 1d5cdf64a..b0f74bb8d 100644
--- a/lib/telnet.c
+++ b/lib/telnet.c
@@ -107,12 +107,12 @@ static CURLcode check_wsock2 ( struct SessionHandle *data );
static
void telrcv(struct connectdata *,
- unsigned char *inbuf, /* Data received from socket */
- ssize_t count); /* Number of bytes received */
+ unsigned char *inbuf, /* Data received from socket */
+ ssize_t count); /* Number of bytes received */
static void printoption(struct SessionHandle *data,
- const char *direction,
- int cmd, int option);
+ const char *direction,
+ int cmd, int option);
static void negotiate(struct connectdata *);
static void send_negotiation(struct connectdata *, int cmd, int option);
@@ -120,17 +120,17 @@ static void set_local_option(struct connectdata *, int cmd, int option);
static void set_remote_option(struct connectdata *, int cmd, int option);
static void printsub(struct SessionHandle *data,
- int direction, unsigned char *pointer,
+ int direction, unsigned char *pointer,
size_t length);
static void suboption(struct connectdata *);
/* For negotiation compliant to RFC 1143 */
-#define CURL_NO 0
-#define CURL_YES 1
-#define CURL_WANTYES 2
-#define CURL_WANTNO 3
+#define CURL_NO 0
+#define CURL_YES 1
+#define CURL_WANTYES 2
+#define CURL_WANTNO 3
-#define CURL_EMPTY 0
+#define CURL_EMPTY 0
#define CURL_OPPOSITE 1
/*
@@ -200,7 +200,7 @@ check_wsock2 ( struct SessionHandle *data )
HIBYTE(wsaData.wVersion) != HIBYTE(wVersionRequested)) {
/* Our version isn't supported */
failf(data,"insufficient winsock version to support "
- "telnet");
+ "telnet");
return CURLE_FAILED_INIT;
}
@@ -249,7 +249,7 @@ static void negotiate(struct connectdata *conn)
}
static void printoption(struct SessionHandle *data,
- const char *direction, int cmd, int option)
+ const char *direction, int cmd, int option)
{
const char *fmt;
const char *opt;
@@ -662,9 +662,9 @@ void rec_dont(struct connectdata *conn, int option)
static void printsub(struct SessionHandle *data,
- int direction, /* '<' or '>' */
- unsigned char *pointer, /* where suboption data is */
- size_t length) /* length of suboption data */
+ int direction, /* '<' or '>' */
+ unsigned char *pointer, /* where suboption data is */
+ size_t length) /* length of suboption data */
{
unsigned int i = 0;
@@ -898,8 +898,8 @@ static void suboption(struct connectdata *conn)
static
void telrcv(struct connectdata *conn,
- unsigned char *inbuf, /* Data received from socket */
- ssize_t count) /* Number of bytes received */
+ unsigned char *inbuf, /* Data received from socket */
+ ssize_t count) /* Number of bytes received */
{
unsigned char c;
int in = 0;
@@ -1124,7 +1124,7 @@ CURLcode Curl_telnet(struct connectdata *conn)
create_event_func = GetProcAddress(wsock2,"WSACreateEvent");
if (create_event_func == NULL) {
failf(data,"failed to find WSACreateEvent function (%d)",
- GetLastError());
+ GetLastError());
FreeLibrary(wsock2);
return CURLE_FAILED_INIT;
}
@@ -1133,7 +1133,7 @@ CURLcode Curl_telnet(struct connectdata *conn)
close_event_func = GetProcAddress(wsock2,"WSACloseEvent");
if (create_event_func == NULL) {
failf(data,"failed to find WSACloseEvent function (%d)",
- GetLastError());
+ GetLastError());
FreeLibrary(wsock2);
return CURLE_FAILED_INIT;
}
@@ -1142,7 +1142,7 @@ CURLcode Curl_telnet(struct connectdata *conn)
event_select_func = GetProcAddress(wsock2,"WSAEventSelect");
if (event_select_func == NULL) {
failf(data,"failed to find WSAEventSelect function (%d)",
- GetLastError());
+ GetLastError());
FreeLibrary(wsock2);
return CURLE_FAILED_INIT;
}
@@ -1151,7 +1151,7 @@ CURLcode Curl_telnet(struct connectdata *conn)
enum_netevents_func = GetProcAddress(wsock2,"WSAEnumNetworkEvents");
if (enum_netevents_func == NULL) {
failf(data,"failed to find WSAEnumNetworkEvents function (%d)",
- GetLastError());
+ GetLastError());
FreeLibrary(wsock2);
return CURLE_FAILED_INIT;
}
@@ -1305,7 +1305,7 @@ CURLcode Curl_telnet(struct connectdata *conn)
if (!FreeLibrary(wsock2))
infof(data,"FreeLibrary(wsock2) failed (%d)",GetLastError());
#else
- FD_ZERO (&readfd); /* clear it */
+ FD_ZERO (&readfd); /* clear it */
FD_SET (sockfd, &readfd);
FD_SET (0, &readfd);
@@ -1314,17 +1314,17 @@ CURLcode Curl_telnet(struct connectdata *conn)
while (keepon) {
struct timeval interval;
- readfd = keepfd; /* set this every lap in the loop */
+ readfd = keepfd; /* set this every lap in the loop */
interval.tv_sec = 1;
interval.tv_usec = 0;
switch (select (sockfd + 1, &readfd, NULL, NULL, &interval)) {
- case -1: /* error, stop reading */
+ case -1: /* error, stop reading */
keepon = FALSE;
continue;
- case 0: /* timeout */
+ case 0: /* timeout */
break;
- default: /* read! */
+ default: /* read! */
if(FD_ISSET(0, &readfd)) { /* read from stdin */
unsigned char outbuf[2];
int out_count = 0;
diff --git a/lib/transfer.h b/lib/transfer.h
index 4ebf07532..1b7eb828f 100644
--- a/lib/transfer.h
+++ b/lib/transfer.h
@@ -40,11 +40,11 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp);
/* This sets up a forthcoming transfer */
CURLcode
Curl_Transfer (struct connectdata *data,
- int sockindex, /* socket index to read from or -1 */
- curl_off_t size, /* -1 if unknown at this point */
- bool getheader, /* TRUE if header parsing is wanted */
- curl_off_t *bytecountp, /* return number of bytes read */
- int writesockindex, /* socket index to write to, it may
+ int sockindex, /* socket index to read from or -1 */
+ curl_off_t size, /* -1 if unknown at this point */
+ bool getheader, /* TRUE if header parsing is wanted */
+ curl_off_t *bytecountp, /* return number of bytes read */
+ int writesockindex, /* socket index to write to, it may
very well be the same we read from.
-1 disables */
curl_off_t *writecountp /* return number of bytes written */
diff --git a/lib/url.c b/lib/url.c
index 3673fa576..07d85fd71 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -2451,23 +2451,23 @@ static CURLcode CreateConnection(struct SessionHandle *data,
break;
}
}
- nope=strtok_r(NULL, ", ", &no_proxy_tok_buf);
+ nope=strtok_r(NULL, ", ", &no_proxy_tok_buf);
}
if(!nope) {
- /* It was not listed as without proxy */
- char *protop = conn->protostr;
- char *envp = proxy_env;
- char *prox;
+ /* It was not listed as without proxy */
+ char *protop = conn->protostr;
+ char *envp = proxy_env;
+ char *prox;
- /* Now, build <protocol>_proxy and check for such a one to use */
- while(*protop)
- *envp++ = tolower((int)*protop++);
+ /* Now, build <protocol>_proxy and check for such a one to use */
+ while(*protop)
+ *envp++ = tolower((int)*protop++);
- /* append _proxy */
- strcpy(envp, "_proxy");
+ /* append _proxy */
+ strcpy(envp, "_proxy");
- /* read the protocol proxy: */
- prox=curl_getenv(proxy_env);
+ /* read the protocol proxy: */
+ prox=curl_getenv(proxy_env);
/*
* We don't try the uppercase version of HTTP_PROXY because of
@@ -2481,21 +2481,21 @@ static CURLcode CreateConnection(struct SessionHandle *data,
* This can cause 'internal' http/ftp requests to be
* arbitrarily redirected by any external attacker.
*/
- if(!prox && !strequal("http_proxy", proxy_env)) {
+ if(!prox && !strequal("http_proxy", proxy_env)) {
/* There was no lowercase variable, try the uppercase version: */
- for(envp = proxy_env; *envp; envp++)
- *envp = toupper((int)*envp);
- prox=curl_getenv(proxy_env);
- }
-
- if(prox && *prox) { /* don't count "" strings */
- proxy = prox; /* use this */
- }
- else {
- proxy = curl_getenv("all_proxy"); /* default proxy to use */
- if(!proxy)
+ for(envp = proxy_env; *envp; envp++)
+ *envp = toupper((int)*envp);
+ prox=curl_getenv(proxy_env);
+ }
+
+ if(prox && *prox) { /* don't count "" strings */
+ proxy = prox; /* use this */
+ }
+ else {
+ proxy = curl_getenv("all_proxy"); /* default proxy to use */
+ if(!proxy)
proxy=curl_getenv("ALL_PROXY");
- }
+ }
if(proxy && *proxy) {
/* we have a proxy here to set */
@@ -2652,7 +2652,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
if (isdigit((int)conn->path[1])) {
conn->path = strchr(&conn->path[1], '/');
if (conn->path == NULL)
- conn->path = conn->pathbuffer;
+ conn->path = conn->pathbuffer;
}
conn->protocol |= PROT_GOPHER;
conn->curl_do = Curl_http;
@@ -2728,16 +2728,16 @@ static CURLcode CreateConnection(struct SessionHandle *data,
command = toupper((int)type[6]);
switch(command) {
case 'A': /* ASCII mode */
- data->set.ftp_ascii = 1;
- break;
+ data->set.ftp_ascii = 1;
+ break;
case 'D': /* directory mode */
- data->set.ftp_list_only = 1;
- break;
+ data->set.ftp_list_only = 1;
+ break;
case 'I': /* binary mode */
default:
- /* switch off ASCII */
- data->set.ftp_ascii = 0;
- break;
+ /* switch off ASCII */
+ data->set.ftp_ascii = 0;
+ break;
}
}
#else /* CURL_DISABLE_FTP */
@@ -3162,7 +3162,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
infof(data, "Re-using existing connection! (#%ld) with host %s\n",
conn->connectindex,
- conn->bits.httpproxy?conn->proxy.dispname:conn->host.dispname);
+ conn->bits.httpproxy?conn->proxy.dispname:conn->host.dispname);
}
else {
/*
@@ -3523,7 +3523,7 @@ CURLcode Curl_done(struct connectdata **connp,
else
infof(data, "Connection #%ld to host %s left intact\n",
conn->connectindex,
- conn->bits.httpproxy?conn->proxy.dispname:conn->host.dispname);
+ conn->bits.httpproxy?conn->proxy.dispname:conn->host.dispname);
return result;
}
diff --git a/lib/urldata.h b/lib/urldata.h
index ae2642ee7..08db4d60e 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -78,7 +78,7 @@
#include "timeval.h"
#ifdef HAVE_ZLIB_H
-#include <zlib.h> /* for content-encoding */
+#include <zlib.h> /* for content-encoding */
#endif
#ifdef USE_ARES
@@ -151,8 +151,8 @@ struct ssl_config_data {
char *egdsocket; /* path to file containing the EGD daemon socket */
char *cipher_list; /* list of ciphers to use */
long numsessions; /* SSL session id cache size */
- curl_ssl_ctx_callback fsslctx; /* function to initialize ssl ctx */
- void *fsslctxp; /*parameter for call back */
+ curl_ssl_ctx_callback fsslctx; /* function to initialize ssl ctx */
+ void *fsslctxp; /*parameter for call back */
};
/* information stored about one single SSL session */
@@ -342,27 +342,27 @@ struct Curl_transfer_keeper {
curl_off_t writebytecount; /* number of bytes written */
struct timeval start; /* transfer started at this time */
struct timeval now; /* current time */
- bool header; /* incoming data has HTTP header */
+ bool header; /* incoming data has HTTP header */
enum {
HEADER_NORMAL, /* no bad header at all */
HEADER_PARTHEADER, /* part of the chunk is a bad header, the rest
is normal data */
HEADER_ALLBAD /* all was believed to be header */
- } badheader; /* the header was deemed bad and will be
+ } badheader; /* the header was deemed bad and will be
written as body */
- int headerline; /* counts header lines to better track the
+ int headerline; /* counts header lines to better track the
first one */
- char *hbufp; /* points at *end* of header line */
+ char *hbufp; /* points at *end* of header line */
size_t hbuflen;
- char *str; /* within buf */
- char *str_start; /* within buf */
- char *end_ptr; /* within buf */
- char *p; /* within headerbuff */
- bool content_range; /* set TRUE if Content-Range: was found */
- curl_off_t offset; /* possible resume offset read from the
+ char *str; /* within buf */
+ char *str_start; /* within buf */
+ char *end_ptr; /* within buf */
+ char *p; /* within headerbuff */
+ bool content_range; /* set TRUE if Content-Range: was found */
+ curl_off_t offset; /* possible resume offset read from the
Content-Range: header */
- int httpcode; /* error code from the 'HTTP/1.? XXX' line */
- int httpversion; /* the HTTP version*10 */
+ int httpcode; /* error code from the 'HTTP/1.? XXX' line */
+ int httpversion; /* the HTTP version*10 */
struct timeval start100; /* time stamp to wait for the 100 code from */
bool write_after_100_header; /* TRUE = we enable the write after we
received a 100-continue/timeout or
@@ -370,17 +370,17 @@ struct Curl_transfer_keeper {
bool wait100_after_headers; /* TRUE = after the request-headers have been
sent off properly, we go into the wait100
state, FALSE = don't */
- int content_encoding; /* What content encoding. sec 3.5, RFC2616. */
+ int content_encoding; /* What content encoding. sec 3.5, RFC2616. */
-#define IDENTITY 0 /* No encoding */
-#define DEFLATE 1 /* zlib delfate [RFC 1950 & 1951] */
-#define GZIP 2 /* gzip algorithm [RFC 1952] */
-#define COMPRESS 3 /* Not handled, added for completeness */
+#define IDENTITY 0 /* No encoding */
+#define DEFLATE 1 /* zlib delfate [RFC 1950 & 1951] */
+#define GZIP 2 /* gzip algorithm [RFC 1952] */
+#define COMPRESS 3 /* Not handled, added for completeness */
#ifdef HAVE_LIBZ
- bool zlib_init; /* True if zlib already initialized;
- undefined if Content-Encoding header. */
- z_stream z; /* State structure for zlib. */
+ bool zlib_init; /* True if zlib already initialized;
+ undefined if Content-Encoding header. */
+ z_stream z; /* State structure for zlib. */
#endif
time_t timeofdoc;
@@ -519,8 +519,8 @@ struct connectdata {
/**** curl_get() phase fields */
/* READ stuff */
- curl_socket_t sockfd; /* socket to read from or CURL_SOCKET_BAD */
- curl_off_t size; /* -1 if unknown at this point */
+ curl_socket_t sockfd; /* socket to read from or CURL_SOCKET_BAD */
+ curl_off_t size; /* -1 if unknown at this point */
curl_off_t *bytecountp; /* return number of bytes read or NULL */
/* WRITE stuff */
@@ -543,7 +543,7 @@ struct connectdata {
} allocptr;
char *newurl; /* This can only be set if a Location: was in the
- document headers */
+ document headers */
#ifdef HAVE_KRB4
enum protection_level command_prot;
diff --git a/src/config-amigaos.h b/src/config-amigaos.h
index ab6d28826..2d66e37e3 100644
--- a/src/config-amigaos.h
+++ b/src/config-amigaos.h
@@ -7,37 +7,28 @@
#define OS "AmigaOS"
-#define HAVE_UNISTD_H 1
-#define HAVE_STRDUP 1
-#define HAVE_UTIME 1
-#define HAVE_UTIME_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_SYS_SOCKET_H 1
-#define HAVE_WRITABLE_ARGV 1
-#define HAVE_SYS_TIME_H 1
-#define HAVE_TIME_H 1
-#define TIME_WITH_SYS_TIME 1
-#define HAVE_TERMIOS_H 1
-
-#define HAVE_PWD_H 1
-
-/* futher implementation?... */
-//#define HAVE_TCGETATTR 1
-//#define HAVE_TCSETATTR 1
-
-/* futher usergroup.library usage?... */
-//#define HAVE_GETPWUID 1
-//#define HAVE_GETEUID 1
-
+#define HAVE_UNISTD_H 1
+#define HAVE_STRDUP 1
+#define HAVE_UTIME 1
+#define HAVE_UTIME_H 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_SYS_SOCKET_H 1
+#define HAVE_WRITABLE_ARGV 1
+#define HAVE_SYS_TIME_H 1
+#define HAVE_TIME_H 1
+#define TIME_WITH_SYS_TIME 1
+#define HAVE_TERMIOS_H 1
+
+#define HAVE_PWD_H 1
#ifndef F_OK
# define F_OK 0
#endif
#ifndef LONG_MAX
-# define LONG_MAX 0x7fffffffL /* max value for a long */
+# define LONG_MAX 0x7fffffffL /* max value for a long */
#endif
#ifndef LONG_MIN
-# define LONG_MIN (-0x7fffffffL-1) /* min value for a long */
+# define LONG_MIN (-0x7fffffffL-1) /* min value for a long */
#endif
#endif /* CURL_CONFIG_AMIGAOS_H */
diff --git a/src/config-mac.h b/src/config-mac.h
index a6f58e685..36505c94c 100644
--- a/src/config-mac.h
+++ b/src/config-mac.h
@@ -1,13 +1,13 @@
/* Define to 1 if you want the built-in manual */
#define USE_MANUAL 1
-#define HAVE_UNISTD_H 1
-#define HAVE_FCNTL_H 1
-#define HAVE_UTIME_H 1
-#define HAVE_SYS_UTIME_H 1
+#define HAVE_UNISTD_H 1
+#define HAVE_FCNTL_H 1
+#define HAVE_UTIME_H 1
+#define HAVE_SYS_UTIME_H 1
-#define HAVE_SETVBUF 1
-#define HAVE_UTIME 1
+#define HAVE_SETVBUF 1
+#define HAVE_UTIME 1
#define main(x,y) curl_main(x,y)
diff --git a/src/getpass.c b/src/getpass.c
index 21cb679a7..af377b1ed 100644
--- a/src/getpass.c
+++ b/src/getpass.c
@@ -39,7 +39,7 @@
#include "getpass.h"
#ifndef WIN32
-#ifdef VMS
+#ifdef VMS
#include <stdio.h>
#include <string.h>
#include descrip
@@ -80,7 +80,7 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
}
#else /* VMS */
#ifdef HAVE_TERMIOS_H
-# if !defined(HAVE_TCGETATTR) && !defined(HAVE_TCSETATTR)
+# if !defined(HAVE_TCGETATTR) && !defined(HAVE_TCSETATTR)
# undef HAVE_TERMIOS_H
# endif
#endif
@@ -126,7 +126,7 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
#else
# ifdef HAVE_TERMIO_H
struct termio orig;
- struct termio noecho;
+ struct termio noecho;
# else
# endif
#endif
@@ -192,7 +192,7 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
# else
# endif
#endif
-
+
signal(SIGINT, sigint);
#ifdef SIGTSTP
signal(SIGTSTP, sigtstp);
@@ -211,7 +211,7 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
{
size_t i;
printf("%s", prompt);
-
+
for(i=0; i<buflen; i++) {
buffer[i] = getch();
if ( buffer[i] == '\r' ) {
diff --git a/src/homedir.c b/src/homedir.c
index 3ec196a7e..69fbc467c 100644
--- a/src/homedir.c
+++ b/src/homedir.c
@@ -1,8 +1,8 @@
/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
@@ -10,7 +10,7 @@
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
- *
+ *
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
@@ -56,7 +56,7 @@ char *GetEnv(const char *variable, char do_expand)
/* Don't use getenv(); it doesn't find variable added after program was
* started. Don't accept truncated results (i.e. rc >= sizeof(buf1)). */
-
+
rc = GetEnvironmentVariable(variable, buf1, sizeof(buf1));
if (rc > 0 && rc < sizeof(buf1)) {
env = buf1;
@@ -71,10 +71,10 @@ char *GetEnv(const char *variable, char do_expand)
}
#else
(void)do_expand;
-#ifdef VMS
+#ifdef VMS
env = getenv(variable);
if (env && strcmp("HOME",variable) == 0) {
- env = decc$translate_vms(env);
+ env = decc$translate_vms(env);
}
#else
/* no length control */
@@ -90,11 +90,11 @@ char *homedir(void)
char *home = GetEnv("HOME", FALSE);
if(home)
return home;
-
+
#if defined(HAVE_GETPWUID) && defined(HAVE_GETEUID)
{
struct passwd *pw = getpwuid(geteuid());
-
+
if (pw) {
#ifdef VMS
home = decc$translate_vms(pw->pw_dir);
diff --git a/src/main.c b/src/main.c
index 87886ad6c..86e06ccd3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -46,7 +46,7 @@
#include "writeenv.h"
#endif
-#define CURLseparator "--_curl_--"
+#define CURLseparator "--_curl_--"
#if defined(WIN32)&&!defined(__CYGWIN32__)
#include <winsock2.h>
@@ -146,7 +146,7 @@ typedef char bool;
* standard MIN macro
*/
#ifndef MIN
-#define MIN(X,Y) (((X) < (Y)) ? (X) : (Y))
+#define MIN(X,Y) (((X) < (Y)) ? (X) : (Y))
#endif
typedef enum {
@@ -207,7 +207,7 @@ char *strdup(char *str)
#define mkdir(x,y) (mkdir)(x)
#endif
-#ifdef VMS
+#ifdef VMS
#include "curlmsg_vms.h"
#endif
@@ -523,7 +523,7 @@ static char *my_get_line(FILE *fp);
static int create_dir_hierarchy(char *outfile);
static void GetStr(char **string,
- char *value)
+ char *value)
{
if(*string)
free(*string);
@@ -788,34 +788,34 @@ static int formparse(char *input,
multi_start = multi_current=NULL;
do {
- /* since this was a file, it may have a content-type specifier
- at the end too, or a filename. Or both. */
+ /* since this was a file, it may have a content-type specifier
+ at the end too, or a filename. Or both. */
char *ptr;
char *filename=NULL;
- sep=strchr(contp, FORM_TYPE_SEPARATOR);
- sep2=strchr(contp, FORM_FILE_SEPARATOR);
+ sep=strchr(contp, FORM_TYPE_SEPARATOR);
+ sep2=strchr(contp, FORM_FILE_SEPARATOR);
- /* pick the closest */
- if(sep2 && (sep2 < sep)) {
- sep = sep2;
+ /* pick the closest */
+ if(sep2 && (sep2 < sep)) {
+ sep = sep2;
- /* no type was specified! */
- }
+ /* no type was specified! */
+ }
type = NULL;
- if(sep) {
+ if(sep) {
- /* if we got here on a comma, don't do much */
- if(FORM_FILE_SEPARATOR == *sep)
- ptr = NULL;
- else
+ /* if we got here on a comma, don't do much */
+ if(FORM_FILE_SEPARATOR == *sep)
+ ptr = NULL;
+ else
ptr = sep+1;
- *sep=0; /* terminate file name at separator */
+ *sep=0; /* terminate file name at separator */
- while(ptr && (FORM_FILE_SEPARATOR!= *ptr)) {
+ while(ptr && (FORM_FILE_SEPARATOR!= *ptr)) {
/* pass all white spaces */
while(isspace((int)*ptr))
@@ -855,21 +855,21 @@ static int formparse(char *input,
else
/* confusion, bail out of loop */
break;
- }
+ }
/* find the following comma */
if(ptr)
sep=strchr(ptr, FORM_FILE_SEPARATOR);
else
sep=NULL;
- }
- else {
- sep=strchr(contp, FORM_FILE_SEPARATOR);
- }
- if(sep) {
- /* the next file name starts here */
- *sep =0;
- sep++;
- }
+ }
+ else {
+ sep=strchr(contp, FORM_FILE_SEPARATOR);
+ }
+ if(sep) {
+ /* the next file name starts here */
+ *sep =0;
+ sep++;
+ }
/* if type == NULL curl_formadd takes care of the problem */
if (!AddMultiFiles (contp, type, filename, &multi_start,
@@ -879,7 +879,7 @@ static int formparse(char *input,
FreeMultiInfo (multi_start);
return 3;
}
- contp = sep; /* move the contents pointer to after the separator */
+ contp = sep; /* move the contents pointer to after the separator */
} while(sep && *sep); /* loop if there's another file name */
@@ -1280,8 +1280,8 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
numhits = 1; /* a single unique hit */
break;
}
- parse = aliases[j].letter;
- hit = j;
+ parse = aliases[j].letter;
+ hit = j;
}
}
if(numhits>1) {
@@ -1314,13 +1314,13 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
#endif
if(hit < 0) {
for(j=0; j< sizeof(aliases)/sizeof(aliases[0]); j++) {
- if(letter == aliases[j].letter[0]) {
- hit = j;
- break;
- }
+ if(letter == aliases[j].letter[0]) {
+ hit = j;
+ break;
+ }
}
if(hit < 0) {
- return PARAM_OPTION_UNKNOWN;
+ return PARAM_OPTION_UNKNOWN;
}
}
if(hit < 0) {
@@ -1392,34 +1392,34 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
break;
case 'j': /* --compressed */
- config->encoding ^= TRUE;
- break;
+ config->encoding ^= TRUE;
+ break;
case 'k': /* --digest */
- config->authtype = CURLAUTH_DIGEST;
- break;
+ config->authtype = CURLAUTH_DIGEST;
+ break;
case 'l': /* --negotiate */
if(curlinfo->features & CURL_VERSION_GSSNEGOTIATE)
config->authtype = CURLAUTH_GSSNEGOTIATE;
else
return PARAM_LIBCURL_DOESNT_SUPPORT;
- break;
+ break;
case 'm': /* --ntlm */
if(curlinfo->features & CURL_VERSION_NTLM)
config->authtype = CURLAUTH_NTLM;
else
return PARAM_LIBCURL_DOESNT_SUPPORT;
- break;
+ break;
case 'n': /* --basic for completeness */
- config->authtype = CURLAUTH_BASIC;
- break;
+ config->authtype = CURLAUTH_BASIC;
+ break;
case 'o': /* --anyauth, let libcurl pick it */
- config->authtype = CURLAUTH_ANY;
- break;
+ config->authtype = CURLAUTH_ANY;
+ break;
#ifdef __DJGPP__
case 'p': /* --wdebug */
@@ -1520,8 +1520,8 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
GetStr(&config->socks5proxy, nextarg);
break;
case 'd': /* --tcp-nodelay option */
- config->tcp_nodelay ^= TRUE;
- break;
+ config->tcp_nodelay ^= TRUE;
+ break;
case 'e': /* --proxy-digest */
config->proxydigest ^= TRUE;
break;
@@ -1723,11 +1723,11 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
break;
case 'F':
/* "form data" simulation, this is a little advanced so lets do our best
- to sort this out slowly and carefully */
+ to sort this out slowly and carefully */
if(formparse(nextarg,
&config->httppost,
&config->last_post))
- return PARAM_BAD_USE;
+ return PARAM_BAD_USE;
if(SetHTTPrequest(HTTPREQ_POST, &config->httpreq))
return PARAM_BAD_USE;
break;
@@ -1860,9 +1860,9 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
case 'P':
/* This makes the FTP sessions use PORT instead of PASV */
/* use <eth0> or <192.168.10.10> style addresses. Anything except
- this will make us try to get the "default" address.
- NOTE: this is a changed behaviour since the released 4.1!
- */
+ this will make us try to get the "default" address.
+ NOTE: this is a changed behaviour since the released 4.1!
+ */
GetStr(&config->ftpport, nextarg);
break;
case 'p':
@@ -1871,7 +1871,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
break;
case 'q': /* if used first, already taken care of, we do it like
- this so we don't cause an error! */
+ this so we don't cause an error! */
break;
case 'Q':
/* QUOTE command to send to FTP server */
@@ -2034,14 +2034,14 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
if(str2num(&config->low_speed_time, nextarg))
return PARAM_BAD_NUMERIC;
if(!config->low_speed_limit)
- config->low_speed_limit = 1;
+ config->low_speed_limit = 1;
break;
case 'Y':
/* low speed limit */
if(str2num(&config->low_speed_limit, nextarg))
return PARAM_BAD_NUMERIC;
if(!config->low_speed_time)
- config->low_speed_time=30;
+ config->low_speed_time=30;
break;
case 'z': /* time condition coming up */
switch(*nextarg) {
@@ -2254,7 +2254,7 @@ static void parseconfig(const char *filename,
if(alloced_param)
{
free(param);
- param = NULL;
+ param = NULL;
}
free(aline);
@@ -2831,23 +2831,23 @@ operate(struct Configurable *config, int argc, char *argv[])
char *flag = argv[i];
if(curlx_strequal("--", argv[i]))
- /* this indicates the end of the flags and thus enables the
- following (URL) argument to start with -. */
- stillflags=FALSE;
+ /* this indicates the end of the flags and thus enables the
+ following (URL) argument to start with -. */
+ stillflags=FALSE;
else {
- nextarg= (i < argc - 1)? argv[i+1]: NULL;
+ nextarg= (i < argc - 1)? argv[i+1]: NULL;
- res = getparameter(flag, nextarg, &passarg, config);
- if(res) {
+ res = getparameter(flag, nextarg, &passarg, config);
+ if(res) {
const char *reason = param2text(res);
if(res != PARAM_HELP_REQUESTED)
helpf("option %s: %s\n", origopt, reason);
clean_getout(config);
- return CURLE_FAILED_INIT;
+ return CURLE_FAILED_INIT;
}
- if(passarg) /* we're supposed to skip this */
- i++;
+ if(passarg) /* we're supposed to skip this */
+ i++;
}
}
else {
@@ -3093,7 +3093,7 @@ operate(struct Configurable *config, int argc, char *argv[])
config->resume_from = 0;
}
- outs.filename = outfile;
+ outs.filename = outfile;
if(config->resume_from) {
/* open file for output: */
@@ -3253,8 +3253,8 @@ operate(struct Configurable *config, int argc, char *argv[])
}
#endif
- if(1 == config->tcp_nodelay)
- curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1);
+ if(1 == config->tcp_nodelay)
+ curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1);
curl_easy_setopt(curl, CURLOPT_SSLENGINE, config->engine);
curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT, 1);
@@ -3479,7 +3479,7 @@ operate(struct Configurable *config, int argc, char *argv[])
ourWriteEnv(curl);
#endif
-#ifdef VMS
+#ifdef VMS
if (!config->showerror) {
vms_show = VMSSTS_HIDE;
}
@@ -3617,8 +3617,8 @@ int main(int argc, char *argv[])
#ifdef __NOVELL_LIBC__
pressanykey();
#endif
-#ifdef VMS
- if (res > CURL_LAST) res = CURL_LAST; /* If CURL_LAST exceeded then */
+#ifdef VMS
+ if (res > CURL_LAST) res = CURL_LAST; /* If CURL_LAST exceeded then */
return (vms_cond[res]|vms_show); /* curlmsg.h is out of sync. */
#else
return res;
diff --git a/src/urlglob.c b/src/urlglob.c
index 6bb323218..e4f441b08 100644
--- a/src/urlglob.c
+++ b/src/urlglob.c
@@ -74,19 +74,19 @@ static GlobCode glob_set(URLGlob *glob, char *pattern,
while (1) {
switch (*pattern) {
- case '\0': /* URL ended while set was still open */
+ case '\0': /* URL ended while set was still open */
snprintf(glob->errormsg, sizeof(glob->errormsg),
"unmatched brace at pos %d\n", (int)pos);
return GLOB_ERROR;
case '{':
- case '[': /* no nested expressions at this time */
+ case '[': /* no nested expressions at this time */
snprintf(glob->errormsg, sizeof(glob->errormsg),
"nested braces not supported at pos %d\n", (int)pos);
return GLOB_ERROR;
case ',':
- case '}': /* set element completed */
+ case '}': /* set element completed */
*buf = '\0';
pat->content.Set.elements =
realloc(pat->content.Set.elements,
@@ -103,10 +103,10 @@ static GlobCode glob_set(URLGlob *glob, char *pattern,
/* entire set pattern completed */
int wordamount;
- /* always check for a literal (may be "") between patterns */
+ /* always check for a literal (may be "") between patterns */
if(GLOB_ERROR == glob_word(glob, ++pattern, ++pos, &wordamount))
wordamount=1;
- *amount = pat->content.Set.size * wordamount;
+ *amount = pat->content.Set.size * wordamount;
return GLOB_OK;
}
@@ -116,22 +116,22 @@ static GlobCode glob_set(URLGlob *glob, char *pattern,
++pos;
break;
- case ']': /* illegal closing bracket */
+ case ']': /* illegal closing bracket */
snprintf(glob->errormsg, sizeof(glob->errormsg),
"illegal pattern at pos %d\n", (int)pos);
return GLOB_ERROR;
- case '\\': /* escaped character, skip '\' */
- if (*(buf+1) == '\0') { /* but no escaping of '\0'! */
+ case '\\': /* escaped character, skip '\' */
+ if (*(buf+1) == '\0') { /* but no escaping of '\0'! */
snprintf(glob->errormsg, sizeof(glob->errormsg),
"illegal pattern at pos %d\n", (int)pos);
- return GLOB_ERROR;
+ return GLOB_ERROR;
}
++pattern;
- ++pos; /* intentional fallthrough */
+ ++pos; /* intentional fallthrough */
default:
- *buf++ = *pattern++; /* copy character to set element */
+ *buf++ = *pattern++; /* copy character to set element */
++pos;
}
}
@@ -155,12 +155,12 @@ static GlobCode glob_range(URLGlob *glob, char *pattern,
/* patterns 0,1,2,... correspond to size=1,3,5,... */
++glob->size;
- if (isalpha((int)*pattern)) { /* character range detected */
+ if (isalpha((int)*pattern)) { /* character range detected */
pat->type = UPTCharRange;
if (sscanf(pattern, "%c-%c]", &pat->content.CharRange.min_c,
&pat->content.CharRange.max_c) != 2 ||
- pat->content.CharRange.min_c >= pat->content.CharRange.max_c ||
- pat->content.CharRange.max_c - pat->content.CharRange.min_c > 'z' - 'a') {
+ pat->content.CharRange.min_c >= pat->content.CharRange.max_c ||
+ pat->content.CharRange.max_c - pat->content.CharRange.min_c > 'z' - 'a') {
/* the pattern is not well-formed */
snprintf(glob->errormsg, sizeof(glob->errormsg),
"illegal pattern or range specification after pos %d\n", pos);
@@ -186,17 +186,17 @@ static GlobCode glob_range(URLGlob *glob, char *pattern,
if (sscanf(pattern, "%d-%d]",
&pat->content.NumRange.min_n,
&pat->content.NumRange.max_n) != 2 ||
- pat->content.NumRange.min_n >= pat->content.NumRange.max_n) {
+ pat->content.NumRange.min_n >= pat->content.NumRange.max_n) {
/* the pattern is not well-formed */
snprintf(glob->errormsg, sizeof(glob->errormsg),
"error: illegal pattern or range specification after pos %d\n",
pos);
return GLOB_ERROR;
}
- if (*pattern == '0') { /* leading zero specified */
+ if (*pattern == '0') { /* leading zero specified */
c = pattern;
while (isdigit((int)*c++))
- ++pat->content.NumRange.padlength; /* padding length is set for all
+ ++pat->content.NumRange.padlength; /* padding length is set for all
instances of this pattern */
}
pat->content.NumRange.ptr_n = pat->content.NumRange.min_n;
@@ -248,10 +248,10 @@ static GlobCode glob_word(URLGlob *glob, char *pattern,
/* escape character, skip '\' */
++pattern;
++pos;
- if (*pattern == '\0') /* but no escaping of '\0'! */
- return GLOB_ERROR;
+ if (*pattern == '\0') /* but no escaping of '\0'! */
+ return GLOB_ERROR;
}
- *buf++ = *pattern++; /* copy character to literal */
+ *buf++ = *pattern++; /* copy character to literal */
++pos;
}
*buf = '\0';
@@ -264,7 +264,7 @@ static GlobCode glob_word(URLGlob *glob, char *pattern,
switch (*pattern) {
case '\0':
- break; /* singular URL processed */
+ break; /* singular URL processed */
case '{':
/* process set pattern */
@@ -333,17 +333,17 @@ void glob_cleanup(URLGlob* glob)
int elem;
for (i = glob->size - 1; i < glob->size; --i) {
- if (!(i & 1)) { /* even indexes contain literals */
+ if (!(i & 1)) { /* even indexes contain literals */
free(glob->literal[i/2]);
}
- else { /* odd indexes contain sets or ranges */
+ else { /* odd indexes contain sets or ranges */
if (glob->pattern[i/2].type == UPTSet) {
- for (elem = glob->pattern[i/2].content.Set.size - 1;
+ for (elem = glob->pattern[i/2].content.Set.size - 1;
elem >= 0;
--elem) {
- free(glob->pattern[i/2].content.Set.elements[elem]);
- }
- free(glob->pattern[i/2].content.Set.elements);
+ free(glob->pattern[i/2].content.Set.elements[elem]);
+ }
+ free(glob->pattern[i/2].content.Set.elements);
}
}
}
@@ -372,29 +372,29 @@ char *glob_next_url(URLGlob *glob)
pat = &glob->pattern[i];
switch (pat->type) {
case UPTSet:
- if (++pat->content.Set.ptr_s == pat->content.Set.size) {
- pat->content.Set.ptr_s = 0;
- carry = 1;
- }
- break;
+ if (++pat->content.Set.ptr_s == pat->content.Set.size) {
+ pat->content.Set.ptr_s = 0;
+ carry = 1;
+ }
+ break;
case UPTCharRange:
- if (++pat->content.CharRange.ptr_c > pat->content.CharRange.max_c) {
- pat->content.CharRange.ptr_c = pat->content.CharRange.min_c;
- carry = 1;
- }
- break;
+ if (++pat->content.CharRange.ptr_c > pat->content.CharRange.max_c) {
+ pat->content.CharRange.ptr_c = pat->content.CharRange.min_c;
+ carry = 1;
+ }
+ break;
case UPTNumRange:
- if (++pat->content.NumRange.ptr_n > pat->content.NumRange.max_n) {
- pat->content.NumRange.ptr_n = pat->content.NumRange.min_n;
- carry = 1;
- }
- break;
+ if (++pat->content.NumRange.ptr_n > pat->content.NumRange.max_n) {
+ pat->content.NumRange.ptr_n = pat->content.NumRange.min_n;
+ carry = 1;
+ }
+ break;
default:
- printf("internal error: invalid pattern type (%d)\n", (int)pat->type);
- exit (CURLE_FAILED_INIT);
+ printf("internal error: invalid pattern type (%d)\n", (int)pat->type);
+ exit (CURLE_FAILED_INIT);
}
}
- if (carry) /* first pattern ptr has run into overflow, done! */
+ if (carry) /* first pattern ptr has run into overflow, done! */
return NULL;
}
@@ -404,24 +404,24 @@ char *glob_next_url(URLGlob *glob)
strcpy(buf, lit);
buf += strlen(lit);
}
- else { /* the rest (i odd) are patterns */
+ else { /* the rest (i odd) are patterns */
pat = &glob->pattern[j/2];
switch(pat->type) {
case UPTSet:
- strcpy(buf, pat->content.Set.elements[pat->content.Set.ptr_s]);
- buf += strlen(pat->content.Set.elements[pat->content.Set.ptr_s]);
- break;
+ strcpy(buf, pat->content.Set.elements[pat->content.Set.ptr_s]);
+ buf += strlen(pat->content.Set.elements[pat->content.Set.ptr_s]);
+ break;
case UPTCharRange:
- *buf++ = pat->content.CharRange.ptr_c;
- break;
+ *buf++ = pat->content.CharRange.ptr_c;
+ break;
case UPTNumRange:
- sprintf(buf, "%0*d",
+ sprintf(buf, "%0*d",
pat->content.NumRange.padlength, pat->content.NumRange.ptr_n);
buf += strlen(buf); /* make no sprint() return code assumptions */
- break;
+ break;
default:
- printf("internal error: invalid pattern type (%d)\n", (int)pat->type);
- exit (CURLE_FAILED_INIT);
+ printf("internal error: invalid pattern type (%d)\n", (int)pat->type);
+ exit (CURLE_FAILED_INIT);
}
}
}