X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=console-tools%2Freset.c;h=792618f5cb88d02b608fa8fd707cc2c934d87b23;hb=97551974485a8680299560af8863023dfb9634af;hp=8e2c491e2a8aad1a184f9a792fc42a230fb6c8ef;hpb=3570a34de46b1f7dedd16999bb1687e2d6b55d40;p=oweals%2Fbusybox.git diff --git a/console-tools/reset.c b/console-tools/reset.c index 8e2c491e2..792618f5c 100644 --- a/console-tools/reset.c +++ b/console-tools/reset.c @@ -2,10 +2,8 @@ /* * Mini reset implementation for busybox * - * - * Copyright (C) 1999,2000 by Lineo, inc. - * Written by Erik Andersen , - * and Kent Robotti + * Copyright (C) 1999-2004 by Erik Andersen + * Written by Erik Andersen and Kent Robotti * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,12 +21,25 @@ * */ -#include "busybox.h" +/* no options, no getopt */ + #include +#include +#include +#include "busybox.h" -extern int reset_main(int argc, char **argv) +int reset_main(int argc, char **argv) { - printf("\033c"); - return(TRUE); + if (isatty(1)) { + /* See 'man 4 console_codes' for details: + * "ESC c" -- Reset + * "ESC ( K" -- Select user mapping + * "ESC [ J" -- Erase display + * "ESC [ 0 m" -- Reset all display attributes + * "ESC [ ? 25 h" -- Make cursor visible. + */ + printf("\033c\033(K\033[J\033[0m\033[?25h"); + } + return EXIT_SUCCESS; }