isblank() implementation.
[minix.git] / lib / libc / posix / _fcntl.c
blob5d3ecc94eeaf3f01a02e55e095861b468f8cb9bf
1 #include <lib.h>
2 #define fcntl _fcntl
3 #include <fcntl.h>
4 #include <stdarg.h>
6 #if _ANSI
7 PUBLIC int fcntl(int fd, int cmd, ...)
8 #else
9 PUBLIC int fcntl(fd, cmd)
10 int fd;
11 int cmd;
12 #endif
14 va_list argp;
15 message m;
17 va_start(argp, cmd);
19 /* Set up for the sensible case where there is no variable parameter. This
20 * covers F_GETFD, F_GETFL and invalid commands.
22 m.m1_i3 = 0;
23 m.m1_p1 = NIL_PTR;
25 /* Adjust for the stupid cases. */
26 switch(cmd) {
27 case F_DUPFD:
28 case F_SETFD:
29 case F_SETFL:
30 m.m1_i3 = va_arg(argp, int);
31 break;
32 case F_GETLK:
33 case F_SETLK:
34 case F_SETLKW:
35 case F_FREESP:
36 m.m1_p1 = (char *) va_arg(argp, struct flock *);
37 break;
40 /* Clean up and make the system call. */
41 va_end(argp);
42 m.m1_i1 = fd;
43 m.m1_i2 = cmd;
44 return(_syscall(FS, FCNTL, &m));