Path: blob/main/chinese/c2t/files/patch-c2t.c
16461 views
--- c2t.c.orig 1993-02-24 14:29:23.000000000 +08001+++ c2t.c 2011-09-05 14:25:34.000000000 +08002@@ -18,14 +18,18 @@34#define MEMAREA 4096 /* max number of lines in DICT file, wc -l DICT */56-main(argc, argv)7+int main(argc, argv)8int argc;9char **argv;10{11+#ifndef CHINDICT12char *DICT="/home/ftp/software/unix/X-Window/cxterm-dictionary/TONEPY.tit";13+#else14+ char *DICT=CHINDICT;15+#endif16register int eka=0, toka=0, i=0;17register char hz[4], **pipo=0;18- register char **taulu=0, rivi[82];19+ char **taulu=0, rivi[82];20register int rpit=0, tila=0, rraja=0, mulpin=0;21int monitila=0;22FILE *piffi=0;23@@ -57,12 +61,12 @@ char **argv;24i =0;25} /*if argc > 1 */26if ((piffi = fopen (DICT, "r")) == 0) {27- printf (stderr, "Error: unable to open pinyin dictionnary %s\n",28+ fprintf (stderr, "Error: unable to open pinyin dictionnary %s\n",29DICT);30exit (-1);31}32if ((taulu = (char **)malloc (MEMAREA*sizeof(char *))) == 0) {33- printf (stderr, "Error: out of memory when allocating taulu(MEMAREA too large)\n");34+ fprintf (stderr, "Error: out of memory when allocating taulu(MEMAREA too large)\n");35exit (-2);36}37pipo = taulu;38@@ -81,13 +85,13 @@ char **argv;39} else {40if (rivi[0] == '#') continue;41if ((*pipo = (char *)malloc (rpit+8)) == 0) {42- printf (stderr, "Error: out of memory when allocating *pipo\n");43+ fprintf (stderr, "Error: out of memory when allocating *pipo\n");44exit (-3);45}46strcpy (*pipo, rivi);47pipo++;48if (++rraja >= MEMAREA) {49- printf (stderr, "Error: out of memory when allocating *pipo(MEMAREA too small)...\n");50+ fprintf (stderr, "Error: out of memory when allocating *pipo(MEMAREA too small)...\n");51exit (-4);52}53}545556