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