From 5fcf57739e68a8b5053e03778aaee0eed445babd Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Thu, 11 Mar 2021 22:00:22 -0500 Subject: settings editor, and lots of changes in service of that --- src/kernel/settings.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/kernel/settings.c') diff --git a/src/kernel/settings.c b/src/kernel/settings.c index 699196b..419341a 100644 --- a/src/kernel/settings.c +++ b/src/kernel/settings.c @@ -36,6 +36,11 @@ struct main_entry { static file_id_t fid; static uint32_t main_end; +void close_settings() { + drives->free_file(drives, fid); + fid = 0; +} + void init_settings() { fid = drives->get_file(drives, SETTINGS_FILE); if (!fid) @@ -47,6 +52,9 @@ void init_settings() { } bool try_find_setting(const char *name, struct main_entry *entry_out) { + if (!fid) + PANIC("setting requested after settings file closed"); + uint16_t name_len = 0; while (name[name_len]) if (++name_len == 256) -- cgit v1.2.3