Ignore:
Timestamp:
Nov 4, 2007, 3:16:40 AM (17 years ago)
Author:
Bruno Cornec
Message:

Update to busybox 1.7.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.5/mindi-busybox/console-tools/loadkmap.c

    r821 r1765  
    55 * Copyright (C) 1998 Enrique Zanardi <ezanardi@ull.es>
    66 *
    7  * This program is free software; you can redistribute it and/or modify
    8  * it under the terms of the GNU General Public License as published by
    9  * the Free Software Foundation; either version 2 of the License, or
    10  * (at your option) any later version.
    11  *
    12  * This program is distributed in the hope that it will be useful,
    13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    15  * General Public License for more details.
    16  *
    17  * You should have received a copy of the GNU General Public License
    18  * along with this program; if not, write to the Free Software
    19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
     7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
    208 *
    219 */
    2210
    23 #include <errno.h>
    24 #include <fcntl.h>
    25 #include <stdio.h>
    26 #include <string.h>
    27 #include <stdlib.h>
    28 #include <unistd.h>
    29 #include <sys/ioctl.h>
    30 #include "busybox.h"
     11#include "libbb.h"
    3112
    3213#define BINARY_KEYMAP_MAGIC "bkeymap"
     
    4526#define MAX_NR_KEYMAPS  256
    4627
     28int loadkmap_main(int argc, char **argv);
    4729int loadkmap_main(int argc, char **argv)
    4830{
    4931    struct kbentry ke;
    5032    int i, j, fd;
    51     u_short ibuff[NR_KEYS];
     33    uint16_t ibuff[NR_KEYS];
    5234    char flags[MAX_NR_KEYMAPS];
    5335    char buff[7];
     
    5638        bb_show_usage();
    5739
    58     fd = bb_xopen(CURRENT_VC, O_RDWR);
     40    fd = xopen(CURRENT_VC, O_RDWR);
    5941
    60     if ((bb_full_read(0, buff, 7) != 7) || (strncmp(buff, BINARY_KEYMAP_MAGIC, 7) != 0))
    61         bb_error_msg_and_die("This is not a valid binary keymap.");
     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");
    6245
    63     if (bb_full_read(0, flags, MAX_NR_KEYMAPS) != MAX_NR_KEYMAPS)
    64         bb_perror_msg_and_die("Error reading keymap flags");
     46    xread(0, flags, MAX_NR_KEYMAPS);
    6547
    6648    for (i = 0; i < MAX_NR_KEYMAPS; i++) {
    6749        if (flags[i] == 1) {
    68             bb_full_read(0, ibuff, NR_KEYS * sizeof(u_short));
     50            xread(0, ibuff, NR_KEYS * sizeof(uint16_t));
    6951            for (j = 0; j < NR_KEYS; j++) {
    7052                ke.kb_index = j;
     
    7658    }
    7759
    78     /* Don't bother to close files.  Exit does that
    79      * automagically, so we can save a few bytes */
    80     /* close(fd); */
    81     return EXIT_SUCCESS;
     60    if (ENABLE_FEATURE_CLEAN_UP) close(fd);
     61    return 0;
    8262}
Note: See TracChangeset for help on using the changeset viewer.