Passing arguments to C programs
Doug Gwyn
gwyn at brl-smoke.ARPA
Sun Feb 16 17:08:02 AEST 1986
In article <177 at decvax.UUCP> minow at decvax.UUCP (Martin minow) writes:
>In <814 at brl-smoke.ARPA>, gwyn at brl-smoke.ARPA (Doug Gwyn) writes:
>
>>In a hosted (as opposed to stand-alone) environment, yes, C requires
>>that programs be able to obtain arguments specified at the time they
>>are run.
>
>There is nothing in the C language that requires command line argument
>passing. This is solely a feature of the Unix shell. It can be
>quite difficult to do on some operating systems which have different
>assumptions about the way in which programs interact with their users.
>(I speak from the experience of implementing command line argument
>passing on at least 5 non-Unix operating systems.)
>
>Other features of the shell (such as I/O redirection, filename wildcard
>expansion, and the particular syntax of arguments) are equally not
>a part of the language.
>
>That developers have chosen to implement these features of the Unix
>command language speaks more for the desire to be compatibile with
>existing program usage -- it is not necessarily a good thing.
Read my lips. Did I say "command line arguments"? No, I said
"arguments specified at the time the programs are run". As the
Software Tools (aka Virtual Operating System) project has shown,
these can be provided on practically every significant operating
system in wide use today. I didn't even mention shell features.
The requirements for a hosted C environment are given in section
B.1.2.2 of the X3J11 draft standard. The exact meaning of args
other than the zeroth (program name) is not completely spelled
out, but there is a strong implication that the environment must
be able to supply them to a C program at start-up. This would
not be required of a freestanding environment C implementation,
of course.
I don't see why you say that availability of UNIX shell features
is not a Good Thing; the temporary lack of them in a system I am
testing is that system's biggest deficiency. In any case, that
is all irrelevant in a discussion about C.
More information about the Comp.lang.c
mailing list