30 #ifdef HAVE_SYS_TYPES_H
31 #include <sys/types.h>
49 #define _MPRINTF_REPLACE
76 #define PASSWORDSIZE 64
86 int specific_login = (login[0] != 0);
88 bool home_alloc =
FALSE;
89 bool netrc_alloc =
FALSE;
93 char state_password=0;
94 char state_our_login=0;
96 #define NETRC DOT_CHAR "netrc"
107 printf(
"NETRC: overridden " NETRC " file: %s\n", home);
108 netrcfile =
override;
117 #if defined(HAVE_GETPWUID) && defined(HAVE_GETEUID)
121 pw= getpwuid(geteuid());
124 home = decc$translate_vms(pw->pw_dir);
144 file = fopen(netrcfile,
"r");
149 char netrcbuffer[256];
151 while(!done && fgets(netrcbuffer,
sizeof(netrcbuffer), file)) {
152 tok=
strtok_r(netrcbuffer,
" \t\n", &tok_buf);
153 while(!done && tok) {
155 if (login[0] && password[0]) {
175 printf(
"HOST: %s\n", tok);
186 if (specific_login) {
187 state_our_login =
strequal(login, tok);
192 printf(
"LOGIN: %s\n", login);
197 else if(state_password) {
198 if (state_our_login || !specific_login) {
201 printf(
"PASSWORD: %s\n", password);
234 int main(
int argc,
char **argv)
242 if(0 == ParseNetrc(argv[1], login, password)) {
243 printf(
"HOST: %s LOGIN: %s PASSWORD: %s\n",
244 argv[1], login, password);
char * curl_getenv(const char *variable)
char * curl_maprintf(const char *format,...)
int Curl_parsenetrc(char *host, char *login, char *password, char *netrcfile)
idCVar password("password","", CVAR_GAME|CVAR_NOCHEAT,"client password used when connecting")