Per Bothner scripsit:
> Posix is required by various government purchasing requirements, which
> is why even Microsoft sort-of-supports it. (At least Windows NT had a
> "Posix environment", but it was intentionally useless, just to satisfy
> purchasing requirements.)
That's no longer so. Microsoft Windows Services for Unix (which is
licensed from Interix, and which is now a free-as-in-beer download)
provides a full Posix-plus environment. The only problem with it is that
programs running under it *cannot* use any Win32 APIs, because it runs
directly on the NT kernel rather than on top of the Win32 executive,
as Cygwin does.
> Of course Posix is actually a whole slew of standards. Microsoft as
> long supported Posix.1 "natively" in the sense that it is trivially
> available to C programs.
Well, no. Lots of Posix APIs are *not* available to Win32 programs. As a
simple example, select() is only usable on sockets, not on other types of
fd's -- Cygwin has to go through a huge dance to get around that problem.
> I'm not sure what Posix standard covers the "#!" syntax, but it is
> most definitely an established formal standard.
Alas, no.
It is common for different variants of even the same operating
system to have different locations for the desired interpreter. In
the absence of a rigidly standardised filesystem structure
among different Unix systems, this method can also limit the
portability of the file. Thus, it is not uncommon to need to
edit the shebang line after copying a script from one computer
to another because the path that was coded into the script may
not apply on a new machine. For this and other reasons, POSIX
does not standardize the feature.
-- Wikipedia, Shebang (Unix)
The Rationale section of the execve() function in the latest (2004)
edition of Posix.1 says:
Another way that some historical implementations handle shell
scripts is by recognizing the first two bytes of the file as the
character string "#!" and using the remainder of the first line
of the file as the name of the command interpreter to execute.
>From the Posix viewpoint, a text file beginning with "#!" (or on
some systems "#! /" is required) is just another kind of executable
file format, and Posix does not, of course, standardize those.
--
He made the Legislature meet at one-horse John Cowan
tank-towns out in the alfalfa belt, so that cowan_at_ccil.org
hardly nobody could get there and most of http://www.ccil.org/~cowan
the leaders would stay home and let him go --H.L. Mencken's
to work and do things as he pleased. Declaration of Independence
Received on Thu Nov 16 2006 - 14:20:19 UTC