This commit is contained in:
lsreevatsa 2006-03-08 16:23:11 +00:00
parent 9f52824611
commit 26c54bb7d9

View File

@ -257,19 +257,25 @@ extern "C"
char * GetDefaultWallet()
{
char *homedir = getenv("HOME");;
char *homedir = NULL;
char *defaultwallet = NULL;
defaultwallet = (char *)malloc(MAX_LENGTH);
FILE *fs;
char str[MAX_LENGTH];
char *str1 = "Default Wallet=";
char str[MAX_LENGTH];
FILE *fs = NULL;
int i,j,k;
//cout<<"kwallets_rw.cpp : Home Directory =" << homedir;
defaultwallet = (char *)malloc(MAX_LENGTH);
homedir = (char *)malloc(MAX_LENGTH);
strcpy(homedir, getenv("HOME"));
strcat(homedir, "/.kde/share/config/kwalletrc");
//cout << "\nkwallets_rw.cpp : Home directory full path = " << homedir;
strcat(homedir,"\0");
fs = fopen(homedir,"r");
if(!fs)
if(fs == NULL)
{
free (homedir);
free (defaultwallet);
return "kdewallet";
}
while(!feof(fs))
@ -287,11 +293,13 @@ extern "C"
for(j=i,k=0;j<strlen(str);j++,k++)
defaultwallet[k] = str[j];
defaultwallet[k-1] = '\0';
free(homedir);
return defaultwallet;
}
else
continue;
}
free(homedir);
return "kdewallet";
}