Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!purdue!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.std.c Subject: Re: open() prototype Message-ID: <10249@smoke.BRL.MIL> Date: 10 May 89 16:00:23 GMT References: <2775@cps3xx.UUCP> <12864@haddock.ima.isc.com> <1528@mcgill-vision.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 26 In article <1528@mcgill-vision.UUCP> mouse@mcgill-vision.UUCP (der Mouse) writes: >Or is it supposed to be optional and the manpage is wrong? The third argument to open() seems to have first showed up in USG UNIX (e.g. UNIX System III), where it was variadic (required for O_CREAT, not allowed otherwise). This was obviously a mistake. When BSD picked it up, they appear to have documented the third argument as being always required. This was obviously a mistake. IEEE 1003.1 followed the USG UNIX interface, but specified it using a mixture of old-style and prototype declaration syntax. This was obviously a mistake. The best interpretation is that open() really is a variadic-argument function, that the third argument is required for O_CREAT and may be present but is ignored otherwise, and that must be included in applications to obtain the appropriate function declaration. Implementors should declare open() in as follows: #if __STDC__ extern int open( const char *, int, ... ); #else extern int open(); #endif