Path: utzoo!utgpu!water!watmath!clyde!rutgers!ukma!david From: david@ms.uky.edu (David Herron -- Resident E-mail Hack) Newsgroups: comp.sys.amiga Subject: Re: Suggestion for assignment of another protection bit Message-ID: <7952@g.ms.uky.edu> Date: 25 Dec 87 01:07:06 GMT References: <8712240640.AA24010@cory.Berkeley.EDU> <37368@sun.uucp> Reply-To: david@ms.uky.edu (David Herron -- Resident E-mail Hack) Organization: U of Kentucky, Mathematical Sciences Lines: 36 In article <37368@sun.uucp> cmcmanis@sun.UUCP (Chuck McManis) writes: >In article <8712240640.AA24010@cory.Berkeley.EDU> (Matt Dillon) writes: >> As far as execution goes, why not adopt the UNIX standard: >> >>#!C:EXECUTE (as the first line in file) > >But Matt even on UNIX the shell does this, not the O/S. You could use the >same technique that csh uses, check the file to see if it is a binary >file (read the first 'hunk header') and look for non ascii characters. >If binary run it as is, if it is text then check the first line for a >processor name and prepend that to the arglist and then try to run it >again (now executing the shell). A binary/text bit would be nice to >speed this up. (This would also make TYPE default to HEX mode.) er... I suggest you look again. BSD (from 4.2 on) does what Matt suggested. That is ... when exec()'s happens on a script file, the KERNAL reads the first couple of bytes to get the magic number. If the magic number is "#!" then it does the script file processing which includes: 1) read the rest of the line 2) get the first "word" and use that as the file to really exec(). 3) use the rest of the line as the first argument to the program in 2. 4) arrange for the script file to be on the standard input of the exec'd process 5) exec the program named in 2. I forget exactly where this is in the kernal, but it IS in the kernal because I saw it there once :-). -- <---- David Herron -- The E-Mail guy <---- or: {rutgers,uunet,cbosgd}!ukma!david, david@UKMA.BITNET <---- <---- Winter health warning: Remember, don't eat the yellow snow!