1 /* reset.c - reset the terminal.
2  *
3  * Copyright 2015 Rob Landley <rob@landley.net>
4  *
5  * No standard.
6 
7 USE_RESET(NEWTOY(reset, 0, TOYFLAG_USR|TOYFLAG_BIN))
8 
9 config RESET
10   bool "reset"
11   default y
12   help
13     usage: reset
14 
15     reset the terminal
16 */
17 #include "toys.h"
18 
reset_main(void)19 void reset_main(void)
20 {
21   int fd = tty_fd();
22 
23   // man 4 console_codes: reset terminal is ESC (no left bracket) c
24   xwrite(fd<0 ? 1 : fd, "\033c", 2);
25 }
26