hdt: Removing builting sleep support in say
[syslinux.git] / com32 / modules / kbdmap.c
blobf1c736d518d0010735e3955ec06f1df21069d56f
1 /* ----------------------------------------------------------------------- *
3 * Copyright 2009 Intel Corporation; author: H. Peter Anvin
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
8 * Boston MA 02110-1301, USA; either version 2 of the License, or
9 * (at your option) any later version; incorporated herein by reference.
11 * ----------------------------------------------------------------------- */
13 #include <stdio.h>
14 #include <string.h>
15 #include <console.h>
16 #include <syslinux/loadfile.h>
17 #include <syslinux/keyboard.h>
19 static inline void error(const char *msg)
21 fputs(msg, stderr);
24 int main(int argc, char *argv[])
26 const struct syslinux_keyboard_map *const kmap = syslinux_keyboard_map();
27 size_t map_size;
28 void *kbdmap;
30 openconsole(&dev_null_r, &dev_stdcon_w);
32 if (argc != 2) {
33 error("Usage: kbdmap mapfile\n");
34 return 1;
37 if (kmap->version != 1) {
38 error("Syslinux core version mismatch\n");
39 return 1;
42 if (loadfile(argv[1], &kbdmap, &map_size)) {
43 error("Keyboard map file load error\n");
44 return 1;
47 if (map_size != kmap->length) {
48 error("Keyboard map file format error\n");
49 return 1;
52 memcpy(kmap->map, kbdmap, map_size);
53 return 0;