Add screen_exit() fn to restore screen defaults in debug mode

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2018-01-23 09:31:44 +01:00
1 parent 93cd4116db
commit ddf1bce642
2 files changed
+15

No files matched your search

+14
View File
@@ -157,6 +157,10 @@ char *sanitize(char *arg, size_t len)
return NULL;
}
/*
* Called at boot, and shutdown, to (re)initialize the
* screen size for print() et al.
*/
void screen_init(void)
{
if (!isatty(STDOUT_FILENO))
@@ -165,6 +169,16 @@ void screen_init(void)
initscr(&screen_rows, &screen_cols);
}
/*
* Called when debug mode is enabled to revert back
* to old-school safe defaults.
*/
void screen_exit(void)
{
screen_rows = 24;
screen_cols = 80;
}
/**
* Local Variables:
* indent-tabs-mode: t
+1
View File
@@ -48,6 +48,7 @@ char *uptime (long secs, char *buf, size_t len);
char *sanitize (char *arg, size_t len);
void screen_init (void);
void screen_exit (void);
int screen_width (void);
#endif /* FINIT_UTIL_H_ */