diff options
| author | Eric Andersen <andersen@codepoet.org> | 2001-03-19 23:49:41 +0000 |
|---|---|---|
| committer | Eric Andersen <andersen@codepoet.org> | 2001-03-19 23:49:41 +0000 |
| commit | 92d23245c93eb7db64818384ee6c5366a465e29e (patch) | |
| tree | 1ccb6d69a226fdc1efb283cc1b0d2cc321f5b942 /console-tools | |
| parent | 40eaa9f0bb2c689552e39890592ed773d870c1fa (diff) | |
| download | busybox-w32-92d23245c93eb7db64818384ee6c5366a465e29e.tar.gz busybox-w32-92d23245c93eb7db64818384ee6c5366a465e29e.tar.bz2 busybox-w32-92d23245c93eb7db64818384ee6c5366a465e29e.zip | |
Another cleanup patch from Jeff Garzik <jgarzik@mandrakesoft.com>
Diffstat (limited to 'console-tools')
| -rw-r--r-- | console-tools/loadacm.c | 53 |
1 files changed, 9 insertions, 44 deletions
diff --git a/console-tools/loadacm.c b/console-tools/loadacm.c index 81b973b02..e5a29b6a1 100644 --- a/console-tools/loadacm.c +++ b/console-tools/loadacm.c | |||
| @@ -24,10 +24,10 @@ | |||
| 24 | typedef unsigned short unicode; | 24 | typedef unsigned short unicode; |
| 25 | 25 | ||
| 26 | static long int ctoi(unsigned char *s, int *is_unicode); | 26 | static long int ctoi(unsigned char *s, int *is_unicode); |
| 27 | int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]); | 27 | static int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]); |
| 28 | int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode); | 28 | static int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode); |
| 29 | unicode utf8_to_ucs2(char *buf); | 29 | static unicode utf8_to_ucs2(char *buf); |
| 30 | int screen_map_load(int fd, FILE * fp); | 30 | static int screen_map_load(int fd, FILE * fp); |
| 31 | 31 | ||
| 32 | int loadacm_main(int argc, char **argv) | 32 | int 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 | ||
| 54 | int screen_map_load(int fd, FILE * fp) | 54 | static 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 | */ |
| 144 | int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode) | 144 | static 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 | ||
| 216 | int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]) | 216 | static 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 | */ |
| 258 | long int ctoi(unsigned char *s, int *is_unicode) | 258 | static 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 | ||
| 305 | void saveoldmap(int fd, char *omfil) | 305 | static 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 | |||
| 340 | unicode 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; |
