summaryrefslogtreecommitdiff
path: root/src/kernel/files.c
diff options
context:
space:
mode:
authorBenji Dial <Benji3.141@gmail.com>2019-12-26 18:21:44 -0500
committerBenji Dial <Benji3.141@gmail.com>2019-12-26 18:21:44 -0500
commitc055a2f6a9778f93a8f09b6d820d2504d3fa2601 (patch)
treecdaf3f6cc2673571e67ecfde0dbf5b78c78037c2 /src/kernel/files.c
parentdc6b746faa656729de3ffc5b3ec5b087328dbd27 (diff)
downloadportland-os-c055a2f6a9778f93a8f09b6d820d2504d3fa2601.tar.gz
keyboard skeleton, skeleton, rcs, etc
Diffstat (limited to 'src/kernel/files.c')
-rw-r--r--src/kernel/files.c17
1 files changed, 14 insertions, 3 deletions
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