1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
/* This program is for entering simple edict entries.
* Use it with the pregenerated infiles given.
*/
#include <stdio.h>
#include <stdlib.h>
main(int argc, char *argv[]){
FILE *outfile;
int kindex, kindex2;
char english[100];
if(argc != 2){
fprintf(stderr,"We need a filename for output\n");
exit(0);
}
outfile = fopen(argv[1],"w");
if(outfile == NULL){
fprintf(stderr,"Sorry, could not open file\n");
exit(0);
}
while (1) {
char inbuf[100];
char *parse;
printf("Hex JIS char please (up to 2): ");
fgets(inbuf,99,stdin);
if(inbuf[0] == '#')
continue;
kindex2=0;
sscanf(inbuf,"%x %x",&kindex, &kindex2);
if(kindex == 0){
break;
}
puts("Now one line of translation in english");
fgets(inbuf,99,stdin);
/* kill return */
parse = inbuf;
while(*parse != '\n'){
parse++;
}
*parse = '\0';
fputc( ((kindex & 0xff00)>>8) | 0x80, outfile);
fputc((kindex & 0xff) | 0x80, outfile);
fputc( ((kindex2 & 0xff00)>>8) | 0x80, outfile);
fputc((kindex2 & 0xff) | 0x80, outfile);
fprintf(outfile," [");
fputc( ((kindex & 0xff00)>>8) | 0x80, outfile);
fputc((kindex & 0xff) | 0x80, outfile);
fputc( ((kindex2 & 0xff00)>>8) | 0x80, outfile);
fputc((kindex2 & 0xff) | 0x80, outfile);
fputc(']', outfile);
fprintf(outfile," /%s/\n",inbuf);
}
puts("Done");
fflush(outfile);
fclose(outfile);
exit(0);
}
|