summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>2000-02-16 19:27:30 +0000
committerMatt Wilson <msw@redhat.com>2000-02-16 19:27:30 +0000
commit0c5c762dee2b22c934fca9d07b7a290de9ecbea6 (patch)
treeafc6e9078c765df4cd63ad271c12f4aa8ee27c42 /utils
parent727740949fdf353f8b5a45b355fe9c2a57be39d2 (diff)
downloadanaconda-0c5c762dee2b22c934fca9d07b7a290de9ecbea6.tar.gz
anaconda-0c5c762dee2b22c934fca9d07b7a290de9ecbea6.tar.xz
anaconda-0c5c762dee2b22c934fca9d07b7a290de9ecbea6.zip
added
Diffstat (limited to 'utils')
-rw-r--r--utils/Makefile5
-rw-r--r--utils/mapshdr.c39
-rw-r--r--utils/readmap.c90
3 files changed, 130 insertions, 4 deletions
diff --git a/utils/Makefile b/utils/Makefile
index 3a4f54831..60d4f763b 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -2,7 +2,7 @@ LOADLIBES = -L../isys -lisys -lpopt
CFLAGS = -Wall -g
LDFLAGS = -g
-all: modlist moddeps genhdlist snarffont
+all: modlist moddeps genhdlist snarffont mapshdr readmap
moddeps: moddeps.o
$(CC) $(LDFLAGS) -o moddeps moddeps.o ../loader/modules.o \
@@ -14,9 +14,6 @@ moddeps: moddeps.o
genhdlist: genhdlist.c
$(CC) -I/usr/include/rpm $(LDFLAGS) -o genhdlist genhdlist.c -lrpm -lbz2 -static -lz -lpopt
-snarffont: snarffont.c
- $(CC) -o snarffont snarffont.c
-
install: all
mkdir -p $(DESTDIR)/usr/bin
# install -m755 -s genhdlist $(DESTDIR)/usr/bin
diff --git a/utils/mapshdr.c b/utils/mapshdr.c
new file mode 100644
index 000000000..e5524a57b
--- /dev/null
+++ b/utils/mapshdr.c
@@ -0,0 +1,39 @@
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "../loader/lang.h"
+
+int main(int argc, char ** argv) {
+ struct kmapHeader h;
+ struct kmapInfo info;
+ int i;
+ struct stat sb;
+ char * chptr;
+
+ h.magic = KMAP_MAGIC;
+ h.numEntries = argc - 1;
+ write(1, &h, sizeof(h));
+
+ for (i = 1; i < argc; i++) {
+ if (stat(argv[i], &sb)) {
+ fprintf(stderr, "stat error for %s: %s\n", argv[i],
+ strerror(errno));
+ exit(1);
+ }
+
+ memset(info.name, 0, KMAP_NAMELEN);
+ strncpy(info.name, argv[i], KMAP_NAMELEN - 1);
+
+ chptr = info.name + strlen(info.name) - 1;
+ while (*chptr != '.') *chptr-- = '\0';
+ *chptr = '\0';
+
+ info.size = sb.st_size;
+ write(1, &info, sizeof(info));
+ }
+
+ return 0;
+}
diff --git a/utils/readmap.c b/utils/readmap.c
new file mode 100644
index 000000000..d4fc82f82
--- /dev/null
+++ b/utils/readmap.c
@@ -0,0 +1,90 @@
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <linux/keyboard.h>
+#include <linux/kd.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "../loader/lang.h"
+
+int main(int argc, char ** argv) {
+ int console;
+ int kmap, key;
+ struct kbentry entry;
+ int keymaps[MAX_NR_KEYMAPS];
+ int count = 0;
+ int out;
+ short keymap[NR_KEYS];
+ int magic = KMAP_MAGIC;
+
+ if (argc != 2) {
+ printf("bad usage\n");
+ exit(1);
+ }
+
+ memset(keymaps, 0, sizeof(keymaps));
+
+ console = open("/dev/console", O_RDWR);
+ if (console < 0) {
+ perror("open console");
+ exit(1);
+ }
+
+ for (kmap = 0; kmap < MAX_NR_KEYMAPS; kmap++) {
+ for (key = 0; key < NR_KEYS; key++) {
+ entry.kb_index = key;
+ entry.kb_table = kmap;
+ if (ioctl(console, KDGKBENT, &entry)) {
+ perror("ioctl failed");
+ exit(1);
+ } else if (KTYP(entry.kb_value) != KT_SPEC) {
+ keymaps[kmap] = 1;
+ count++;
+ break;
+ }
+ }
+ }
+
+ printf("found %d valid keymaps\n", count);
+
+ printf("creating keymap file %s\n", argv[1]);
+ if ((out = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 1) {
+ perror("open keymap");
+ exit(1);
+ }
+
+ if (write(out, &magic, sizeof(magic)) != sizeof(magic)) {
+ perror("write magic");
+ exit(1);
+ }
+
+ if (write(out, keymaps, sizeof(keymaps)) != sizeof(keymaps)) {
+ perror("write header");
+ exit(1);
+ }
+
+ for (kmap = 0; kmap < MAX_NR_KEYMAPS; kmap++) {
+ if (!keymaps[kmap]) continue;
+ for (key = 0; key < NR_KEYS; key++) {
+ entry.kb_index = key;
+ entry.kb_table = kmap;
+ if (ioctl(console, KDGKBENT, &entry)) {
+ perror("ioctl failed");
+ exit(1);
+ } else {
+ keymap[key] = entry.kb_value;
+ }
+ }
+
+ if (write(out, keymap, sizeof(keymap)) != sizeof(keymap)) {
+ perror("write keymap");
+ exit(1);
+ }
+ }
+
+ close(out);
+
+ return 0;
+}