aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2003-08-20 15:40:21 +0000
committerDaniel Stenberg <daniel@haxx.se>2003-08-20 15:40:21 +0000
commitafc6ade2b909d44ab54af13ee172c09db3737c7b (patch)
tree80ee7bdfd0eca6ec5ea828473bee57e2645271e5
parent734e8d62292db6ca73f1167c96a3a457ee00b791 (diff)
removed the goto and re-indented slightly
-rw-r--r--lib/netrc.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/netrc.c b/lib/netrc.c
index e15263344..ed5d70252 100644
--- a/lib/netrc.c
+++ b/lib/netrc.c
@@ -146,13 +146,17 @@ int Curl_parsenetrc(char *host,
file = fopen(netrcbuffer, "r");
if(file) {
char *tok;
- char *tok_buf;
- while(fgets(netrcbuffer, sizeof(netrcbuffer), file)) {
+ char *tok_buf;
+ bool done=FALSE;
+
+ while(!done && fgets(netrcbuffer, sizeof(netrcbuffer), file)) {
tok=strtok_r(netrcbuffer, " \t\n", &tok_buf);
- while(tok) {
+ while(!done && tok) {
- if (login[0] && password[0])
- goto done;
+ if (login[0] && password[0]) {
+ done=TRUE;
+ break;
+ }
switch(state) {
case NOTHING:
@@ -182,7 +186,8 @@ int Curl_parsenetrc(char *host,
if(state_login) {
if (specific_login) {
state_our_login = strequal(login, tok);
- }else{
+ }
+ else {
strncpy(login, tok, LOGINSIZE-1);
#ifdef _NETRC_DEBUG
printf("LOGIN: %s\n", login);
@@ -215,7 +220,6 @@ int Curl_parsenetrc(char *host,
} /* while (tok) */
} /* while fgets() */
-done:
fclose(file);
}