Path: utzoo!attcan!uunet!iconsys!tom From: tom@iconsys.UUCP (Tom Kimpton) Newsgroups: comp.lang.fortran Subject: Re: script for interactive fortran test Keywords: script shell fortran fcvs test interactive Message-ID: <231@iconsys.UUCP> Date: 18 May 88 15:20:44 GMT References: <21661@amdcad.AMD.COM> Reply-To: tom@iconsys.UUCP (Tom Kimpton) Organization: Icon Systems and Software Inc., Orem, Utah Lines: 46 In article <21661@amdcad.AMD.COM> katel@amdcad.AMD.COM (Kate Lowenstein) writes: >Has anyone written a shell script to run the Fortran FCVS interactive >test of PAUSE and STOP (test FM257). > >I am attempting to write a Bourne shell script to provide the answers >required by the test, instead of having to type in 'go' five times >myself -- my philosophy is to make the computer do the work, not me. >However, I have so far been unsuccessful in my attempt. It seems >that the system reacts different when the binary is run directly or >from a script. I suspect that the I/O routines are opening up "/dev/tty" rather than the tty line for that terminal (I don't know for sure), or are checking the type of the input for "ttyness". So... try something like the following: main(argc,argv,envp) int argc; char **argv,**envp; { ... parent = fork() if(parent == 0){ exec("fortprog",argv,envp); } else{ fd = open("/dev/tty",O_WRONLY); /* try fd = 0, if this doesn't work, i.e. testing input * for "ttyness" */ fd1 = open("script",O_RDONLY); /* script is your input script */ while(read(fd1,&c,1) > 0) ioctl(fd,TIOCSTI,&c); /* simulate terminal input */ } } This is probably more than you wanted to do but... I hope this helps! -- Tom Kimpton UUCP: {ihnp4,uunet,caeco,nrc-ut}!iconsys!ron Software Development Engineer ARPANET: icon%byuadam.bitnet@cunyvm.cuny.edu Icon International, Inc. BITNET: icon%byuadam.bitnet (multi-user acct) Orem, Utah 84058 PHONE: (801) 225-6888