Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4921 Serge 1
 
2
#include 
3
#include 
4
#include 
5
#include "glue.h"
6
#include "io.h"
7
8
 
9
 
10
_DEFUN (lseek, (fd, pos, whence),
11
     int fd _AND
12
     _off_t pos _AND
13
     int whence)
14
15
 
16
    fileinfo_t  info;
17
    __io_handle *ioh;
18
    _off_t ret;
19
20
 
21
    {
22
        errno = EBADF;
23
        return (-1);
24
    };
25
26
 
27
28
 
29
    {
30
        case SEEK_SET:
31
            ret = pos;
32
            break;
33
        case SEEK_CUR:
34
            ret = ioh->offset + pos;
35
            break;
36
        case SEEK_END:
37
        {
38
            get_fileinfo(ioh->name, &info);
39
            ret = pos + info.size;
40
            break;
41
        }
42
        default:
43
            errno = EINVAL;
44
            return (-1);
45
    };
46
47
 
48
49
 
50
};
51