1 /* open.c: The __opieopen() library function.
4 This software is Copyright 1996-2001 by Craig Metz, All Rights Reserved.
5 The Inner Net License Version 3 applies to this software.
6 You should have received a copy of the license with this software. If
7 you didn't get a copy, you may request one from <license@inner.net>.
11 Modified by cmetz for OPIE 2.4. More portable way to get the mode
13 Created by cmetz for OPIE 2.3.
18 #include <sys/types.h>
21 #endif /* HAVE_UNISTD_H */
28 #define lstat(x, y) stat(x, y)
29 #endif /* !HAVE_LSTAT */
31 FILE *__opieopen
FUNCTION((file
, rw
, mode
), char *file AND
int rw AND
int mode
)
36 if (lstat(file
, &st
)) {
40 if (!(f
= fopen(file
, "w")))
45 if (chmod(file
, mode
))
52 if (!S_ISREG(st
.st_mode
))
72 if (!(f
= fopen(file
, fmode
)))