*/
/********************************************************/
/* */
-/* Scanning one line from test file */
+/* Reporting a problem with parsing test */
+/* */
+/********************************************************/
+static void report(int numline,char *line,char *trouble)
+
+
+{
+(void) fprintf(stdout,"line %d %s\n",numline,trouble);
+(void) fprintf(stdout,"\t'%s'\n",line);
+}
+/*
+\f
+*/
+/********************************************************/
+/* */
+/* Procedure to send a line to remote */
+/* */
+/********************************************************/
+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);
+}
+/*
+\f
+*/
+/********************************************************/
+/* */
+/* Procedure to compare incoming data with expected*/
/* */
/********************************************************/
-static _Bool scanline(SOCPTR *socptr,char *line)
+static _Bool doincoming(SOCPTR *socptr,int numline,char *line)
{
+#define OPEP "tstfeed.c:doincoming"
_Bool status;
+char *received;
+TIMESPEC attend;
int phase;
_Bool proceed;
status=false;
+received=(char *)0;
+attend.tv_sec=2;
+attend.tv_nsec=0;
+phase=0;
+proceed=true;
+while (proceed==true) {
+ (void) fprintf(stdout,"JMPDBG %s, phase='%d'\n",OPEP,phase);
+ switch (phase) {
+ case 0 : //check for character
+ switch (soc_waitforchar(socptr,&attend)) {
+ case -1 :
+ (void) fprintf(stdout,"JMPDBG wait =-1\n");
+ phase=999;
+ break;
+ case 0 :
+ (void) fprintf(stdout,"JMPDBG wait =0\n");
+ phase=999;
+ break;
+ default :
+ break;
+ }
+ break;
+ case 1 : //get available character
+ break;
+ case 2 : //get avail character
+ if (soc_getnextline(socptr,&received)>0) {
+ (void) fprintf(stdout,"Remote say <%s>\n",received);
+ received=rou_freestr(received);
+ status=true;
+ }
+ break;
+ default : //SAFE Guard
+ proceed=false;
+ break;
+ }
+ phase++;
+ }
+return status;
+}
+/*
+\f
+*/
+/********************************************************/
+/* */
+/* Scanning one line from test file */
+/* */
+/********************************************************/
+static _Bool scanline(SOCPTR *socptr,int numline,char *line)
+
+{
+_Bool status;
+int phase;
+_Bool proceed;
+
+status=true;
phase=0;
proceed=true;
+//(void) fprintf(stdout,"JMPDBG phase='%d' line=<%s>\n",phase,line);
while (proceed==true) {
- //(void) fprintf(stdout,"JMPDBG scanline phase='%d'\n",phase);
switch (phase) {
case 0 : //removing first space
while ((line[0]==' ')||(line[0]=='\t'))
(void) memmove(line,line+1,(strlen(line+1)+1));
break;
case 1 : //discarding comment
- if (line[0]=='#') {
- status=true;
- phase=999; //line is a comment no need to go further
+ switch (line[0]) {
+ case '#' : //line is comment
+ break;
+ case '<' : //incoming expected
+ status=doincoming(socptr,numline,line);
+ break;
+ case '>' : //incoming expected
+ (void) dooutgoing(socptr,line+1);
+ break;
+ default : //Unexpected
+ line[1]='\000';
+ (void) report(numline,line,"unexpected directive");
+ status=false;
+ break;
}
break;
- case 2 : //checking line
- break;
default : //SAFE Guard
proceed=false;
break;
{
_Bool status;
FILE *fichier;
+int numline;
char line[200];
int phase;
_Bool proceed;
status=false;
fichier=(FILE *)0;
+numline=0;
+(void) strcpy(line,"");
phase=0;
proceed=true;
while (proceed==true) {
break;
case 1 : //reading line;
while (fgets(line,sizeof(line),fichier)!=(char *)0) {
- if (scanline(socptr,line)==false) {
+ char *ptr;
+
+ numline++;
+ while ((ptr=strrchr(line,'\n'))!=(char *)0)
+ *ptr='\000';
+ if (scanline(socptr,numline,line)==false) {
phase=999; //Trouble trouble exiting
break;
}
status=0;
params=(ARGTYP *)0;
+foreground=true;
numfile=0;
phase=0;
proceed=true;
switch (phase) {
case 0 : //First prepare a new socket
newsoc=dupsocket(soc);
- soc->handle=-1; //handle within sock not open
if (openplain(newsoc)==false)
//received a termination signal
phase=999; //return a null socket
phase=0;
proceed=true;
while (proceed==true) {
+ //(void) rou_alert(0,"JMPDBG %s phase='%d'",OPEP,phase);
switch (phase) {
case 0 : //sanity check
if (soc==(SOCTYP *)0) {
if (soc!=(SOCTYP *)0) {
struct pollfd polling[1];
- polling[0].events=POLLIN|POLLPRI|POLLERR|POLLHUP;
+ polling[0].events=POLLIN|POLLPRI|POLLHUP;
polling[0].revents=(short)0;
switch (soc->modtls) {
case true :
phase=999; //no need to go further
}
case 1 : //Do we have char available in carpile
+ (void) soc_receive(socptr);
if (soc->carin==0)
phase=999; //No char,no need to check for line
break;