From: Jean-Marc Pigeon (Delson) Date: Mon, 5 May 2025 19:35:04 +0000 (-0400) Subject: Adding feed directive "W" X-Git-Tag: tag-0.8~138 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=5ada87a3c9f7116370e2bf43a9c62fe498f1ceef;p=jmp%2Fmailleur Adding feed directive "W" --- diff --git a/app/feeder.c b/app/feeder.c index f5a09ff..38c627e 100644 --- a/app/feeder.c +++ b/app/feeder.c @@ -266,7 +266,7 @@ while (proceed==true) { (void) rou_alert(0,"A Signal was received"); phase=999; //No need to go further break; - case -2 : //remot disconnected + case -2 : //remote is disconnected received=rou_freestr(received); received=strdup("Disconnected"); break; @@ -316,10 +316,12 @@ static _Bool scanline(SOCPTR *socptr,int numline,char *line) { #define OPEP "feeder.c:scanline" _Bool status; +char action; int phase; _Bool proceed; status=true; +action='\000'; phase=0; proceed=true; (void) rou_alert(3,"%s line=<%s>",OPEP,line); @@ -337,23 +339,29 @@ while (proceed==true) { status=false; proceed=false; //discarding line } + action=line[0]; + line+=2; break; case 2 : //discarding comment - switch (line[0]) { + switch (action) { case 'C' : //command to execute - status=docommand(socptr,numline,line+2); + status=docommand(socptr,numline,line); break; case 'R' : //Receiving data - status=doincoming(socptr,numline,line+2); + status=doincoming(socptr,numline,line); break; case 'S' : //sending data - (void) dooutgoing(socptr,line+2); + (void) dooutgoing(socptr,line); break; case 'T' : //Get the test titre - status=strncpy(testname,line+2,sizeof(testname)); + status=strncpy(testname,line,sizeof(testname)); + break; + case 'W' : //Wait X second + (void) sleep(atoi(line)); break; default : //Unexpected - (void) report(numline,line+2,"Unexpected directive"); + line-=2; + (void) report(numline,line,"Unexpected directive"); status=false; break; } diff --git a/data-tst/feed00.tst b/data-tst/feed00.tst index de07b5c..e8fa8cf 100644 --- a/data-tst/feed00.tst +++ b/data-tst/feed00.tst @@ -36,5 +36,10 @@ R:250 HELP S:EHLO R:501 5.5.4 syntax error (domain part missing), closing connection. R:Disconnected -#S:QUIT -#R:221 2.0.0 Bye, closing connection... +#------------------------------------------------------------------------- +#prepare next test +#waiting 1 sec +W:1 +#-restarting link +#L:first restart link +#------------------------------------------------------------------------- diff --git a/lib/devsoc.h b/lib/devsoc.h index ff2552b..3ae6bf6 100644 --- a/lib/devsoc.h +++ b/lib/devsoc.h @@ -29,6 +29,9 @@ extern const char *srvr_certs[3]; //reference to a socket definition typedef void SOCPTR; +//reference to a output channel definition +typedef void OUTPTR; + //procedure to parse an email protocol extern PROTYP soc_getprotocol(const char *strproto);