pweingar / FoenixMCP

A portable kernel for the Foenix series of computers.
BSD 3-Clause "New" or "Revised" License
10 stars 5 forks source link

Add SEEK_END origin to sys_chan_seek. #8

Closed daschewie closed 3 years ago

daschewie commented 3 years ago

The fseek function in C is implemented using the sys_chan_seek system call. Currently sys_chan_seek only supports absolute and cursor relative positioning.

We would like support for EOF relative positioning, like the SEEK_END feature of fseek.: https://www.tutorialspoint.com/c_standard_library/c_function_fseek.htm

Example Usage:

fseek(f, -100, SEEK_END); // moves to 100 chars from the end.

pweingar commented 3 years ago

That should be doable without too much trouble.

pweingar commented 3 years ago

Take a look at issue_8 branch and see if that will meet your needs. I haven't tried it, because this build won't run on my K, but it compiles and shouldn't break anything.

daschewie commented 3 years ago

The code in the issue_8 branch looks great, thanks for the quick turn around.

daschewie commented 3 years ago

This was merged in pr#10