It is possible if it can be implemented as a function with a variable
argument list, like this:
| #if defined(__STDC__)
|
| extern int fcntl(int, int, ...);
| extern int open(const char *, int, ...);
The open() function only needs to look at the third argument (mode) if
a certain bit (O_CREAT) is set in the second argument (flags).
No non-standard extensions are required.
D'oh. I should have paid more attention to the parameter lists. Even
ISO standard C functions (printf, fprint, ...) work that way. Thanks to
all who replied.
One further question: Since AFAIK ISO standard C provides no way to
explicitly check the length of the varargs list, how does open() know
whether the "mode" argument was supplied or not? Or does it even need
to?
--
/-- Joona Palaste (
[email protected]) ------------- Finland --------\
\--
http://www.helsinki.fi/~palaste --------------------- rules! --------/
"I said 'play as you've never played before', not 'play as IF you've never
played before'!"
- Andy Capp