]> git.sur5r.net Git - cc65/blob - libsrc/common/fseek.c
setviewpage was never assembled
[cc65] / libsrc / common / fseek.c
1 /*
2  * fseek.c
3  *
4  * Christian Groessler, 07-Aug-2000
5  */
6
7
8 #include <stdio.h>
9 #include <errno.h>
10 #include <fcntl.h>
11 #include "_file.h"
12
13
14 int fseek(FILE* f, long offset, int whence)
15 {
16     long res;
17
18     /* Is the file open? */
19     if ((f->f_flags & _FOPEN) == 0) {
20         _errno = EINVAL;                /* File not open */
21         return 1;
22     }
23
24     res = lseek(f->f_fd, offset, whence);
25     if (res == -1L) return 1;
26     return 0;
27 }
28