|
Lines 38-43
Link Here
|
| 38 |
#include <stdio.h> |
38 |
#include <stdio.h> |
| 39 |
#include <string.h> |
39 |
#include <string.h> |
| 40 |
#include <unistd.h> |
40 |
#include <unistd.h> |
|
|
41 |
#include <ctype.h> |
| 41 |
#include <iconv.h> |
42 |
#include <iconv.h> |
| 42 |
|
43 |
|
| 43 |
char texencoding[128]="",*cjkencoding=NULL,cjkfont[128]=""; |
44 |
char texencoding[128]="",*cjkencoding=NULL,cjkfont[128]=""; |
|
Lines 307-312
Link Here
|
| 307 |
main(int argc, char *argv[]) |
308 |
main(int argc, char *argv[]) |
| 308 |
{ |
309 |
{ |
| 309 |
int ch; |
310 |
int ch; |
|
|
311 |
char *p; |
| 310 |
|
312 |
|
| 311 |
while ((ch = getopt(argc, argv, "ce:f:")) != -1) |
313 |
while ((ch = getopt(argc, argv, "ce:f:")) != -1) |
| 312 |
{ |
314 |
{ |
|
Lines 316-330
Link Here
|
| 316 |
ccmap_enable=1; |
318 |
ccmap_enable=1; |
| 317 |
break; |
319 |
break; |
| 318 |
case 'e': |
320 |
case 'e': |
| 319 |
if(strcmp(optarg,"GB2312")==0) cjkencoding="GB"; |
321 |
if(strcasecmp(optarg,"GB2312")==0) cjkencoding="GB"; |
| 320 |
else if(strcmp(optarg,"GBK")==0) cjkencoding="GBK"; |
322 |
else if(strcasecmp(optarg,"GBK")==0) cjkencoding="GBK"; |
| 321 |
else if(strcmp(optarg,"GB18030")==0) cjkencoding="GBK"; /* Not supported by CJK yet */ |
323 |
else if(strcasecmp(optarg,"GB18030")==0) cjkencoding="GBK"; /* Not supported by CJK yet */ |
| 322 |
else if(strcmp(optarg,"BIG5")==0) cjkencoding="Bg5"; |
324 |
else if(strcasecmp(optarg,"BIG5")==0) cjkencoding="Bg5"; |
| 323 |
else if(strcmp(optarg,"EUCJP")==0) cjkencoding="JIS"; |
325 |
else if(strcasecmp(optarg,"EUCJP")==0) cjkencoding="JIS"; |
| 324 |
else if(strcmp(optarg,"EUCKR")==0) cjkencoding="KS"; |
326 |
else if(strcasecmp(optarg,"EUCKR")==0) cjkencoding="KS"; |
| 325 |
else if(strcmp(optarg,"UTF-8")==0) cjkencoding="UTF8"; |
327 |
else if(strcasecmp(optarg,"UTF-8")==0) cjkencoding="UTF8"; |
| 326 |
else cjkencoding=NULL; |
328 |
else cjkencoding=NULL; |
| 327 |
if(cjkencoding!=NULL) strlcpy(texencoding,optarg,sizeof(texencoding)); |
329 |
if(cjkencoding!=NULL) |
|
|
330 |
{ |
| 331 |
strlcpy(texencoding,optarg,sizeof(texencoding)); |
| 332 |
for(p=texencoding;*p!=0;p++) |
| 333 |
*p=toupper((int)((unsigned char)*p)); |
| 334 |
} |
| 328 |
break; |
335 |
break; |
| 329 |
case 'f': |
336 |
case 'f': |
| 330 |
strlcpy(cjkfont,optarg,sizeof(cjkfont)); |
337 |
strlcpy(cjkfont,optarg,sizeof(cjkfont)); |