mirror of
https://github.com/troglobit/finit.git
synced 2026-11-23 20:11:44 +00:00
Add screen_exit() fn to restore screen defaults in debug mode
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
93cd4116db
commit
ddf1bce642
2 files changed
+15
No files matched your search
+14
@@ -157,6 +157,10 @@ char *sanitize(char *arg, size_t len)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Called at boot, and shutdown, to (re)initialize the
|
||||||
|
* screen size for print() et al.
|
||||||
|
*/
|
||||||
void screen_init(void)
|
void screen_init(void)
|
||||||
{
|
{
|
||||||
if (!isatty(STDOUT_FILENO))
|
if (!isatty(STDOUT_FILENO))
|
||||||
@@ -165,6 +169,16 @@ void screen_init(void)
|
|||||||
initscr(&screen_rows, &screen_cols);
|
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:
|
* Local Variables:
|
||||||
* indent-tabs-mode: t
|
* indent-tabs-mode: t
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ char *uptime (long secs, char *buf, size_t len);
|
|||||||
char *sanitize (char *arg, size_t len);
|
char *sanitize (char *arg, size_t len);
|
||||||
|
|
||||||
void screen_init (void);
|
void screen_init (void);
|
||||||
|
void screen_exit (void);
|
||||||
int screen_width (void);
|
int screen_width (void);
|
||||||
|
|
||||||
#endif /* FINIT_UTIL_H_ */
|
#endif /* FINIT_UTIL_H_ */
|
||||||
|
|||||||
Reference in new issue
Block a user