Skip to content

Commit

Permalink
use same indent and flush output in genconstants.c
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
correabuscar committed Apr 17, 2024
1 parent 606a7cc commit 8a09b10
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/genconstants.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

0 comments on commit 8a09b10

Please sign in to comment.