Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 29 Apr 2012 09:02:44 -0500 Message-ID: <4F9D4A06.1F4@mindspring.com> Date: Sun, 29 Apr 2012 10:02:46 -0400 From: pete Reply-To: pfiland@mindspring.com Organization: PF X-Mailer: Mozilla 3.04Gold (WinNT; I) MIME-Version: 1.0 Newsgroups: comp.lang.c Subject: Re: A short-but-bizarre program that shouldn't work but does. References: <4F9C7FE7.1103@mindspring.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 38 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 4.154.222.63 X-Trace: sv3-zkV4O7+5x0Jxx9E2hbHY/neWaFMLxMYz8Q+V/hactfi2juo2jA+5sc8lOY1vhcY4J3OlML+R2AGQT4t!ZqwOE7OIeFyHiV+q9cEg9qW3NqioxUTY2OSi9lZsaBUGxMBogr9IRbnDPy03OR2tYAySGvMSS4ux!MrMnnMGN X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2353 Xref: csiph.com comp.lang.c:20051 Robbie Hatley wrote: > > Regarding "int main(int argc, char **argv, char **envp)", > "Pete" writes: > > > It's called a "Common extension". > > > > ISO/IEC 9899:1999 (E) > > > > Annex J > > (informative) > > Portability issues > > 1 This annex collects some information about portability > > that appears in this International Standard. > > > > J.5 Common extensions > > > > J.5.1 Environment arguments > > 1 In a hosted environment, > > the main function receives a third argument, > > char *envp[], > > that points to a null-terminated array of pointers to char, > > each of which points to a string > > that provides information about the environment > > for this execution of the program (5.1.2.2.1). > > Ah-ha! Thanks so much for the explanation. Obviously, then, > this program's author made use of that, and my OS (Win-XP) > and compiler (DJGPP's port of GCC) do support that, so when > I compile it and run it, it works as intended. Not portable, > but on my setup works quite well. Could be useful for certain > file maintenance utilities I write from time to time if they > need to look at an environmental variable in real time. You're welcome. -- pete