🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #6017

Re: open() prototype

#6017
From: Doug Gwyn
Date: Wed, 10 May 1989 16:00
26 lines
1527 bytes
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 <fcntl.h> must be included
in applications to obtain the appropriate function declaration.

Implementors should declare open() in <fcntl.h> as follows:

#if __STDC__
	extern int open( const char *, int, ... );
#else
	extern int open();
#endif
Technical Details
Message-ID: <10249@smoke.BRL.MIL>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!purdue!haven!adm!smoke!gwyn
References: <2775@cps3xx.UUCP> <12864@haddock.ima.isc.com> <1528@mcgill-vision.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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