aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2001-05-29 19:17:39 +0000
committerDaniel Stenberg <daniel@haxx.se>2001-05-29 19:17:39 +0000
commitd567659bf4003c0808c309a52100a32a82a4b128 (patch)
tree1d51d055db3cb063c8186d49c8000e6a71cc7134 /lib
parente0558ae541d94c1d183d2cb67c5edf120ba6974b (diff)
strtok() replaced with strtok_r()
Diffstat (limited to 'lib')
-rw-r--r--lib/cookie.c5
-rw-r--r--lib/netrc.c5
-rw-r--r--lib/url.c5
3 files changed, 9 insertions, 6 deletions
diff --git a/lib/cookie.c b/lib/cookie.c
index 6fa35d783..f15a3223e 100644
--- a/lib/cookie.c
+++ b/lib/cookie.c
@@ -199,6 +199,7 @@ Curl_cookie_add(struct CookieInfo *c,
/* This line is NOT a HTTP header style line, we do offer support for
reading the odd netscape cookies-file format here */
char *firstptr;
+ char *tok_buf;
int fields;
if(lineptr[0]=='#') {
@@ -214,7 +215,7 @@ Curl_cookie_add(struct CookieInfo *c,
if(ptr)
*ptr=0; /* clear it */
- firstptr=strtok(lineptr, "\t"); /* first tokenize it on the TAB */
+ firstptr=strtok_r(lineptr, "\t", &tok_buf); /* first tokenize it on the TAB */
/* Here's a quick check to eliminate normal HTTP-headers from this */
if(!firstptr || strchr(firstptr, ':')) {
@@ -224,7 +225,7 @@ Curl_cookie_add(struct CookieInfo *c,
/* Now loop through the fields and init the struct we already have
allocated */
- for(ptr=firstptr, fields=0; ptr; ptr=strtok(NULL, "\t"), fields++) {
+ for(ptr=firstptr, fields=0; ptr; ptr=strtok_r(NULL, "\t", &tok_buf), fields++) {
switch(fields) {
case 0:
co->domain = strdup(ptr);
diff --git a/lib/netrc.c b/lib/netrc.c
index 6a712d4fd..b7ffc1b4a 100644
--- a/lib/netrc.c
+++ b/lib/netrc.c
@@ -111,8 +111,9 @@ int Curl_parsenetrc(char *host,
file = fopen(netrcbuffer, "r");
if(file) {
char *tok;
+ char *tok_buf;
while(fgets(netrcbuffer, sizeof(netrcbuffer), file)) {
- tok=strtok(netrcbuffer, " \t\n");
+ tok=strtok_r(netrcbuffer, " \t\n", &tok_buf);
while(tok) {
switch(state) {
case NOTHING:
@@ -163,7 +164,7 @@ int Curl_parsenetrc(char *host,
}
break;
} /* switch (state) */
- tok = strtok(NULL, " \t\n");
+ tok = strtok_r(NULL, " \t\n", &tok_buf);
} /* while (tok) */
} /* while fgets() */
diff --git a/lib/url.c b/lib/url.c
index 726e259ca..55d4463c8 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -1560,6 +1560,7 @@ static CURLcode Connect(struct UrlData *data,
* checked if the lowercase versions don't exist.
*/
char *no_proxy=NULL;
+ char *no_proxy_tok_buf;
char *proxy=NULL;
char proxy_env[128];
@@ -1571,7 +1572,7 @@ static CURLcode Connect(struct UrlData *data,
/* NO_PROXY wasn't specified or it wasn't just an asterisk */
char *nope;
- nope=no_proxy?strtok(no_proxy, ", "):NULL;
+ nope=no_proxy?strtok_r(no_proxy, ", ", &no_proxy_tok_buf):NULL;
while(nope) {
if(strlen(nope) <= strlen(conn->name)) {
char *checkn=
@@ -1581,7 +1582,7 @@ static CURLcode Connect(struct UrlData *data,
break;
}
}
- nope=strtok(NULL, ", ");
+ nope=strtok_r(NULL, ", ", &no_proxy_tok_buf);
}
if(!nope) {
/* It was not listed as without proxy */