Found nothing stange in your code. Maybe the arguments in main:
Code:
if(argv[3] != NULL)
timeoutin = atoi(argv[3]);
else
timeoutin = 0;
result = probe(argv[1],argv[2],timeoutin);
I'm not sure about this but if arg = 1 (no arguments) then argv[1] and above are undefined. You should use the argc argument to check the number of arguments:
Code:
int timeoutin = 0;
if(argv > 3)
timeoutin = atoi(argv[3]);
result = probe(argc > 1 ? argv[1] : NULL, argc > 2 ? argv[2] : NULL);
Tip (not an error):
Code:
result = malloc(sizeof(char) * 100);
//result = strtok(rxbuf,"\n");
strcpy(result,rxbuf);
Can be replaced by: