source: trunk/minix/lib/posix/_open.c@ 10

Last change on this file since 10 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 529 bytes
Line 
1#include <lib.h>
2#define open _open
3#include <fcntl.h>
4#include <stdarg.h>
5#include <string.h>
6
7#if _ANSI
8PUBLIC int open(const char *name, int flags, ...)
9#else
10PUBLIC int open(name, flags)
11_CONST char *name;
12int flags;
13#endif
14{
15 va_list argp;
16 message m;
17
18 va_start(argp, flags);
19 if (flags & O_CREAT) {
20 m.m1_i1 = strlen(name) + 1;
21 m.m1_i2 = flags;
22 m.m1_i3 = va_arg(argp, _mnx_Mode_t);
23 m.m1_p1 = (char *) name;
24 } else {
25 _loadname(name, &m);
26 m.m3_i2 = flags;
27 }
28 va_end(argp);
29 return (_syscall(FS, OPEN, &m));
30}
Note: See TracBrowser for help on using the repository browser.