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/loadkmap.c

    r1765 r2725  
    55 * Copyright (C) 1998 Enrique Zanardi <ezanardi@ull.es>
    66 *
    7  * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
    8  *
     7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
    98 */
    10 
    119#include "libbb.h"
    1210
     
    2624#define MAX_NR_KEYMAPS  256
    2725
    28 int loadkmap_main(int argc, char **argv);
    29 int loadkmap_main(int argc, char **argv)
     26int loadkmap_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
     27int loadkmap_main(int argc UNUSED_PARAM, char **argv)
    3028{
    3129    struct kbentry ke;
    3230    int i, j, fd;
    3331    uint16_t ibuff[NR_KEYS];
    34     char flags[MAX_NR_KEYMAPS];
    35     char buff[7];
     32/*  const char *tty_name = CURRENT_TTY; */
     33    RESERVE_CONFIG_BUFFER(flags, MAX_NR_KEYMAPS);
    3634
    37     if (argc != 1)
     35    /* When user accidentally runs "loadkmap FILE"
     36     * instead of "loadkmap <FILE", we end up waiting for input from tty.
     37     * Let's prevent it: */
     38    if (argv[1])
    3839        bb_show_usage();
     40/* bb_warn_ignoring_args(argv[1]); */
     41    fd = get_console_fd_or_die();
     42/* or maybe:
     43    opt = getopt32(argv, "C:", &tty_name);
     44    fd = xopen_nonblocking(tty_name);
     45*/
    3946
    40     fd = xopen(CURRENT_VC, O_RDWR);
     47    xread(STDIN_FILENO, flags, 7);
     48    if (strncmp(flags, BINARY_KEYMAP_MAGIC, 7))
     49        bb_error_msg_and_die("not a valid binary keymap");
    4150
    42     xread(0, buff, 7);
    43     if (strncmp(buff, BINARY_KEYMAP_MAGIC, 7))
    44         bb_error_msg_and_die("this is not a valid binary keymap");
    45 
    46     xread(0, flags, MAX_NR_KEYMAPS);
     51    xread(STDIN_FILENO, flags, MAX_NR_KEYMAPS);
    4752
    4853    for (i = 0; i < MAX_NR_KEYMAPS; i++) {
    4954        if (flags[i] == 1) {
    50             xread(0, ibuff, NR_KEYS * sizeof(uint16_t));
     55            xread(STDIN_FILENO, ibuff, NR_KEYS * sizeof(uint16_t));
    5156            for (j = 0; j < NR_KEYS; j++) {
    5257                ke.kb_index = j;
     
    5863    }
    5964
    60     if (ENABLE_FEATURE_CLEAN_UP) close(fd);
    61     return 0;
     65    if (ENABLE_FEATURE_CLEAN_UP) {
     66        close(fd);
     67        RELEASE_CONFIG_BUFFER(flags);
     68    }
     69    return EXIT_SUCCESS;
    6270}
Note: See TracChangeset for help on using the changeset viewer.