diff --git a/tecs/six.c b/tecs/six.c index 4233443a..fc075447 100644 --- a/tecs/six.c +++ b/tecs/six.c @@ -49,18 +49,25 @@ int CocCreateSockAdr( int readWrite(int fd, int skip) { char msg[128]; int l, i, go, iret, ires, n; - +/* + * read from fd and write to stdout until a key pressed, + * a timeout occured (1 or 5 sec.), or a message + * received. + * skip=0: timeout 1 sec (normal behaviour) + * skip>0: timeout 5 sec. + * skip>1: swallow text + * skip=1,2: return 0 if SICS not found in message text + * skip=3: return 0 if not acknowledged + */ n=0; go=0; ires=0; iret=term_wait_fd(fd, skip?5000:1000); while (iret==1) { ERR_SI(l=recv(fd, msg, sizeof(msg)-1, 0)); - if (l==0) return(0); + /* if (l==0) return(0); */ msg[l]='\0'; - if (skip==4) { - ires=1; - } else if (skip==3) { + if (skip==3) { if (NULL!=strstr(msg, "Acknowledged")) ires=1; } else if (skip==1 || skip==2) { if (NULL!=strstr(msg, "SICS")) ires=1; @@ -81,6 +88,7 @@ int readWrite(int fd, int skip) { if (go) break; iret=term_wait_fd(fd, skip?5000:1000); } + if (n==0 && ires==1) return 1; return ires*n; OnError: return -1; } @@ -139,7 +147,7 @@ int main (int argc, char *argv[]) { printf("rejected\n"); return 0; } - printf("reading welcome message ...\n"); + if (skip==2) printf("reading welcome message ...\n"); if (j==0) { rights=getenv("six_rights"); if (rights!=NULL && 0==strcmp(rights, instr)) { @@ -149,7 +157,7 @@ int main (int argc, char *argv[]) { sprintf(ibuf, "%suser", instr); str_lowcase(ibuf, ibuf); us=ibuf; - ps="02lns1"; + ps="03lns1"; } } sprintf(buf, "config Rights %s %s\r\n", us, ps); @@ -158,13 +166,14 @@ int main (int argc, char *argv[]) { if (!i) { us="Spy"; } - printf("logged in to SICS as %s on %s%s\n", us, instr, sim); + printf("\rlogged in to SICS as %s on %s%s\n", us, instr, sim); +/* if (*sim!='\0') { strcpy(buf, "sync\r\n"); ERR_SI(send(fd, buf, strlen(buf), 0)); - ERR_I(i=readWrite(fd,4)); - printf("synchronized (%d chars read)\n", i); + ERR_I(i=readWrite(fd,1)); } +*/ iret=1; buf[0]='\0'; pos=0; @@ -185,7 +194,7 @@ int main (int argc, char *argv[]) { } fputs("\n", stdout); skip=0; - if (0==strcmp(lbuf,"sync")) skip=4; + if (0==strcmp(lbuf,"sync")) skip=1; l=strlen(buf); /* printf("sent> %s[%d chars]\n", buf, l); @@ -194,9 +203,6 @@ int main (int argc, char *argv[]) { buf[l+1]=10; ERR_SI(send(fd, buf, l+2, 0)); ERR_I(i=readWrite(fd,skip)); - if (skip==4) { - printf("synchronize (%d chars read)\n", i); - } buf[0]='\0'; pos=0; } else if (iret<0) { /* ?? */ diff --git a/tecs/tecs_plot.f b/tecs/tecs_plot.f index 8dbd5f4d..d818a024 100644 --- a/tecs/tecs_plot.f +++ b/tecs/tecs_plot.f @@ -74,6 +74,7 @@ print *,'No PGPLOT-Device defined' goto 9 endif + call sys_setenv('PGPLOT_DEV', device) endif call pgqcol(i,ncol)