Changeset 3232 in MondoRescue for branches/3.2/mindi-busybox/console-tools


Ignore:
Timestamp:
Jan 1, 2014, 12:47:38 AM (10 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.21.1
Location:
branches/3.2/mindi-busybox/console-tools
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mindi-busybox/console-tools/Config.src

    r2725 r3232  
    1111    bool "chvt"
    1212    default y
    13     depends on PLATFORM_LINUX
     13    select PLATFORM_LINUX
    1414    help
    1515      This program is used to change to another terminal.
     
    1919    bool "fgconsole"
    2020    default y
    21     depends on PLATFORM_LINUX
     21    select PLATFORM_LINUX
    2222    help
    2323      This program prints active (foreground) console number.
     
    3232    bool "deallocvt"
    3333    default y
    34     depends on PLATFORM_LINUX
     34    select PLATFORM_LINUX
    3535    help
    3636      This program deallocates unused virtual consoles.
     
    3939    bool "dumpkmap"
    4040    default y
    41     depends on PLATFORM_LINUX
     41    select PLATFORM_LINUX
    4242    help
    4343      This program dumps the kernel's keyboard translation table to
     
    4747    bool "kbd_mode"
    4848    default y
    49     depends on PLATFORM_LINUX
     49    select PLATFORM_LINUX
    5050    help
    5151      This program reports and sets keyboard mode.
     
    5454    bool "loadfont"
    5555    default y
    56     depends on PLATFORM_LINUX
     56    select PLATFORM_LINUX
    5757    help
    5858      This program loads a console font from standard input.
     
    6161    bool "loadkmap"
    6262    default y
    63     depends on PLATFORM_LINUX
     63    select PLATFORM_LINUX
    6464    help
    6565      This program loads a keyboard translation table from
     
    6969    bool "openvt"
    7070    default y
    71     depends on PLATFORM_LINUX
     71    select PLATFORM_LINUX
    7272    help
    7373      This program is used to start a command on an unused
     
    101101    bool "setconsole"
    102102    default y
    103     depends on PLATFORM_LINUX
     103    select PLATFORM_LINUX
    104104    help
    105105      This program redirects the system console to another device,
     
    116116    bool "setfont"
    117117    default y
    118     depends on PLATFORM_LINUX
     118    select PLATFORM_LINUX
    119119    help
    120120      Allows to load console screen map. Useful for i18n.
     
    138138    bool "setkeycodes"
    139139    default y
    140     depends on PLATFORM_LINUX
     140    select PLATFORM_LINUX
    141141    help
    142142      This program loads entries into the kernel's scancode-to-keycode
     
    146146    bool "setlogcons"
    147147    default y
    148     depends on PLATFORM_LINUX
     148    select PLATFORM_LINUX
    149149    help
    150150      This program redirects the output console of kernel messages.
     
    153153    bool "showkey"
    154154    default y
    155     depends on PLATFORM_LINUX
     155    select PLATFORM_LINUX
    156156    help
    157157      Shows keys pressed.
  • branches/3.2/mindi-busybox/console-tools/chvt.c

    r2725 r3232  
    77 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
    88 */
     9
     10//usage:#define chvt_trivial_usage
     11//usage:       "N"
     12//usage:#define chvt_full_usage "\n\n"
     13//usage:       "Change the foreground virtual terminal to /dev/ttyN"
     14
    915#include "libbb.h"
    1016
  • branches/3.2/mindi-busybox/console-tools/clear.c

    r2725 r3232  
    77 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
    88 */
     9
     10//usage:#define clear_trivial_usage
     11//usage:       ""
     12//usage:#define clear_full_usage "\n\n"
     13//usage:       "Clear screen"
     14
    915#include "libbb.h"
    1016
  • branches/3.2/mindi-busybox/console-tools/deallocvt.c

    r2725 r3232  
    1010
    1111/* no options, no getopt */
     12
     13//usage:#define deallocvt_trivial_usage
     14//usage:       "[N]"
     15//usage:#define deallocvt_full_usage "\n\n"
     16//usage:       "Deallocate unused virtual terminal /dev/ttyN"
    1217
    1318#include "libbb.h"
  • branches/3.2/mindi-busybox/console-tools/dumpkmap.c

    r2725 r3232  
    99 */
    1010/* no options, no getopt */
     11
     12//usage:#define dumpkmap_trivial_usage
     13//usage:       "> keymap"
     14//usage:#define dumpkmap_full_usage "\n\n"
     15//usage:       "Print a binary keyboard translation table to stdout"
     16//usage:
     17//usage:#define dumpkmap_example_usage
     18//usage:       "$ dumpkmap > keymap\n"
    1119
    1220#include "libbb.h"
  • branches/3.2/mindi-busybox/console-tools/fgconsole.c

    r2725 r3232  
    77 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
    88 */
     9
     10//usage:#define fgconsole_trivial_usage
     11//usage:    ""
     12//usage:#define fgconsole_full_usage "\n\n"
     13//usage:    "Get active console"
    914
    1015#include "libbb.h"
  • branches/3.2/mindi-busybox/console-tools/kbd_mode.c

    r2725 r3232  
    99 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
    1010 */
     11
     12//usage:#define kbd_mode_trivial_usage
     13//usage:       "[-a|k|s|u] [-C TTY]"
     14//usage:#define kbd_mode_full_usage "\n\n"
     15//usage:       "Report or set the keyboard mode\n"
     16//usage:     "\n    -a  Default (ASCII)"
     17//usage:     "\n    -k  Medium-raw (keyboard)"
     18//usage:     "\n    -s  Raw (scancode)"
     19//usage:     "\n    -u  Unicode (utf-8)"
     20//usage:     "\n    -C TTY  Affect TTY instead of /dev/tty"
     21
    1122#include "libbb.h"
    1223#include <linux/kd.h>
  • branches/3.2/mindi-busybox/console-tools/loadfont.c

    r2725 r3232  
    1010 * Licensed under GPLv2, see file LICENSE in this source tree.
    1111 */
     12
     13//usage:#define loadfont_trivial_usage
     14//usage:       "< font"
     15//usage:#define loadfont_full_usage "\n\n"
     16//usage:       "Load a console font from stdin"
     17/* //usage:     "\n -C TTY  Affect TTY instead of /dev/tty" */
     18//usage:
     19//usage:#define loadfont_example_usage
     20//usage:       "$ loadfont < /etc/i18n/fontname\n"
     21//usage:
     22//usage:#define setfont_trivial_usage
     23//usage:       "FONT [-m MAPFILE] [-C TTY]"
     24//usage:#define setfont_full_usage "\n\n"
     25//usage:       "Load a console font\n"
     26//usage:     "\n    -m MAPFILE  Load console screen map"
     27//usage:     "\n    -C TTY      Affect TTY instead of /dev/tty"
     28//usage:
     29//usage:#define setfont_example_usage
     30//usage:       "$ setfont -m koi8-r /etc/i18n/fontname\n"
     31
    1232#include "libbb.h"
    1333#include <sys/kd.h>
     
    210230
    211231    /* Note: after PIO_UNIMAPCLR and before PIO_UNIMAP
    212        this printf did not work on many kernels */
     232     * this printf did not work on many kernels */
    213233
    214234    advice.advised_hashsize = 0;
  • branches/3.2/mindi-busybox/console-tools/loadkmap.c

    r2725 r3232  
    77 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
    88 */
     9
     10//usage:#define loadkmap_trivial_usage
     11//usage:       "< keymap"
     12//usage:#define loadkmap_full_usage "\n\n"
     13//usage:       "Load a binary keyboard translation table from stdin\n"
     14/* //usage:     "\n -C TTY  Affect TTY instead of /dev/tty" */
     15//usage:
     16//usage:#define loadkmap_example_usage
     17//usage:       "$ loadkmap < /etc/i18n/lang-keymap\n"
     18
    919#include "libbb.h"
    1020
  • branches/3.2/mindi-busybox/console-tools/openvt.c

    r2725 r3232  
    88 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
    99 */
     10
     11//usage:#define openvt_trivial_usage
     12//usage:       "[-c N] [-sw] [PROG ARGS]"
     13//usage:#define openvt_full_usage "\n\n"
     14//usage:       "Start PROG on a new virtual terminal\n"
     15//usage:     "\n    -c N    Use specified VT"
     16//usage:     "\n    -s  Switch to the VT"
     17/* //usage:     "\n -l  Run PROG as login shell (by prepending '-')" */
     18//usage:     "\n    -w  Wait for PROG to exit"
     19//usage:
     20//usage:#define openvt_example_usage
     21//usage:       "openvt 2 /bin/ash\n"
    1022
    1123#include <linux/vt.h>
     
    145157    if (!argv[0]) {
    146158        argv--;
    147         argv[0] = getenv("SHELL");
    148         if (!argv[0])
    149             argv[0] = (char *) DEFAULT_SHELL;
     159        argv[0] = (char *) get_shell_name();
    150160        /*argv[1] = NULL; - already is */
    151161    }
  • branches/3.2/mindi-busybox/console-tools/reset.c

    r2725 r3232  
    1111/* BTW, which "standard" package has this utility? It doesn't seem
    1212 * to be ncurses, coreutils, console-tools... then what? */
     13
     14//usage:#define reset_trivial_usage
     15//usage:       ""
     16//usage:#define reset_full_usage "\n\n"
     17//usage:       "Reset the screen"
    1318
    1419#include "libbb.h"
     
    3237        /* See 'man 4 console_codes' for details:
    3338         * "ESC c"        -- Reset
    34          * "ESC ( K"      -- Select user mapping
     39         * "ESC ( B"      -- Select G0 Character Set (B = US)
    3540         * "ESC [ 0 m"    -- Reset all display attributes
    3641         * "ESC [ J"      -- Erase to the end of screen
    3742         * "ESC [ ? 25 h" -- Make cursor visible
    3843         */
    39         printf(ESC"c" ESC"(K" ESC"[0m" ESC"[J" ESC"[?25h");
     44        printf(ESC"c" ESC"(B" ESC"[0m" ESC"[J" ESC"[?25h");
    4045        /* http://bugs.busybox.net/view.php?id=1414:
    4146         * people want it to reset echo etc: */
  • branches/3.2/mindi-busybox/console-tools/resize.c

    r2725 r3232  
    88 */
    99/* no options, no getopt */
     10
     11//usage:#define resize_trivial_usage
     12//usage:       ""
     13//usage:#define resize_full_usage "\n\n"
     14//usage:       "Resize the screen"
     15
    1016#include "libbb.h"
    1117
     
    5460    fprintf(stderr, ESC"7" ESC"[r" ESC"[999;999H" ESC"[6n");
    5561    alarm(3); /* Just in case terminal won't answer */
     62//BUG: death by signal won't restore termios
    5663    scanf(ESC"[%hu;%huR", &w.ws_row, &w.ws_col);
    5764    fprintf(stderr, ESC"8");
  • branches/3.2/mindi-busybox/console-tools/setconsole.c

    r2725 r3232  
    88 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
    99 */
     10
     11//usage:#define setconsole_trivial_usage
     12//usage:       "[-r" IF_FEATURE_SETCONSOLE_LONG_OPTIONS("|--reset") "] [DEVICE]"
     13//usage:#define setconsole_full_usage "\n\n"
     14//usage:       "Redirect system console output to DEVICE (default: /dev/tty)\n"
     15//usage:     "\n    -r  Reset output to /dev/console"
    1016
    1117#include "libbb.h"
     
    3541    }
    3642
    37     xioctl(xopen(device, O_RDONLY), TIOCCONS, NULL);
     43    xioctl(xopen(device, O_WRONLY), TIOCCONS, NULL);
    3844    return EXIT_SUCCESS;
    3945}
  • branches/3.2/mindi-busybox/console-tools/setkeycodes.c

    r2725 r3232  
    99 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
    1010 */
     11
     12//usage:#define setkeycodes_trivial_usage
     13//usage:       "SCANCODE KEYCODE..."
     14//usage:#define setkeycodes_full_usage "\n\n"
     15//usage:       "Set entries into the kernel's scancode-to-keycode map,\n"
     16//usage:       "allowing unusual keyboards to generate usable keycodes.\n\n"
     17//usage:       "SCANCODE may be either xx or e0xx (hexadecimal),\n"
     18//usage:       "and KEYCODE is given in decimal."
     19//usage:
     20//usage:#define setkeycodes_example_usage
     21//usage:       "$ setkeycodes e030 127\n"
     22
    1123#include "libbb.h"
    1224
  • branches/3.2/mindi-busybox/console-tools/setlogcons.c

    r2725 r3232  
    1010 */
    1111
     12//usage:#define setlogcons_trivial_usage
     13//usage:       "N"
     14//usage:#define setlogcons_full_usage "\n\n"
     15//usage:       "Redirect the kernel output to console N (0 for current)"
     16
    1217#include "libbb.h"
    1318
     
    1823        char fn;
    1924        char subarg;
    20     } arg = { 11, /* redirect kernel messages */
    21               0   /* to specified console (current as default) */
    22             };
     25    } arg = {
     26        11, /* redirect kernel messages */
     27        0   /* to specified console (current as default) */
     28    };
    2329
    2430    if (argv[1])
  • branches/3.2/mindi-busybox/console-tools/showkey.c

    r2725 r3232  
    77 * Licensed under GPLv2, see file LICENSE in this source tree.
    88 */
     9
     10//usage:#define showkey_trivial_usage
     11//usage:       "[-a | -k | -s]"
     12//usage:#define showkey_full_usage "\n\n"
     13//usage:       "Show keys pressed\n"
     14//usage:     "\n    -a  Display decimal/octal/hex values of the keys"
     15//usage:     "\n    -k  Display interpreted keycodes (default)"
     16//usage:     "\n    -s  Display raw scan-codes"
    917
    1018#include "libbb.h"
     
    5765    getopt32(argv, "aks");
    5866
    59     // get keyboard settings
    60     xioctl(STDIN_FILENO, KDGKBMODE, &kbmode);
    61     printf("kb mode was %s\n\nPress any keys. Program terminates %s\n\n",
    62         kbmode == K_RAW ? "RAW" :
    63             (kbmode == K_XLATE ? "XLATE" :
    64                 (kbmode == K_MEDIUMRAW ? "MEDIUMRAW" :
    65                     (kbmode == K_UNICODE ? "UNICODE" : "UNKNOWN")))
    66         , (option_mask32 & OPT_a) ? "on EOF (ctrl-D)" : "10s after last keypress"
    67     );
    68 
    6967    // prepare for raw mode
    7068    xget1(&tio, &tio0);
     
    7270    xset1(&tio);
    7371
     72#define press_keys "Press any keys, program terminates %s:\r\n\n"
     73
    7474    if (option_mask32 & OPT_a) {
     75        // just read stdin char by char
    7576        unsigned char c;
    7677
    77         // just read stdin char by char
     78        printf(press_keys, "on EOF (ctrl-D)");
     79
     80        // read and show byte values
    7881        while (1 == read(STDIN_FILENO, &c, 1)) {
    7982            printf("%3u 0%03o 0x%02x\r\n", c, c, c);
     
    8184                break;
    8285        }
     86
    8387    } else {
     88        // we assume a PC keyboard
     89        xioctl(STDIN_FILENO, KDGKBMODE, &kbmode);
     90        printf("Keyboard mode was %s.\r\n\n",
     91            kbmode == K_RAW ? "RAW" :
     92                (kbmode == K_XLATE ? "XLATE" :
     93                    (kbmode == K_MEDIUMRAW ? "MEDIUMRAW" :
     94                        (kbmode == K_UNICODE ? "UNICODE" : "UNKNOWN")))
     95        );
     96
    8497        // set raw keyboard mode
    8598        xioctl(STDIN_FILENO, KDSKBMODE, (void *)(ptrdiff_t)((option_mask32 & OPT_k) ? K_MEDIUMRAW : K_RAW));
     
    87100        // we should exit on any signal; signals should interrupt read
    88101        bb_signals_recursive_norestart(BB_FATAL_SIGS, record_signo);
     102
     103        // inform user that program ends after time of inactivity
     104        printf(press_keys, "10s after last keypress");
    89105
    90106        // read and show scancodes
     
    95111            // setup 10s watchdog
    96112            alarm(10);
     113
    97114            // read scancodes
    98115            n = read(STDIN_FILENO, buf, sizeof(buf));
     
    122139            puts("\r");
    123140        }
     141
     142        // restore keyboard mode
     143        xioctl(STDIN_FILENO, KDSKBMODE, (void *)(ptrdiff_t)kbmode);
    124144    }
    125145
    126     // restore keyboard and console settings
     146    // restore console settings
    127147    xset1(&tio0);
    128     xioctl(STDIN_FILENO, KDSKBMODE, (void *)(ptrdiff_t)kbmode);
    129148
    130149    return EXIT_SUCCESS;
Note: See TracChangeset for help on using the changeset viewer.