Mercurial > hg > toybox
view toys/pending/reset.c @ 1775:57f2a26fa92c draft toast
To ensure that toybox can be installed alongside busybox without
confusing update-alternatives, the paths of the links installed by toybox should
match those installed by busybox. This is accomplished by changing the flags
of a few tools within toybox.
author | Paul Barker <paul@paulbarker.me.uk> |
---|---|
date | Sat, 04 Apr 2015 11:58:06 -0500 |
parents | fd0a595f5486 |
children |
line wrap: on
line source
/* reset.c - A program to reset the terminal. * * Copyright 2014 Ashwini Kumar <ak.ashwini@gmail.com> * Copyright 2014 Kyungwan Han <asura321@gmail.com> * * No Standard. USE_RESET(NEWTOY(reset, NULL, TOYFLAG_USR|TOYFLAG_BIN)) config RESET bool "reset" default n help usage: reset A program to reset the terminal. */ #define FOR_reset #include "toys.h" void reset_main(void) { char *args[] = {"stty", "sane", NULL}; /* \033c - reset the terminal with default setting * \033(B - set the G0 character set (B=US) * \033[2J - clear the whole screen * \033[0m - Reset all attributes */ if (isatty(1)) xprintf("\033c\033(B\033[0m\033[J\033[?25h"); fflush(stdout); // set the terminal to sane settings xexec(args); }