prepare to introduce output formats

This commit is contained in:
2023-11-03 12:37:33 +03:00
parent 84bfe8b499
commit ac4694375e
5 changed files with 31 additions and 72 deletions

14
main.c
View File

@@ -53,8 +53,6 @@ int main(int argc, char **argv){
}
strcpy(conndev.eol, EOL);
strcpy(conndev.seol, seol);
int eollen = strlen(EOL);
conndev.eollen = eollen;
DBG("eol: %s, seol: %s", conndev.eol, conndev.seol);
if(!G->ttyname){
WARNX("You should point name");
@@ -86,17 +84,7 @@ int main(int argc, char **argv){
int l;
char *buf = ReadData(&l);
if(buf && l > 0){
char *eol = NULL, *estr = buf + l;
do{
eol = strstr(buf, EOL);
if(eol){
*eol = 0;
ShowData(buf);
buf = eol + eollen;
}else{
ShowData(buf);
}
}while(eol && buf < estr);
ShowData(buf);
}else if(l < 0){
pthread_mutex_unlock(&conndev.mutex);
ERRX("Device disconnected");