From 8a09b10c1fbdf18710d0ee43c3b656b873be5e24 Mon Sep 17 00:00:00 2001 From: correabuscar Date: Wed, 17 Apr 2024 13:21:34 +0200 Subject: [PATCH] use same indent and flush output in genconstants.c * using tabs as indents, rather than mixture of tabs/spaces * flush stdout/stderr just to be extra safe (wasn't not needed so far) * add commented out segfault-causing line when testing build.rs manually This segfault needs to be done before initscr/endwin or else the terminal seems messed up and you've to run 'reset' to restore it, plus you don't see the outputs properly. --- src/genconstants.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/genconstants.c b/src/genconstants.c index 44987ae..c6cf051 100644 --- a/src/genconstants.c +++ b/src/genconstants.c @@ -4,11 +4,12 @@ #define PCONSTU(ty, NAME) printf("pub const " #NAME ": " #ty " = %llu;\n", (unsigned long long) (NAME)) int main() { - /* some values aren't set until after this is run */ - printf("//"); + /* some values aren't set until after this is run */ + printf("//"); + //fflush(stdout);fflush(stderr);*((int *)0) = 42; //segfault(on purpose for testing purposes) before terminal gets messed up needing a `reset` shell command to restore! initscr(); endwin(); - printf("\n"); + printf("\n"); /* Success/Failure. */ PCONST(i32, ERR); @@ -296,4 +297,7 @@ int main() { PCONSTU(crate::ll::chtype, A_ATTRIBUTES); PCONSTU(crate::ll::chtype, A_CHARTEXT); PCONSTU(crate::ll::chtype, A_COLOR); + + //do last, flush just to be sure! + fflush(stdout);fflush(stderr); }