argc[argv] and Berknet
gwyn%brl-vld at sri-unix.UUCP
gwyn%brl-vld at sri-unix.UUCP
Fri Dec 9 02:44:42 AEST 1983
From: Doug Gwyn (VLD/VMB) <gwyn at brl-vld>
There is no mystery about argc[argv] = 0;
pre-7th Edition PDP-11 UNIX exec marked the end of the arguments with
a 16-bit constant -1 and newer UNIXes mark the end of the argument list
with a (char *)0. The run-time start-off looks for this terminator to
determine argc to pass to main(). The above code merely patches a 6th
Edition image so that *argv++ can be easily used to pick up arguments
and test for the last argument. (Not recommended.)
More information about the Comp.unix
mailing list