Rev 300 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 300 | Rev 324 | ||
---|---|---|---|
Line 1... | Line -... | ||
1 | #include "kolibc.h" |
- | |
- | 1 | #include "kolibri.h" |
|
2 | #include "kolibri.h" |
2 | #include "kolibc.h" |
- | 3 | ||
Line 3... | Line 4... | ||
3 | 4 | int fsetpos(FILE* f,const fpos_t * pos) |
|
4 | int fsetpos(FILE* f,const fpos_t * pos) |
5 | { int err; |
5 | { int err; |
6 | size_t bytes; |
Line 6... | Line 7... | ||
6 | size_t bytes; |
7 | |
7 | 8 | bytes = *pos; |
|
8 | if (*pos>=0) |
9 | |
9 | { |
10 | bytes= *pos & -8192; |
10 | bytes= *pos & -4096; |
11 | err=read_file(f->filename,f->buffer,bytes, |
11 | err=read_file(f->filename,f->buffer,bytes, |
12 | 8192,&bytes); |
12 | 4096,&bytes); |
13 | if(bytes == -1) |
- | 14 | return EOF; |
|
13 | if (err) return EOF; |
15 | |
14 | if(!bytes) return EOF; |
16 | f->filepos= *pos & -8192; |
15 | f->filepos= *pos & -4096; |
17 | f->strpos = *pos & 8191; |
16 | f->strpos = *pos & 4095; |
18 | f->remain = 8192-f->strpos; |
17 | f->remain = 4096-f->strpos; |
19 | f->stream = f->buffer+f->strpos; |
18 | f->stream = f->buffer+f->strpos; |
20 | return 0; |
19 | return 0; |
- | |
20 | } |
- | |
21 | else |
- | |
22 | return EOF; |
21 | } |
- | 22 |