--- ray/src/rt/devcomm.c 1990/03/12 11:08:44 1.16 +++ ray/src/rt/devcomm.c 1990/10/18 13:33:09 1.19 @@ -28,8 +28,6 @@ static char SCCSid[] = "$SunId$ LBL"; #define vfork fork #endif -extern char *getpath(), *getenv(); - static int comm_close(), comm_clear(), comm_paintr(), comm_errout(), comm_getcur(), comm_comout(), comm_comin(), comm_flush(); @@ -51,7 +49,7 @@ char *dname, *id; int p1[2], p2[2]; char pin[16], pout[16]; /* find driver program */ - if ((devname = getpath(dname, DEVPATH, 1)) == NULL) { + if ((devname = getpath(dname, DEVPATH, X_OK)) == NULL) { stderr_v(dname); stderr_v(": not found\n"); return(NULL); @@ -82,7 +80,7 @@ char *dname, *id; if (getw(devin) != COM_RECVM) return(NULL); /* get driver parameters */ - comm_flush(); + getstate(); /* set error vectors */ cmdvec = comm_comout; if (wrnvec != NULL) @@ -141,11 +139,7 @@ comm_flush() /* flush output to driver */ fflush(devout); if (getc(devin) != COM_FLUSH) reply_error("flush"); - fread((char *)&comm_driver.pixaspect, - sizeof(comm_driver.pixaspect), 1, devin); - comm_driver.xsiz = getw(devin); - comm_driver.ysiz = getw(devin); - comm_driver.inpready = getw(devin); + getstate(); } @@ -172,6 +166,8 @@ char *str; { putc(COM_COMOUT, devout); myputs(str, devout); + if (str[strlen(str)-1] == '\n') + fflush(devout); } @@ -191,7 +187,7 @@ char *prompt; if (getc(devin) != COM_COMIN) reply_error("comin"); mygets(buf, devin); - comm_driver.inpready = getw(devin); + getstate(); } @@ -236,4 +232,15 @@ char *routine; stderr_v(routine); stderr_v(": driver reply error\n"); quit(1); +} + + +static +getstate() /* get driver state variables */ +{ + fread((char *)&comm_driver.pixaspect, + sizeof(comm_driver.pixaspect), 1, devin); + comm_driver.xsiz = getw(devin); + comm_driver.ysiz = getw(devin); + comm_driver.inpready = getw(devin); }