aboutsummaryrefslogtreecommitdiff
path: root/loadacm.c
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-03-19 23:49:41 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-03-19 23:49:41 +0000
commit8775faaeafdb04c8fc390a822a4588a95c98e4b2 (patch)
tree1ccb6d69a226fdc1efb283cc1b0d2cc321f5b942 /loadacm.c
parent9fcedc7b123534eb437ac0366fbb2588862f9d4c (diff)
downloadbusybox-w32-8775faaeafdb04c8fc390a822a4588a95c98e4b2.tar.gz
busybox-w32-8775faaeafdb04c8fc390a822a4588a95c98e4b2.tar.bz2
busybox-w32-8775faaeafdb04c8fc390a822a4588a95c98e4b2.zip
Another cleanup patch from Jeff Garzik <jgarzik@mandrakesoft.com>
git-svn-id: svn://busybox.net/trunk/busybox@2163 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'loadacm.c')
-rw-r--r--loadacm.c53
1 files changed, 9 insertions, 44 deletions
diff --git a/loadacm.c b/loadacm.c
index 81b973b02..e5a29b6a1 100644
--- a/loadacm.c
+++ b/loadacm.c
@@ -24,10 +24,10 @@
24typedef unsigned short unicode; 24typedef unsigned short unicode;
25 25
26static long int ctoi(unsigned char *s, int *is_unicode); 26static long int ctoi(unsigned char *s, int *is_unicode);
27int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]); 27static int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]);
28int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode); 28static int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode);
29unicode utf8_to_ucs2(char *buf); 29static unicode utf8_to_ucs2(char *buf);
30int screen_map_load(int fd, FILE * fp); 30static int screen_map_load(int fd, FILE * fp);
31 31
32int loadacm_main(int argc, char **argv) 32int loadacm_main(int argc, char **argv)
33{ 33{
@@ -51,7 +51,7 @@ int loadacm_main(int argc, char **argv)
51 return EXIT_SUCCESS; 51 return EXIT_SUCCESS;
52} 52}
53 53
54int screen_map_load(int fd, FILE * fp) 54static int screen_map_load(int fd, FILE * fp)
55{ 55{
56 struct stat stbuf; 56 struct stat stbuf;
57 unicode wbuf[E_TABSZ]; 57 unicode wbuf[E_TABSZ];
@@ -141,7 +141,7 @@ int screen_map_load(int fd, FILE * fp)
141 * 141 *
142 * FIXME: ignores everything after second word 142 * FIXME: ignores everything after second word
143 */ 143 */
144int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode) 144static int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode)
145{ 145{
146 char buffer[256]; /* line buffer reading file */ 146 char buffer[256]; /* line buffer reading file */
147 char *p, *q; /* 1st + 2nd words in line */ 147 char *p, *q; /* 1st + 2nd words in line */
@@ -213,7 +213,7 @@ int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode)
213} 213}
214 214
215 215
216int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]) 216static int old_screen_map_read_ascii(FILE * fp, unsigned char buf[])
217{ 217{
218 char buffer[256]; 218 char buffer[256];
219 int in, on; 219 int in, on;
@@ -255,7 +255,7 @@ int old_screen_map_read_ascii(FILE * fp, unsigned char buf[])
255 * 255 *
256 * CAVEAT: will report valid UTF mappings using only 1 byte as 8-bit ones. 256 * CAVEAT: will report valid UTF mappings using only 1 byte as 8-bit ones.
257 */ 257 */
258long int ctoi(unsigned char *s, int *is_unicode) 258static long int ctoi(unsigned char *s, int *is_unicode)
259{ 259{
260 int i; 260 int i;
261 size_t ls; 261 size_t ls;
@@ -302,42 +302,7 @@ long int ctoi(unsigned char *s, int *is_unicode)
302} 302}
303 303
304 304
305void saveoldmap(int fd, char *omfil) 305static unicode utf8_to_ucs2(char *buf)
306{
307 FILE *fp;
308 char buf[E_TABSZ];
309
310#ifdef GIO_UNISCRNMAP
311 unicode xbuf[E_TABSZ];
312 int is_old_map = 0;
313
314 if (ioctl(fd, GIO_UNISCRNMAP, xbuf)) {
315 perror_msg("GIO_UNISCRNMAP ioctl error");
316#endif
317 if (ioctl(fd, GIO_SCRNMAP, buf))
318 perror_msg_and_die("GIO_SCRNMAP ioctl error");
319 else
320 is_old_map = 1;
321#ifdef GIO_UNISCRNMAP
322 }
323#endif
324
325 fp = xfopen(omfil, "w");
326#ifdef GIO_UNISCRNMAP
327 if (is_old_map) {
328#endif
329 if (fwrite(buf, E_TABSZ, 1, fp) != 1)
330 perror_msg_and_die("Error writing map to file");
331#ifdef GIO_UNISCRNMAP
332 } else if (fwrite(xbuf, sizeof(unicode) * E_TABSZ, 1, fp) != 1) {
333 perror_msg_and_die("Error writing map to file");
334 }
335#endif
336
337 fclose(fp);
338}
339
340unicode utf8_to_ucs2(char *buf)
341{ 306{
342 int utf_count = 0; 307 int utf_count = 0;
343 long utf_char = 0; 308 long utf_char = 0;