Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
17fb1cc33b
  1. 14
      crypto777/iguana_utils.c
  2. 15
      iguana/exchanges/poloniex.c
  3. 1
      iguana/iguana_peers.c

14
crypto777/iguana_utils.c

@ -542,15 +542,21 @@ void tolowercase(char *str)
char *uppercase_str(char *buf,char *str)
{
strcpy(buf,str);
touppercase(buf);
if ( str != 0 )
{
strcpy(buf,str);
touppercase(buf);
} else buf[0] = 0;
return(buf);
}
char *lowercase_str(char *buf,char *str)
{
strcpy(buf,str);
tolowercase(buf);
if ( str != 0 )
{
strcpy(buf,str);
tolowercase(buf);
} else buf[0] = 0;
return(buf);
}

15
iguana/exchanges/poloniex.c

@ -34,26 +34,35 @@ static char *(*poloniex_baserels)[][2];
char *ALLPAIRS(struct exchange_info *exchange,cJSON *argjson)
{
static int32_t num;
char *jsonstr,*baserel; int32_t i; cJSON *json;
char *jsonstr,*baserel; int32_t i; cJSON *json,*item;
printf("ALLPAIRS num.%d %p\n",num,*poloniex_baserels);
if ( num == 0 || (*poloniex_baserels) == 0 )
{
jsonstr = issue_curl("https://poloniex.com/public?command=returnTicker");
//jsonstr[0] = '[';
//jsonstr[strlen(jsonstr)-1] = ']';
i = 0;
if ( (json= cJSON_Parse(jsonstr)) != 0 )
{
if ( (num= cJSON_GetArraySize(json)) != 0 )
{
poloniex_baserels = calloc(num,sizeof(char *) * 2);
for (i=0; i<num; i++)
item = json->child;
while ( item != 0 )
{
if ( (baserel= get_cJSON_fieldname(jitem(json,i))) != 0 && strncmp(baserel,"BTC_",4) == 0 )
if ( (baserel= item->string) != 0 && strncmp(baserel,"BTC_",4) == 0 && strlen(baserel) > 4 )
{
(*poloniex_baserels)[i][0] = clonestr(baserel+4);
(*poloniex_baserels)[i][1] = "BTC";
i++;
}
item = item->next;
}
}
free_json(json);
}
num = i;
printf("(%s) num.%d\n",jsonstr,num);
free(jsonstr);
}
return(jprint(exchanges777_allpairs((*poloniex_baserels),num),1));

1
iguana/iguana_peers.c

@ -314,6 +314,7 @@ int32_t iguana_socket(int32_t bindflag,char *hostname,uint16_t port)
{
if ( errno == EADDRINUSE )
{
sleep(5);
printf("%s(%s) port.%d try again: %s sock.%d. errno.%d\n",bindflag!=0?"bind":"connect",hostname,port,strerror(errno),sock,errno);
if ( bindflag == 1 )
{

Loading…
Cancel
Save