projects
/
oweals
/
busybox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
gz_open and gz_close were left in, even when BB_FEATURE_TAR_GZIP was disabled.
[oweals/busybox.git]
/
loadkmap.c
diff --git
a/loadkmap.c
b/loadkmap.c
index 7dfa670f40e49a3e5e62dd0746bd0a325e40c53a..dcb5c1caa1ef2e4b6b3772018df441d1fe948fbb 100644
(file)
--- a/
loadkmap.c
+++ b/
loadkmap.c
@@
-20,11
+20,14
@@
*
*/
*
*/
-#include "busybox.h"
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
+#include "busybox.h"
#define BINARY_KEYMAP_MAGIC "bkeymap"
#define BINARY_KEYMAP_MAGIC "bkeymap"
@@
-34,11
+37,11
@@
struct kbentry {
unsigned char kb_index;
unsigned short kb_value;
};
unsigned char kb_index;
unsigned short kb_value;
};
-
#define KDSKBENT 0x4B47
/* sets one entry in translation table */
+
static const int KDSKBENT = 0x4B47;
/* sets one entry in translation table */
/* From <linux/keyboard.h> */
/* From <linux/keyboard.h> */
-#define NR_KEYS 128
-#define MAX_NR_KEYMAPS 256
+static const int NR_KEYS = 128;
+static const int MAX_NR_KEYMAPS = 256;
int loadkmap_main(int argc, char **argv)
{
int loadkmap_main(int argc, char **argv)
{
@@
-48,18
+51,18
@@
int loadkmap_main(int argc, char **argv)
char flags[MAX_NR_KEYMAPS], buff[7];
if (argc != 1)
char flags[MAX_NR_KEYMAPS], buff[7];
if (argc != 1)
-
usage(loadkmap_usage
);
+
show_usage(
);
fd = open("/dev/tty0", O_RDWR);
if (fd < 0)
fd = open("/dev/tty0", O_RDWR);
if (fd < 0)
-
fatalPerror
("Error opening /dev/tty0");
+
perror_msg_and_die
("Error opening /dev/tty0");
read(0, buff, 7);
if (0 != strncmp(buff, BINARY_KEYMAP_MAGIC, 7))
read(0, buff, 7);
if (0 != strncmp(buff, BINARY_KEYMAP_MAGIC, 7))
-
fatalError("This is not a valid binary keymap.\n
");
+
error_msg_and_die("This is not a valid binary keymap.
");
if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS))
if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS))
-
fatalPerror
("Error reading keymap flags");
+
perror_msg_and_die
("Error reading keymap flags");
ibuff = (u_short *) xmalloc(ibuffsz);
ibuff = (u_short *) xmalloc(ibuffsz);
@@
-68,7
+71,7
@@
int loadkmap_main(int argc, char **argv)
pos = 0;
while (pos < ibuffsz) {
if ((readsz = read(0, (char *) ibuff + pos, ibuffsz - pos)) < 0)
pos = 0;
while (pos < ibuffsz) {
if ((readsz = read(0, (char *) ibuff + pos, ibuffsz - pos)) < 0)
-
fatalPerror
("Error reading keymap");
+
perror_msg_and_die
("Error reading keymap");
pos += readsz;
}
for (j = 0; j < NR_KEYS; j++) {
pos += readsz;
}
for (j = 0; j < NR_KEYS; j++) {