Line | |
---|
1 | /* vi: set sw=4 ts=4: */
|
---|
2 | /*
|
---|
3 | * Mini reset implementation for busybox
|
---|
4 | *
|
---|
5 | * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
|
---|
6 | * Written by Erik Andersen and Kent Robotti <robotti@metconnect.com>
|
---|
7 | *
|
---|
8 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
---|
9 | */
|
---|
10 |
|
---|
11 | /* no options, no getopt */
|
---|
12 |
|
---|
13 | #include "libbb.h"
|
---|
14 |
|
---|
15 | int reset_main(int argc, char **argv);
|
---|
16 | int reset_main(int argc, char **argv)
|
---|
17 | {
|
---|
18 | if (isatty(1)) {
|
---|
19 | /* See 'man 4 console_codes' for details:
|
---|
20 | * "ESC c" -- Reset
|
---|
21 | * "ESC ( K" -- Select user mapping
|
---|
22 | * "ESC [ J" -- Erase display
|
---|
23 | * "ESC [ 0 m" -- Reset all display attributes
|
---|
24 | * "ESC [ ? 25 h" -- Make cursor visible.
|
---|
25 | */
|
---|
26 | printf("\033c\033(K\033[J\033[0m\033[?25h");
|
---|
27 | }
|
---|
28 | return EXIT_SUCCESS;
|
---|
29 | }
|
---|
30 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.