Squash commits for public release
This commit is contained in:
32
userland/utilities/edit/lifetime.c
Normal file
32
userland/utilities/edit/lifetime.c
Normal file
@@ -0,0 +1,32 @@
|
||||
#include "lifetime.h"
|
||||
#ifndef __xOS__
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
struct termios orig_term;
|
||||
|
||||
void enable_raw_mode()
|
||||
{
|
||||
struct termios raw;
|
||||
tcgetattr(STDIN, &raw);
|
||||
orig_term = raw;
|
||||
raw.c_lflag &= ~(ECHO | ICANON);
|
||||
tcsetattr(STDIN, TCSAFLUSH, &raw);
|
||||
}
|
||||
|
||||
void restore_termios()
|
||||
{
|
||||
tcsetattr(STDIN, TCSAFLUSH, &orig_term);
|
||||
}
|
||||
|
||||
void exit_app()
|
||||
{
|
||||
restore_termios();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void crash_app()
|
||||
{
|
||||
restore_termios();
|
||||
exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user