From: Jean-Marc Pigeon (Delson) Date: Fri, 28 Mar 2025 23:32:02 +0000 (-0400) Subject: Starting to populate feeed00.tst with real directive X-Git-Tag: tag-0.7~50 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=72b986936777fcf580a0eab012ca04916818cace;p=jmp%2Fmailleur Starting to populate feeed00.tst with real directive --- diff --git a/Makefile b/Makefile index 4539da9..257e39c 100644 --- a/Makefile +++ b/Makefile @@ -40,12 +40,12 @@ FEEDPAR = \ $(TESTPORT) \ $(TESTDIR)/$(DATATST)/feed*.tst \ -onefeed : +onefeed : debug @ bin/feeder \ -d3 \ $(TESTIP) \ $(TESTPORT) \ - $(DATATST)/feed00.tst + $(DATATST)/feed*.tst #direct test tstfeed : debug diff --git a/app/feeder.c b/app/feeder.c index 0cf3277..9a98dc6 100644 --- a/app/feeder.c +++ b/app/feeder.c @@ -74,7 +74,6 @@ static void dooutgoing(SOCPTR *socptr,char *line) { (void) soc_writebuffer(socptr,line,strlen(line)); (void) soc_writebuffer(socptr,"\r\n",2); -(void) fprintf(stdout,"JMPDBG sending <%s>\n",line); } /* @@ -88,28 +87,50 @@ static _Bool doincoming(SOCPTR *socptr,int numline,char *line) { #define OPEP "tstfeed.c:doincoming" +#define STRETC "..." _Bool status; char *received; +int tocheck; int phase; _Bool proceed; status=false; received=(char *)0; +tocheck=strlen(line); phase=0; proceed=true; while (proceed==true) { //(void) fprintf(stdout,"JMPDBG %s, phase='%d'\n",OPEP,phase); switch (phase) { - case 0 : //waiting for a line with CRLF + case 0 : //do we have a "..." sequence at the end + if (tocheck>0) { + char *ptr; + + if ((ptr=strstr(line,STRETC))!=(char *)0) { + if (strlen(ptr)==strlen(STRETC)) { + tocheck-=strlen(STRETC); + } + } + } + break; + case 1 : //waiting for a line with CRLF if (tcp_getline(socptr,WAITLINE,&received)==0) { (void) fprintf(stdout,"Unable to receive line in due time\n"); phase=999; //No need to go further } break; - case 1 : //get available character - (void) fprintf(stdout,"Remote say <%s>\n",received); + case 2 : //get available character + if (strncmp(line,received,tocheck)!=0) { + (void) fprintf(stdout,"Line %04d: Error!\n",numline); + (void) fprintf(stdout,"expecting\t'%s'\n",line); + (void) fprintf(stdout,"found\t\t'%s'\n",received); + phase=999; + } received=rou_freestr(received); + break; + case 3 : //everything fine + //(void) fprintf(stdout,"JMPDBG line <%s> OK!\n",line); status=true; break; default : //SAFE Guard @@ -144,20 +165,26 @@ while (proceed==true) { case 0 : //removing first space while ((line[0]==' ')||(line[0]=='\t')) (void) memmove(line,line+1,(strlen(line+1)+1)); + if (line[0]=='#') //line is a comment. + proceed=false;; //discarding line break; - case 1 : //discarding comment + case 1 : //checking if test file format is OK + if (line[1]!=':') { + (void) report(numline,line,"Malformed test data"); + status=false; + proceed=false; //discarding line + } + break; + case 2 : //discarding comment switch (line[0]) { - case '#' : //line is comment - break; - case '<' : //incoming expected - status=doincoming(socptr,numline,line); + case 'R' : //Receiving data + status=doincoming(socptr,numline,line+2); break; - case '>' : //incoming expected - (void) dooutgoing(socptr,line+1); + case 'S' : //sending data + (void) dooutgoing(socptr,line+2); break; default : //Unexpected - line[1]='\000'; - (void) report(numline,line,"unexpected directive"); + (void) report(numline,line+2,"Bigre unexpected directive"); status=false; break; } diff --git a/data-tst/feed00.tst b/data-tst/feed00.tst index 496c008..cac9442 100644 --- a/data-tst/feed00.tst +++ b/data-tst/feed00.tst @@ -3,8 +3,16 @@ #127.127.10.25 emlrcvr ##to have proper reverss-address within test # # comment -# < incoming data -# > outgoing data -quit -0) { char *ptr; diff --git a/lib/modrec.c b/lib/modrec.c index ae8277d..1f07abe 100644 --- a/lib/modrec.c +++ b/lib/modrec.c @@ -55,7 +55,8 @@ for (int i=0;i