blob: 792618f5cb88d02b608fa8fd707cc2c934d87b23 [file] [log] [blame]
Eric Andersendc746162000-08-21 21:26:33 +00001/* vi: set sw=4 ts=4: */
2/*
3 * Mini reset implementation for busybox
4 *
Eric Andersenc7bda1c2004-03-15 08:29:22 +00005 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
Eric Andersenbdfd0d72001-10-24 05:00:29 +00006 * Written by Erik Andersen and Kent Robotti <robotti@metconnect.com>
Eric Andersendc746162000-08-21 21:26:33 +00007 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
Eric Andersen7f6295f2003-10-22 10:34:15 +000024/* no options, no getopt */
25
Eric Andersendc746162000-08-21 21:26:33 +000026#include <stdio.h>
Eric Andersened3ef502001-01-27 08:24:39 +000027#include <stdlib.h>
Eric Andersen08573e02003-12-20 07:07:22 +000028#include <unistd.h>
Eric Andersencbe31da2001-02-20 06:14:08 +000029#include "busybox.h"
Eric Andersendc746162000-08-21 21:26:33 +000030
Rob Landleydfba7412006-03-06 20:47:33 +000031int reset_main(int argc, char **argv)
Eric Andersendc746162000-08-21 21:26:33 +000032{
"Vladimir N. Oleynik"ffe17b52005-10-12 08:38:28 +000033 if (isatty(1)) {
Eric Andersen08573e02003-12-20 07:07:22 +000034 /* See 'man 4 console_codes' for details:
35 * "ESC c" -- Reset
36 * "ESC ( K" -- Select user mapping
37 * "ESC [ J" -- Erase display
"Vladimir N. Oleynik"ffe17b52005-10-12 08:38:28 +000038 * "ESC [ 0 m" -- Reset all display attributes
Eric Andersen08573e02003-12-20 07:07:22 +000039 * "ESC [ ? 25 h" -- Make cursor visible.
40 */
41 printf("\033c\033(K\033[J\033[0m\033[?25h");
42 }
Eric Andersen7f6295f2003-10-22 10:34:15 +000043 return EXIT_SUCCESS;
Eric Andersendc746162000-08-21 21:26:33 +000044}
45