From c055a2f6a9778f93a8f09b6d820d2504d3fa2601 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Thu, 26 Dec 2019 18:21:44 -0500 Subject: keyboard skeleton, skeleton, rcs, etc --- src/kernel/files.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/kernel/files.c') diff --git a/src/kernel/files.c b/src/kernel/files.c index b42638a..78fe664 100644 --- a/src/kernel/files.c +++ b/src/kernel/files.c @@ -20,14 +20,14 @@ OF THIS SOFTWARE. #include "files.h" uint16_t open_file(uint8_t *name) { - //TODO + return 0;//TODO } void close_file(uint16_t handle) { file_table[handle].first_sector = 0; } -void read_file(uint16_t handle, uint32_t length, void *buffer) { +uint32_t read_file(uint16_t handle, uint32_t length, void *buffer) { //TODO } @@ -40,5 +40,16 @@ void seek_file(uint16_t handle, int32_t by) { } uint32_t get_size(uint16_t handle) { - //TODO + return 0;//TODO +} + +uint32_t read_line_file(uint16_t handle, uint32_t max, void *buffer) { + uint8_t *i = (uint8_t *)buffer; + while (i < (uint8_t *)buffer + max) { + if (!read_file(handle, 1, i) || (*i == (uint8_t)'\n')) { + *i = 0; + return i - (uint8_t *)buffer; + } + ++i; + } } \ No newline at end of file -- cgit v1.2.3