diff options
author | Daniel Stenberg <daniel@haxx.se> | 2004-10-06 07:50:18 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2004-10-06 07:50:18 +0000 |
commit | 39af394a1c3ae1d8ac71ad263a7c524988702c2e (patch) | |
tree | 4ba44670440d52ff6c3b07fdef35ae3384f3dc5a /lib/netrc.c | |
parent | 5c7dcc6c33bb9e9621cf09ada4a15f310cf1c0e0 (diff) | |
download | curl-39af394a1c3ae1d8ac71ad263a7c524988702c2e.tar.gz |
removed tabs and trailing whitespace from source
Diffstat (limited to 'lib/netrc.c')
-rw-r--r-- | lib/netrc.c | 98 |
1 files changed, 49 insertions, 49 deletions
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); } } |