actually this is the function:
PHP Code:
int ExecOrder(char *buf, int acceptfd)
{
char *order;
sscanf(buf, "%s ", order);
if(strcoll(order, "PATH")==0)
{
char *path, *alias;
int Path;
printf("Buf: %s \n", buf);
if(sscanf(buf, "%*s %s %s", path, alias)!=2)
{
ErrorOut(ERR_WRONGPAR);
}
printf("Buf: %s \n",buf);
printf("Path: %s\nAlias: %s\n", path, alias);
if(strcoll(path, "U")==0)
{
Path = 0x04;
}else if(strcoll(path, "IP")==0)
{
Path = 0x10;
}else if(strcoll(path, "I")==0)
{
Path = 0x08;
}else
{
ErrorOut(ERR_WRONGPAR);
}
if(strcoll(alias, "ON")==0)
{
Path = Path || 0x80;
}else if(strcoll(alias, "OFF")==0)
{
Path = Path && 0x79;
}else
{
ErrorOut(ERR_WRONGPAR);
}
SetPath(Path);
msg="OK";
len = strlen(msg);
bytes_sent = send(acceptfd, msg, len, 0);
close(acceptfd);
return 0;
}else if(strcoll(order, "RANGE")==0)
{
char *range;
if(sscanf(buf, "%s %s", order, range)!=2)
{
ErrorOut(ERR_WRONGPAR);
}
if(strcoll(range, "20A")==0)
{
SetRANGE(0xc1);
}else if(strcoll(range, "10A")==0)
{
SetRANGE(0xc2);
}else if(strcoll(range, "1A")==0)
{
SetRANGE(0xc3);
}else if(strcoll(range, "100mA")==0)
{
SetRANGE(0xc4);
}else if(strcoll(range, "10mA")==0)
{
SetRANGE(0xc5);
}else if(strcoll(range, "1mA")==0)
{
SetRANGE(0xc6);
}else
{
ErrorOut(ERR_WRONGPAR);
}
msg="OK";
len = strlen(msg);
bytes_sent = send(acceptfd, msg, len, 0);
close(acceptfd);
return 0;
}
ErrorOut(ERR_UNKNOWNCMD);
}
the strange thing is, that the range part is working perfectly, while the path is making that problems.
I really appreciate that you try to help me, thanks.