aboutsummaryrefslogtreecommitdiffstats
path: root/main/kbd/kbd.patch
blob: 83440ef8f792df3cb63d6f836046b46ca076d202 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
--- kbd-1.15.3/src/dumpkeys.c	2011-04-26 20:29:35.000000000 +0000
+++ kbd-1.15.3.patched/src/dumpkeys.c	2012-11-02 20:55:42.405000003 +0000
@@ -107,7 +107,7 @@
 }
 
 static int
-get_bind(u_char kb_index, u_char kb_table) {
+get_bind(unsigned char kb_index, unsigned char kb_table) {
 	struct kbentry ke;
 
 	ke.kb_index = kb_index;
@@ -169,7 +169,7 @@
 	return status;
 }
 
-static u_char
+static unsigned char
 maximum_val(int t) {
 	struct kbentry ke, ke0;
 	int i;
@@ -440,7 +440,7 @@
 			 (val >= 'a' && val <= 'z')));
 	    isasexpected = 0;
 	    if (isletter) {
-		u_short defs[16];
+		unsigned short defs[16];
 		defs[0] = K(KT_LETTER, val);
 		defs[1] = K(KT_LETTER, val ^ 32);
 		defs[2] = defs[0];
diff -ur kbd-1.15.3/src/kbdinfo.c kbd-1.15.3.patched/src/kbdinfo.c
--- kbd-1.15.3/src/kbdinfo.c	2011-04-26 20:29:35.000000000 +0000
+++ kbd-1.15.3.patched/src/kbdinfo.c	2012-11-02 21:22:31.081000003 +0000
@@ -1,6 +1,5 @@
 #include <stdio.h>
 #include <errno.h>
-#include <error.h>
 #include <unistd.h>
 #include <sys/ioctl.h>
 #include <linux/kd.h>
@@ -8,10 +7,12 @@
 #include "getfd.h"
 #include "nls.h"
 #include "version.h"
+#include "error.c"
 
 static const char *action = NULL;
 static const char *value  = NULL;
 
+
 static void attr_noreturn
 usage(int code) {
 	fprintf(stderr,
diff -ur kbd-1.15.3/src/kbdrate.c kbd-1.15.3.patched/src/kbdrate.c
--- kbd-1.15.3/src/kbdrate.c	2011-03-05 14:41:20.000000000 +0000
+++ kbd-1.15.3.patched/src/kbdrate.c	2012-11-02 20:57:25.869000003 +0000
@@ -74,6 +74,7 @@
 #include <errno.h>
 #include <sys/file.h>
 #include <sys/ioctl.h>
+#include <fcntl.h>
 
 #ifdef __sparc__
 #include <asm/param.h>
diff -ur kbd-1.15.3/src/loadkeys.c kbd-1.15.3.patched/src/loadkeys.c
--- kbd-1.15.3/src/loadkeys.c	2011-05-01 23:22:35.000000000 +0000
+++ kbd-1.15.3.patched/src/loadkeys.c	2012-11-02 20:55:48.743000003 +0000
@@ -114,7 +114,7 @@
 int alt_is_meta = 0;
 
 /* the kernel structures we want to set or print */
-u_short *key_map[MAX_NR_KEYMAPS];
+unsigned short *key_map[MAX_NR_KEYMAPS];
 char *func_table[MAX_NR_FUNC];
 
 accent_entry accent_table[MAX_DIACR];
@@ -255,7 +255,7 @@
 
 	if (!key_map[k_table]) {
 		key_map[k_table] =
-		    (u_short *) xmalloc(NR_KEYS * sizeof(u_short));
+		    (unsigned short *) xmalloc(NR_KEYS * sizeof(unsigned short));
 		for (i = 0; i < NR_KEYS; i++)
 			(key_map[k_table])[i] = K_HOLE;
 	}
@@ -566,7 +566,7 @@
 	return kd.kb_cnt;
 }
 
-static void do_constant_key(int i, u_short key)
+static void do_constant_key(int i, unsigned short key)
 {
 	int typ, val, j;
 
@@ -575,7 +575,7 @@
 
 	if ((typ == KT_LATIN || typ == KT_LETTER) &&
 	    ((val >= 'a' && val <= 'z') || (val >= 'A' && val <= 'Z'))) {
-		u_short defs[16];
+		unsigned short defs[16];
 		defs[0] = K(KT_LETTER, val);
 		defs[1] = K(KT_LETTER, val ^ 32);
 		defs[2] = defs[0];
@@ -620,7 +620,7 @@
 
 	for (i = 0; i < NR_KEYS; i++) {
 		if (key_is_constant[i]) {
-			u_short key;
+			unsigned short key;
 
 			if (!key_map[r0])
 				lkfatal(_("impossible error in do_constant"));
@@ -800,7 +800,7 @@
 			keymap_count++;
 			if (i)
 				printf("static ");
-			printf("u_short %s_map[NR_KEYS] = {", mk_mapname(i));
+			printf("unsigned short %s_map[NR_KEYS] = {", mk_mapname(i));
 			for (j = 0; j < NR_KEYS; j++) {
 				if (!(j % 8))
 					printf("\n");
@@ -904,7 +904,7 @@
 {
 	int i, j;
 
-	//u_char *p;
+	//unsigned char *p;
 	char flag, magic[] = "bkeymap";
 	unsigned short v;
 
diff -ur kbd-1.15.3/src/loadkeys.y kbd-1.15.3.patched/src/loadkeys.y
--- kbd-1.15.3/src/loadkeys.y	2011-05-01 23:19:11.000000000 +0000
+++ kbd-1.15.3.patched/src/loadkeys.y	2012-11-02 20:55:42.410000003 +0000
@@ -55,7 +55,7 @@
 int alt_is_meta = 0;
 
 /* the kernel structures we want to set or print */
-u_short *key_map[MAX_NR_KEYMAPS];
+unsigned short *key_map[MAX_NR_KEYMAPS];
 char *func_table[MAX_NR_FUNC];
 
 accent_entry accent_table[MAX_DIACR];
@@ -196,7 +196,7 @@
 
 	if (!key_map[k_table]) {
 		key_map[k_table] =
-		    (u_short *) xmalloc(NR_KEYS * sizeof(u_short));
+		    (unsigned short *) xmalloc(NR_KEYS * sizeof(unsigned short));
 		for (i = 0; i < NR_KEYS; i++)
 			(key_map[k_table])[i] = K_HOLE;
 	}
@@ -507,7 +507,7 @@
 	return kd.kb_cnt;
 }
 
-static void do_constant_key(int i, u_short key)
+static void do_constant_key(int i, unsigned short key)
 {
 	int typ, val, j;
 
@@ -516,7 +516,7 @@
 
 	if ((typ == KT_LATIN || typ == KT_LETTER) &&
 	    ((val >= 'a' && val <= 'z') || (val >= 'A' && val <= 'Z'))) {
-		u_short defs[16];
+		unsigned short defs[16];
 		defs[0] = K(KT_LETTER, val);
 		defs[1] = K(KT_LETTER, val ^ 32);
 		defs[2] = defs[0];
@@ -561,7 +561,7 @@
 
 	for (i = 0; i < NR_KEYS; i++) {
 		if (key_is_constant[i]) {
-			u_short key;
+			unsigned short key;
 
 			if (!key_map[r0])
 				lkfatal(_("impossible error in do_constant"));
@@ -741,7 +741,7 @@
 			keymap_count++;
 			if (i)
 				printf("static ");
-			printf("u_short %s_map[NR_KEYS] = {", mk_mapname(i));
+			printf("unsigned short %s_map[NR_KEYS] = {", mk_mapname(i));
 			for (j = 0; j < NR_KEYS; j++) {
 				if (!(j % 8))
 					printf("\n");
@@ -845,7 +845,7 @@
 {
 	int i, j;
 
-	//u_char *p;
+	//unsigned char *p;
 	char flag, magic[] = "bkeymap";
 	unsigned short v;
 
diff -ur kbd-1.15.3/src/openvt.c kbd-1.15.3.patched/src/openvt.c
--- kbd-1.15.3/src/openvt.c	2011-05-01 23:27:13.000000000 +0000
+++ kbd-1.15.3.patched/src/openvt.c	2012-11-02 20:59:45.516000002 +0000
@@ -10,7 +10,7 @@
 #include <sys/vt.h>
 #include <sys/wait.h>
 #include <sys/file.h>
-
+#include <fcntl.h>
 #include "version.h"
 #include "xmalloc.h"
 #include "getfd.h"
diff -ur kbd-1.15.3/src/setvtrgb.c kbd-1.15.3.patched/src/setvtrgb.c
--- kbd-1.15.3/src/setvtrgb.c	2011-04-26 20:29:35.000000000 +0000
+++ kbd-1.15.3.patched/src/setvtrgb.c	2012-11-02 21:22:50.566000002 +0000
@@ -5,7 +5,7 @@
 #include <sys/ioctl.h>
 #include <linux/kd.h>
 #include <errno.h>
-#include <error.h>
+#include "error.c"
 #include "kbd.h"
 #include "getfd.h"
 #include "nls.h"
--- /dev/null	2012-10-16 17:31:41.304000002 +0000
+++ kbd-1.15.3.patched/src/error.c	2012-11-02 21:22:07.812000002 +0000
@@ -0,0 +1,24 @@
+#include <stdio.h>
+#include <stdarg.h>
+
+static void error(int status, int errnum, const char *fmt, ...) {
+	fflush(stdout);
+	char dest[4096];
+	va_list ap;
+	va_start(ap, fmt);
+	ssize_t result = vsnprintf(dest, sizeof(dest), fmt, ap);
+	va_end(ap);
+	dprintf(2, "program_name: %s", dest);
+	if(errnum) {
+		dprintf(2, ": ");
+		perror(fmt);
+		exit (status);
+	} else {
+		dprintf(2, "\n");
+	}
+}
+                                                        
+
+
+
+