From 8700224e98f95807d896d214380796e6f80678d0 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 23 Nov 2025 13:58:37 -0500 Subject: use exit() instead of _exit() --- src/stdlib/stdlib.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/stdlib/stdlib.h') diff --git a/src/stdlib/stdlib.h b/src/stdlib/stdlib.h index e52b5cd1..aadce27c 100644 --- a/src/stdlib/stdlib.h +++ b/src/stdlib/stdlib.h @@ -30,7 +30,7 @@ void tomo_init(void); else fputs("\n", stderr); \ fflush(stderr); \ raise(SIGABRT); \ - _exit(1); \ + exit(1); \ }) #define fail_source(filename, start, end, ...) \ @@ -50,7 +50,7 @@ void tomo_init(void); if (USE_COLOR) fputs("\x1b[m", stderr); \ fflush(stderr); \ raise(SIGABRT); \ - _exit(1); \ + exit(1); \ }) _Noreturn void fail_text(Text_t message); -- cgit v1.2.3 From 2a24b0a3fc3c4986572ae2c4ea0e8e387497a7f6 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 23 Nov 2025 14:19:04 -0500 Subject: Add `at_cleanup()` function --- src/stdlib/stdlib.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/stdlib/stdlib.h') diff --git a/src/stdlib/stdlib.h b/src/stdlib/stdlib.h index aadce27c..392b5f23 100644 --- a/src/stdlib/stdlib.h +++ b/src/stdlib/stdlib.h @@ -16,9 +16,12 @@ extern bool USE_COLOR; extern Text_t TOMO_VERSION_TEXT; void tomo_init(void); +void tomo_at_cleanup(Closure_t fn); +void tomo_cleanup(void); #define fail(...) \ ({ \ + tomo_cleanup(); \ fflush(stdout); \ if (USE_COLOR) fputs("\x1b[31;7m ==================== ERROR ==================== \033[m\n\n", stderr); \ else fputs("==================== ERROR ====================\n\n", stderr); \ @@ -35,6 +38,7 @@ void tomo_init(void); #define fail_source(filename, start, end, ...) \ ({ \ + tomo_cleanup(); \ fflush(stdout); \ if (USE_COLOR) fputs("\x1b[31;7m ==================== ERROR ==================== \n\n\x1b[0;1m", stderr); \ else fputs("==================== ERROR ====================\n\n", stderr); \ -- cgit v1.2.3 From 08c47e1fabd1a2fb43c18828db8ad845f7db3a99 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 7 Dec 2025 23:08:08 -0500 Subject: More correct handling for sleep() --- src/stdlib/stdlib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/stdlib/stdlib.h') diff --git a/src/stdlib/stdlib.h b/src/stdlib/stdlib.h index 392b5f23..3afe3529 100644 --- a/src/stdlib/stdlib.h +++ b/src/stdlib/stdlib.h @@ -79,6 +79,6 @@ Text_t ask(Text_t prompt, bool bold, bool force_tty); _Noreturn void tomo_exit(Text_t text, int32_t status); Closure_t spawn(Closure_t fn); -void sleep_num(double seconds); +void sleep_seconds(double seconds); OptionalText_t getenv_text(Text_t name); void setenv_text(Text_t name, Text_t value); -- cgit v1.2.3