5 #define MAX_LANGUAGE_SIZE 20000
7 static char language_buffer
[MAX_LANGUAGE_SIZE
];
9 int lang_load(const char *filename
)
12 int fd
= open(filename
, O_RDONLY
);
14 unsigned char lang_header
[3];
17 if(3 == read(fd
, lang_header
, 3)) {
18 unsigned char *ptr
= language_buffer
;
20 printf("%02x %02x %02x\n",
21 lang_header
[0], lang_header
[1], lang_header
[2]);
23 fsize
= read(fd
, language_buffer
, MAX_LANGUAGE_SIZE
);
26 id
= (ptr
[0]<<8) | ptr
[1]; /* get two-byte id */
27 ptr
+=2; /* pass the id */
29 printf("%03d %s\n", id
, ptr
);
31 while(*ptr
) { /* pass the string */
35 fsize
-=3; /* the id and the terminating zero */
36 ptr
++; /* pass the terminating zero-byte */
43 int main(int argc
, char **argv
)
46 printf("Usage: lngdump <lng file>\n");