Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!lll-winken!taco!hobbes.catt.ncsu.edu!kdarling From: kdarling@hobbes.catt.ncsu.edu (Kevin Darling) Newsgroups: comp.os.os9 Subject: Re: Can't execute "J" - Error #000: 216 Message-ID: <1991Jun18.235439.6486@ncsu.edu> Date: 18 Jun 91 23:54:39 GMT References: <1991Jun14.202821.20308@unhd.unh.edu> <1991Jun15.001249.5963@ncsu.edu> <1991Jun18.033225.12476@mmm.serc.3m.com> <1991Jun18.184533.1648@urz.unibas.ch> Sender: news@ncsu.edu (USENET News System) Organization: North Carolina State University Lines: 45 balmer@urz.unibas.ch writes: >Someone proposed to write a program called "J" which would be executed in >this case. The program J will actually execute, the problem is that the >shell tries to execute the next bytes of the binary file. You then get an >error message like "Error 216: can't execute verflow". Good point. The shell will execute "J", and then try to use the next bytes (after the max readln point, or after a $0D seen as readln delimiter) in the originally named binary file (which shell thought was a script file) as a new script line. This brings up a neat trick with shell scripts tho. The thing to remember is that whenever a script line is executed, the standard input of the called program (assuming no "<" redirection is done) is the file itself... which in this case is the binary module! Thus the program called "J" has a standard input conduit to the binary file. Now all it has to do is to Seek its standard input path (0) to the end of the binary, and voila... when J ends, its parent shell thinks the "script" is at the end of file and exits. In BASIC, such a program would be... PROCEDURE J DIM modsize:INTEGER SEEK #0,4 \ (* seek to module size location in header GET #0,modsize \ (* read in module size SEEK #0,modsize-1 \ (* seek to end of module/"file" PRINT "You are trying to execute a module" PRINT "from within your current data dir " END The J program could even look up the name of the target binary, and perhaps load and/or execute it. This standard input trick also allows you to write commands which loop and do other "goto"-ish moves within a script file... by doing a Seek to wherever you'd like your calling shell to continue from. The simplest example is a program which repeats the script file: PROCEDURE rewind SEEK #0,0 END Put that at the end of your script, and it'll execute over and over. best - kevin