test
This commit is contained in:
@@ -956,7 +956,7 @@ char *parse_conf_line(char *line,char *field)
|
|||||||
|
|
||||||
void komodo_configfile(char *symbol,uint16_t port)
|
void komodo_configfile(char *symbol,uint16_t port)
|
||||||
{
|
{
|
||||||
FILE *fp; char fname[512],buf[128],line[4096],*str,*rpcuser,*rpcpassword,*rpcport;
|
FILE *fp; char fname[512],buf[128],line[4096],*str,*rpcuser,*rpcpassword;
|
||||||
srand((uint32_t)time(NULL));
|
srand((uint32_t)time(NULL));
|
||||||
sprintf(buf,"%s.conf",symbol);
|
sprintf(buf,"%s.conf",symbol);
|
||||||
BITCOIND_PORT = port;
|
BITCOIND_PORT = port;
|
||||||
@@ -987,9 +987,10 @@ void komodo_configfile(char *symbol,uint16_t port)
|
|||||||
fname[strlen(fname)-1] = 0;
|
fname[strlen(fname)-1] = 0;
|
||||||
strcat(fname,".komodo/komodo.conf");
|
strcat(fname,".komodo/komodo.conf");
|
||||||
#endif
|
#endif
|
||||||
|
printf("KOMODO.(%s)\n",fname);
|
||||||
if ( (fp= fopen(fname,"rb")) != 0 )
|
if ( (fp= fopen(fname,"rb")) != 0 )
|
||||||
{
|
{
|
||||||
rpcuser = rpcpassword = rpcport = 0;
|
rpcuser = rpcpassword = 0;
|
||||||
while ( fgets(line,sizeof(line),fp) != 0 )
|
while ( fgets(line,sizeof(line),fp) != 0 )
|
||||||
{
|
{
|
||||||
if ( line[0] == '#' )
|
if ( line[0] == '#' )
|
||||||
@@ -999,22 +1000,12 @@ void komodo_configfile(char *symbol,uint16_t port)
|
|||||||
rpcuser = parse_conf_line(str,(char *)"rpcuser");
|
rpcuser = parse_conf_line(str,(char *)"rpcuser");
|
||||||
else if ( (str= strstr(line,(char *)"rpcpassword")) != 0 )
|
else if ( (str= strstr(line,(char *)"rpcpassword")) != 0 )
|
||||||
rpcpassword = parse_conf_line(str,(char *)"rpcpassword");
|
rpcpassword = parse_conf_line(str,(char *)"rpcpassword");
|
||||||
else if ( (str= strstr(line,(char *)"rpcport")) != 0 )
|
|
||||||
rpcport = parse_conf_line(str,(char *)"rpcport");
|
|
||||||
}
|
}
|
||||||
if ( rpcuser != 0 && rpcpassword != 0 )
|
if ( rpcuser != 0 && rpcpassword != 0 )
|
||||||
{
|
{
|
||||||
sprintf(USERPASS,"%s:%s",rpcuser,rpcpassword);
|
sprintf(USERPASS,"%s:%s",rpcuser,rpcpassword);
|
||||||
}
|
}
|
||||||
if ( rpcport != 0 )
|
printf("rpcuser.(%s) rpcpassword.(%s) USERPASS.(%s) %u\n",rpcuser,rpcpassword,USERPASS,port);
|
||||||
{
|
|
||||||
if ( port != atoi(rpcport) )
|
|
||||||
printf("port.%u mismatch (%s)\n",port,rpcport);
|
|
||||||
//if ( serverport[0] == 0 )
|
|
||||||
// sprintf(serverport,"127.0.0.1:%s",rpcport);
|
|
||||||
free(rpcport);
|
|
||||||
}
|
|
||||||
printf("rpcuser.(%s) rpcpassword.(%s) port.(%s) USERPASS.(%s) port.%u vs %u\n",rpcuser,rpcpassword,rpcport,USERPASS,atoi(rpcport!=0?rpcport:0),port);
|
|
||||||
if ( rpcuser != 0 )
|
if ( rpcuser != 0 )
|
||||||
free(rpcuser);
|
free(rpcuser);
|
||||||
if ( rpcpassword != 0 )
|
if ( rpcpassword != 0 )
|
||||||
|
|||||||
Reference in New Issue
Block a user