ver 0.1.3: fixed bug with UNIX-sockets

This commit is contained in:
2024-01-31 12:13:25 +03:00
parent 8325f811e7
commit ffdc740f5c
5 changed files with 23 additions and 10 deletions

10
main.c
View File

@@ -59,12 +59,18 @@ int main(int argc, char **argv){
signals(0);
}
conndev.name = strdup(G->ttyname);
conndev.port = strdup(G->port);
DBG("device name: %s", conndev.name);
if(G->socket){
if(!G->port) conndev.type = DEV_UNIXSOCKET;
else conndev.type = DEV_NETSOCKET;
else{
conndev.port = strdup(G->port);
conndev.type = DEV_NETSOCKET;
}
DBG("socket port=%s, type=%d", conndev.port, conndev.type);
}else{
conndev.speed = G->speed;
conndev.port = strdup(G->serformat); // `port` of tty is serial format
DBG("speed=%d, format=%s", conndev.speed, conndev.port);
}
if(!opendev(&conndev, G->dumpfile)){
signals(0);