added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / arch / all-linux / hidd / table2c.c
blob6bea732590f1f85bd3953350ebf49f42e50e71c5
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <stdio.h>
8 int main(int argc, char *argv[])
10 unsigned char buf[256];
11 FILE *in = NULL, *out = NULL;
12 int i;
13 int tabsize;
14 int ret = 1;
16 if (argc < 2) {
17 fprintf(stderr, "Too few args\n");
18 goto exit;
21 in = fopen(argv[1], "r");
22 if (NULL == in) {
23 fprintf(stderr, "Could not open input file %s\n", argv[1]);
24 goto exit;
28 if (1 != fread(buf, 256, 1, in)) {
29 fprintf(stderr, "Could not read from input file\n");
30 goto exit;
33 tabsize = 0;
34 for (i = 0; i < 256; i ++) {
35 if (buf[i] != 0xFF) {
36 tabsize = i + 1;
40 printf("#define DEF_TAB_SIZE %d\n", tabsize);
41 printf("const UBYTE deftable[] = {\n");
42 printf("\t 0x%02x", buf[0]);
43 for (i = 1; i < tabsize; i ++) {
44 printf(", 0x%02x", buf[i]);
46 if ((i + 1) % 10 == 0) {
47 printf("\n\t");
50 printf("\n};\n");
53 ret = 0;
55 exit:
57 /* if (NULL != in)
58 fclose(in);
60 if (NULL != out)
61 fclose(out);
62 */
63 return ret;