[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

Re: #!/usr/local/bin/wml



On Wed, Mar 03, 1999, Gerfried Fuchs wrote:

> > Yes, shebangs are a feature of the Unix executable loader.
> 
>  So now I'm at the right point ;)  Does the kernel check if the program
> is an ELF-File? 

You mean object file in general. Yes, it has to check the file in the shebang
for this, because when it's an object file it can be directly loaded while in
the other case it has to load the interpreter of this file and execute the
file via this program. But that's the problem: Most of the Unix platforms
don't support shebang-based programs/scripts as interpreters on other
shebang lines.  The reason is obvious: It's a lot more complicated to
resolve, because this way you could have a horrible nested interpreters on
shebang lines.

> Hmmm, is there any way around that problem? Has anyone
> written a wrapper in c for that or anything similar?

Your second question is already the answer to the first one: You need a
wrapper which does nothing more than exec() the shebang-based main program of
wml. Here is a possible program:

| #include <stdio.h>
| #include <unistd.h>
| 
| int main(int argc, char *argv[], char *envv[])
| {
|     execve("/sw/bin/wml", argv, envv);
|     perror("wml:bootstrap");
|     exit(1);
| }

>  I can understand why it's not possible to put a non-binary file in
> there; but sometimes it would be great!

Sure, but it's Unix where you simply can create the above wrapper in 5
minutes and be happy ;-)
                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com
______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com