Ignore:
Timestamp:
Feb 25, 2011, 9:26:54 PM (13 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mindi-busybox/console-tools/reset.c

    r1765 r2725  
    66 * Written by Erik Andersen and Kent Robotti <robotti@metconnect.com>
    77 *
    8  * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
     8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
    99 */
    1010
    11 /* no options, no getopt */
     11/* BTW, which "standard" package has this utility? It doesn't seem
     12 * to be ncurses, coreutils, console-tools... then what? */
    1213
    1314#include "libbb.h"
    1415
    15 int reset_main(int argc, char **argv);
    16 int reset_main(int argc, char **argv)
     16#define ESC "\033"
     17
     18#if ENABLE_STTY
     19int stty_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
     20#endif
     21
     22int reset_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
     23int reset_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
    1724{
    18     if (isatty(1)) {
     25    static const char *const args[] = {
     26        "stty", "sane", NULL
     27    };
     28
     29    /* no options, no getopt */
     30
     31    if (/*isatty(STDIN_FILENO) &&*/ isatty(STDOUT_FILENO)) {
    1932        /* 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.
     33         * "ESC c"        -- Reset
     34         * "ESC ( K"      -- Select user mapping
     35         * "ESC [ 0 m"    -- Reset all display attributes
     36         * "ESC [ J"      -- Erase to the end of screen
     37         * "ESC [ ? 25 h" -- Make cursor visible
    2538         */
    26         printf("\033c\033(K\033[J\033[0m\033[?25h");
     39        printf(ESC"c" ESC"(K" ESC"[0m" ESC"[J" ESC"[?25h");
     40        /* http://bugs.busybox.net/view.php?id=1414:
     41         * people want it to reset echo etc: */
     42#if ENABLE_STTY
     43        return stty_main(2, (char**)args);
     44#else
     45        execvp("stty", (char**)args);
     46#endif
    2747    }
    2848    return EXIT_SUCCESS;
    2949}
    30 
Note: See TracChangeset for help on using the changeset viewer.