File cannaserver-dicdir.patch of Package canna
Index: Canna37p3/server/misc.c
===================================================================
--- Canna37p3.orig/server/misc.c
+++ Canna37p3/server/misc.c
@@ -283,6 +283,7 @@ EarlyInit ()
}
if ((context = RkwInitialize( (char *)ddname )) < 0)
+ PrintMsg("context: %d\n", context);
FatalError("cannaserver:Initialize failed\n") ;
RkwCloseContext( context ) ;
Index: Canna37p3/lib/RK/context.c
===================================================================
--- Canna37p3.orig/lib/RK/context.c
+++ Canna37p3/lib/RK/context.c
@@ -90,9 +90,13 @@ _RkInitialize(ddhome, numCache)
}
gramdic = malloc(strlen(DEFAULTGRAMDIC) + i + 1);
+ printf("gramdic: %p\n", &gramdic);
+ printf("DEFAULTGRAMDIC: %s\n", DEFAULTGRAMDIC);
+ printf("i: %d\n", i);
if (gramdic) {
strcpy(gramdic, ddhome);
strcat(gramdic, DEFAULTGRAMDIC);
+ printf("gramdic: %s\n", gramdic);
SG.gramdic = RkOpenGram(gramdic);
(void)free(gramdic);
if (SG.gramdic) {
@@ -102,6 +106,7 @@ _RkInitialize(ddhome, numCache)
strcpy(path, ddhome);
strcat(path, "/");
strcat(path, USER_DIC_DIR);
+ printf("path: %s\n");
if (mkdir(path, MKDIR_MODE) < 0 &&
errno != EEXIST) {
free(path);
@@ -114,6 +119,7 @@ _RkInitialize(ddhome, numCache)
strcpy(path, ddhome);
strcat(path, "/");
strcat(path, GROUP_DIC_DIR);
+ printf("path1: %s\n");
if (mkdir(path, MKDIR_MODE) < 0 &&
errno != EEXIST) {
free(path);
@@ -125,6 +131,7 @@ _RkInitialize(ddhome, numCache)
dd->dd_next = dd->dd_prev = dd;
sx->ddhome = allocStr(ddhome);
if (sx->ddhome) {
+ printf("fill SG\n");
SG.P_BB = RkGetGramNum(SG.gramdic, "BB");
SG.P_NN = RkGetGramNum(SG.gramdic, "NN");
SG.P_T00 = RkGetGramNum(SG.gramdic, "T00");
@@ -141,8 +148,10 @@ _RkInitialize(ddhome, numCache)
if (_RkInitializeCache(numCache) == 0) {
sx->ddpath = _RkCreateDDP(SYSTEM_DDHOME_NAME);
if (sx->ddpath) {
+ printf("sx->ddpath: %s\n", sx->ddpath);
con = RkwCreateContext();
if (con >= 0) {
+ printf("success\n");
sx->flag |= SX_INITED;
goto return_con;
}
Index: Canna37p3/lib/RK/ngram.c
===================================================================
--- Canna37p3.orig/lib/RK/ngram.c
+++ Canna37p3/lib/RK/ngram.c
@@ -271,6 +271,7 @@ RkOpenGram(mydic)
int fd;
if ((fd = open(mydic, 0)) < 0)
+ printf("can't open mydic: %s\n", mydic);
return (struct RkKxGram *)0;
#ifdef __CYGWIN32__
setmode(fd, O_BINARY);