]>
Commit | Line | Data |
---|---|---|
3f682969 | 1 | --- gettext-0.10.35/src/msgmerge.c.orig Mon Feb 12 19:38:15 2001 |
2 | +++ gettext-0.10.35/src/msgmerge.c Mon Feb 12 19:40:46 2001 | |
3 | @@ -47,6 +47,7 @@ | |
4 | ||
5 | #define _(str) gettext (str) | |
6 | ||
7 | +extern void setmblocale(char* filename); | |
8 | ||
9 | /* This structure defines a derived class of the po_ty class. (See | |
10 | po.h for an explanation.) */ | |
11 | @@ -278,6 +279,9 @@ | |
12 | ||
13 | /* merge the two files */ | |
14 | result = merge (argv[optind], argv[optind + 1]); | |
15 | + | |
16 | + /* multibyte handling */ | |
17 | + setmblocale(argv[optind]); | |
18 | ||
19 | /* Sort the results. */ | |
20 | if (sort_by_filepos) | |
21 | --- gettext-0.10.35/src/message.c.oka Mon Feb 12 20:13:59 2001 | |
22 | +++ gettext-0.10.35/src/message.c Mon Feb 12 20:15:15 2001 | |
23 | @@ -81,7 +81,49 @@ | |
24 | static const char *make_c_width_description_string PARAMS ((enum is_c_format)); | |
25 | static int significant_c_format_p PARAMS ((enum is_c_format __is_c_format)); | |
26 | ||
27 | +static int mblocale_flag = 0; /* OFF */ | |
28 | ||
29 | +void setmblocale(char* filename) { | |
30 | + int i; | |
31 | + FILE *fp; | |
32 | + char tmpbuf[1024]; | |
33 | + static const char* contstr = | |
34 | + "\"Content-Type: text/plain; charset="; | |
35 | + | |
36 | + static const char *mblocale[] = | |
37 | + { | |
38 | + "EUC-JP", | |
39 | + "EUC-KR" | |
40 | + }; | |
41 | + | |
42 | + if ( filename == NULL || *filename == '\0' ) | |
43 | + return; | |
44 | + | |
45 | + if ( (fp = fopen(filename, "r")) == NULL ) | |
46 | + return; | |
47 | + | |
48 | + while( fgets(tmpbuf, sizeof(tmpbuf), fp) > 0 ) { | |
49 | + if( !strcmp(tmpbuf, "\n") ) | |
50 | + break; | |
51 | + | |
52 | + if( !strncmp(tmpbuf, contstr, strlen(contstr)) ) { | |
53 | + if( strlen(tmpbuf) > strlen(contstr) ) { | |
54 | + for(i=0; i<sizeof(mblocale)/sizeof(mblocale[0]); i++) { | |
55 | + if( !strncasecmp(tmpbuf + strlen(contstr), | |
56 | + mblocale[i], strlen(mblocale[i])) ) { | |
57 | + mblocale_flag = 1; | |
58 | + break; | |
59 | + } | |
60 | + } | |
61 | + } | |
62 | + } | |
63 | + }; | |
64 | + fclose(fp); | |
65 | +} | |
66 | + | |
67 | +static int ismblocale() { | |
68 | + return mblocale_flag; | |
69 | +} | |
70 | ||
71 | message_ty * | |
72 | message_alloc (msgid) | |
73 | @@ -703,6 +745,15 @@ | |
74 | /* Allow 1 character for the closing quote. */ | |
75 | if (ocol + cw >= (do_wrap == no ? INT_MAX : page_width)) | |
76 | break; | |
77 | + else if (ismblocale() && c >= 0xa1 && c <= 0xfe) { /* UJIS */ | |
78 | + ++ep; | |
79 | + ++cw; | |
80 | + c = (unsigned char) *ep; | |
81 | + if (ocol + cw >= (do_wrap == no ? INT_MAX : page_width - 1 )) { | |
82 | + ++ep; | |
83 | + break; | |
84 | + } | |
85 | + } | |
86 | ocol += cw; | |
87 | if (c == '\n') | |
88 | { | |
89 | @@ -718,7 +769,8 @@ | |
90 | const char *bp; | |
91 | ||
92 | for (bp = ep; bp > s; --bp) | |
93 | - if (bp[-1] == ' ' || bp[-1] == '\n') | |
94 | + if (bp[-1] == ' ' || bp[-1] == '\n' || | |
95 | + (ismblocale() && bp[-1] >= 0xa1 && bp[-1] <= 0xfe) ) /* UJIS */ | |
96 | { | |
97 | ep = bp; | |
98 | break; |