This is the second patch for "kinput", kana-kanji conversion front-end program in X11R4 contrib/clients. You should specify '-p0' option to 'patch' command to apply this correctly. % cd R4src/contrib/clients/kinput % patch -p0 < thisfile % make % make install This patch fixes the following problems: o dictionary/frequency files aren't saved. o keyboard group supporting code doesn't work correctly. o initialization fails on SVR2 machines. If you have any other problems, please let me know. Makoto Ishisone Software Research Associates, Inc. ishisone@sra.co.jp or ishisone%sra.co.jp@uunet.uu.net diff -c -r ../../tmp/kinput//kinput.c ./kinput.c *** ../../tmp/kinput//kinput.c Thu May 31 16:07:43 1990 --- ./kinput.c Tue Jun 5 11:07:22 1990 *************** *** 23,32 **** */ #ifndef lint ! static char *rcsid = "$Header: /private/usr/mmb/ishisone/job/x11/kinput/RCS/kinput.c,v 3.3 90/01/26 15:32:41 ishisone Exp $"; #endif #include #include #include #ifdef CHECK_PROTOTYPE --- 23,33 ---- */ #ifndef lint ! static char *rcsid = "$Header: /private/usr/mmb/ishisone/job/x11/kinput/RCS/kinput.c,v 3.4 90/06/05 11:04:06 ishisone Exp $"; #endif #include + #include #include #include #ifdef CHECK_PROTOTYPE *************** *** 142,150 **** --- 143,154 ---- }; Widget toplevel; + int done = 0; extern int doConfirm(); + static int Exit(); + void main(ac, av) int ac; *************** *** 186,191 **** --- 190,199 ---- /* set error handler */ XtSetErrorHandler(fatalError); + /* set signal handler */ + signal(SIGINT, Exit); + signal(SIGTERM, Exit); + XtRealizeWidget(toplevel); makeInitialConverter(toplevel, 1); *************** *** 196,206 **** } /* main loop */ ! for (;;) { XtNextEvent(&event); probeEvent(&event); XtDispatchEvent(&event); } } static void --- 204,215 ---- } /* main loop */ ! while (!done) { XtNextEvent(&event); probeEvent(&event); XtDispatchEvent(&event); } + exit(0); } static void *************** *** 552,559 **** endProc(w, (caddr_t)ccp); } ! XtError("Selection Owner Changed"); ! exit(0); } static void --- 561,578 ---- endProc(w, (caddr_t)ccp); } ! /* for saving dictionary/frequency-file */ ! XtDestroyWidget(toplevel); ! /* ! * you can't simply terminate the program like this: ! * XtError("Selection Owner Changed"); ! * exit(0); /-* for sure *-/ ! * because actual widget destruction (which occurs at ! * the end of XtDispatchEvent()) must be done to save ! * dictionary/freq files. ! */ ! XtWarning("Selection Owner Changed"); ! done = 1; } static void *************** *** 715,720 **** --- 734,747 ---- (void)strcat(line, file); (void)strcat(line, "\" ?"); return doConfirm(toplevel, title, line); + } + + static int + Exit() + { + /* for saving dictionary/frequency-file */ + XtDestroyWidget(toplevel); + exit(0); } #ifdef DEBUG Common subdirectories: ../../tmp/kinput//xlocal and ./xlocal Common subdirectories: ../../tmp/kinput//cconv/ccdef and ./cconv/ccdef diff -c -r ../../tmp/kinput//cconv/cconv.c ./cconv/cconv.c *** ../../tmp/kinput//cconv/cconv.c Thu May 31 16:07:45 1990 --- ./cconv/cconv.c Tue Jun 5 11:07:16 1990 *************** *** 1,6 **** /* * cconv.c -- 入力文字変換ライブラリ (for X11) ! * ver 8.3 */ /* --- 1,6 ---- /* * cconv.c -- 入力文字変換ライブラリ (for X11) ! * ver 8.5 */ /* *************** *** 104,109 **** --- 104,115 ---- * したのルールにマッチしてしまうというバグを修正 * 定義ファイル (include ファイルも含む) のサーチパスとして * 環境変数 CC_DEF_PATH を使うように修正 + * version 8.4 90/04/17 + * keyboard group support のコードのケアレスミスを修正 + * 変数名 ks1 と ks2 を間違えた + * version 8.5 90/05/31 + * keyboard group support の不具合を修正 + * 民田氏@アステックからのレポート */ /* *************** *** 494,500 **** */ #ifndef lint ! static char *rcsid = "$Id: cconv.c,v 8.3 90/02/16 20:11:15 ishisone Exp $"; #endif #include --- 500,506 ---- */ #ifndef lint ! static char *rcsid = "$Id: cconv.c,v 8.5 90/05/31 15:06:38 ishisone Exp $"; #endif #include *************** *** 2179,2185 **** */ ks1 = (ulong)XLookupKeysym(event, 0); if (ks1 != NoSymbol) { ! r = convchar(buf, (ulong)ks2 | (ulong)RAWKEY, mask, str, nbytes); } --- 2185,2191 ---- */ ks1 = (ulong)XLookupKeysym(event, 0); if (ks1 != NoSymbol) { ! r = convchar(buf, (ulong)ks1 | (ulong)RAWKEY, mask, str, nbytes); } *************** *** 2187,2199 **** * 考慮した KeySym (つまり XLookupString() が返す KeySym) が * NoSymbol でなければそのコードで変換してみる */ ! if (r < 0 && ks2 != NoSymbol && ks2 != ks1) { mask &= ‾(ShiftMask | LockMask | event->display->mode_switch); r = convchar(buf, (ulong)ks2 | (ulong)RAWKEY, mask, str, nbytes); - } - - if (r < 0) { } if (r < 0) { --- 2193,2203 ---- * 考慮した KeySym (つまり XLookupString() が返す KeySym) が * NoSymbol でなければそのコードで変換してみる */ ! if (r < 0 && ks2 != NoSymbol && ! (mask & (ShiftMask | LockMask | event->display->mode_switch))) { mask &= ‾(ShiftMask | LockMask | event->display->mode_switch); r = convchar(buf, (ulong)ks2 | (ulong)RAWKEY, mask, str, nbytes); } if (r < 0) { diff -c -r ../../tmp/kinput//jclib/jclib.c ./jclib/jclib.c *** ../../tmp/kinput//jclib/jclib.c Thu May 31 16:07:47 1990 --- ./jclib/jclib.c Tue Jun 5 11:07:06 1990 *************** *** 1,6 **** /* * jclib -- かな漢字変換用ライブラリ (Wnn Version4.0 対応版) ! * version 4.0 * ishisone@sra.co.jp */ --- 1,6 ---- /* * jclib -- かな漢字変換用ライブラリ (Wnn Version4.0 対応版) ! * version 4.1 * ishisone@sra.co.jp */ *************** *** 140,145 **** --- 140,149 ---- * resizeBuffer() でドットの再設定を忘れているという重大なバグを修正 * ver 4.0 89/10/27 * バージョン番号を修正して 4.0 にする。 + * --- kinput を R4 に contribute --- + * ver 4.1 90/06/04 + * クライアント側にある辞書・頻度ファイルのセーブができないという + * 重大なバグを修正 */ /* *************** *** 412,418 **** */ #ifndef lint ! static char *rcsid = "$Header: /private/usr/mmb/ishisone/src/jclib/RCS/jclib.c,v 4.0 89/10/27 20:15:01 ishisone Rel $"; #endif #ifdef DEBUG --- 416,422 ---- */ #ifndef lint ! static char *rcsid = "$Header: /private/usr/mmb/ishisone/src/jclib/RCS/jclib.c,v 4.1 90/06/04 10:54:29 ishisone Exp $"; #endif #ifdef DEBUG *************** *** 2284,2293 **** --- 2288,2308 ---- int ndic, i; WNN_DIC_INFO *diclist; struct wnn_env *env = buf->env; + char hname[256]; + int hlen; if ((ndic = js_dic_list(env, &jsbuf)) < 0) return; + /* + * クライアント側のファイルをセーブする時には、そのホストにある + * ファイルかどうかを hostname でチェックする + */ + (void)gethostname(hname, sizeof(hname)); + hname[sizeof(hname) - 2] = '¥0'; + (void)strcat(hname, "!"); + hlen = strlen(hname); + diclist = (WNN_DIC_INFO *)jsbuf.buf; for (i = 0; i < ndic; i++) { /* 登録可能形式でない辞書をセーブする必要はないだろう */ *************** *** 2296,2304 **** if (diclist->localf) { (void)js_file_write(env, diclist->body, diclist->fname); ! } else { (void)js_file_receive(env, diclist->body, ! diclist->fname); } } if (diclist->hindo >= 0) { --- 2311,2319 ---- if (diclist->localf) { (void)js_file_write(env, diclist->body, diclist->fname); ! } else if (!strncmp(diclist->fname, hname, hlen)) { (void)js_file_receive(env, diclist->body, ! NULL); } } if (diclist->hindo >= 0) { *************** *** 2306,2314 **** if (diclist->hlocalf) { (void)js_file_write(env, diclist->hindo, diclist->hfname); ! } else { (void)js_file_receive(env, diclist->hindo, ! diclist->hfname); } } diclist++; --- 2321,2329 ---- if (diclist->hlocalf) { (void)js_file_write(env, diclist->hindo, diclist->hfname); ! } else if (!strncmp(diclist->hfname, hname, hlen)) { (void)js_file_receive(env, diclist->hindo, ! NULL); } } diclist++; diff -c -r ../../tmp/kinput//jclib/jilib.c ./jclib/jilib.c *** ../../tmp/kinput//jclib/jilib.c Thu May 31 16:07:49 1990 --- ./jclib/jilib.c Tue Jun 5 11:07:08 1990 *************** *** 1,6 **** /* * jilib -- かな漢字変換用ライブラリ (Wnn Version4.0 対応版) ! * version 4.3 * ishisone@sra.co.jp */ --- 1,6 ---- /* * jilib -- かな漢字変換用ライブラリ (Wnn Version4.0 対応版) ! * version 4.6 * ishisone@sra.co.jp */ *************** *** 97,102 **** --- 97,112 ---- * ver 4.3 90/02/20 * 頻度ファイルが辞書とマッチしなかった時に、単にエラーにする * 代わりに頻度ファイルを作り直すように変更 + * ver 4.4 90/03/26 + * ディレクトリを作るのに /bin/mkdir を system() で起動する時、 + * (普通は mkdir() システムコールを使うので SYSVR2 の時だけだが) + * SIGCHLD (SIGCLD) のハンドラが定義されているとそのリターン値が + * おかしくなってエラーになることがあるというバグを修正 + * ver 4.5 90/03/26 + * 4.4 の修正で signal.h を include するのを忘れていた + * ver 4.6 90/04/02 + * wnnenvrc ファイルの setdic 行の処理が間違っていた。最後の引数を + * 評価しないというバグを修正 (逆変換の指定が効かなかった) */ /* *************** *** 187,193 **** */ #ifndef lint ! static char *rcsid = "$Header: /private/usr/mmb/ishisone/src/jclib/RCS/jilib.c,v 4.3 90/02/20 14:35:08 ishisone Exp $"; #endif #include --- 197,203 ---- */ #ifndef lint ! static char *rcsid = "$Header: /private/usr/mmb/ishisone/src/jclib/RCS/jilib.c,v 4.6 90/04/02 11:19:03 ishisone Exp $"; #endif #include *************** *** 220,225 **** --- 230,237 ---- #if !defined(SYSV) || defined(USG) #define HAVE_MKDIRSYS + #else + #include /* for SIGCLD */ #endif #define ERROR_LOAD -2 *************** *** 581,591 **** #else { char buf[1024]; /*enough?*/ (void)sprintf(buf, "/bin/mkdir %s", dir); ! if (system(buf) != 0) ! return -1; ! else ! return 0; } #endif } else { --- 593,604 ---- #else { char buf[1024]; /*enough?*/ + int (*ohandle)() = signal(SIGCLD, SIG_DFL); + int ret; (void)sprintf(buf, "/bin/mkdir %s", dir); ! ret = system(buf); ! (void)signal(SIGCLD, ohandle); ! return (ret != 0) ? -1 : 0; } #endif } else { *************** *** 1240,1259 **** rev = 0; dicpasswd = hindopasswd = NULL; ! if (ac > 3 && strcmp(av[2], "-")) { (void)strcpy(hindofilebuf, av[2]); hindofilename = expandDicPath(hindofilebuf, env); } ! if (ac > 4) { prio = atoi(av[3]); } ! if (ac > 5) { dicro = atoi(av[4]); } ! if (ac > 6) { hindoro = atoi(av[5]); } ! if (ac > 7 && strcmp(av[6], "-")) { (void)strcpy(dicpasswdbuf, av[6]); dicpasswd = getdicpasswd(expandDicPath(dicpasswdbuf, env)); /* パスワードが読めなくても、エラーにはしない */ --- 1253,1272 ---- rev = 0; dicpasswd = hindopasswd = NULL; ! if (ac >= 3 && strcmp(av[2], "-")) { (void)strcpy(hindofilebuf, av[2]); hindofilename = expandDicPath(hindofilebuf, env); } ! if (ac >= 4) { prio = atoi(av[3]); } ! if (ac >= 5) { dicro = atoi(av[4]); } ! if (ac >= 6) { hindoro = atoi(av[5]); } ! if (ac >= 7 && strcmp(av[6], "-")) { (void)strcpy(dicpasswdbuf, av[6]); dicpasswd = getdicpasswd(expandDicPath(dicpasswdbuf, env)); /* パスワードが読めなくても、エラーにはしない */ *************** *** 1262,1268 **** "can't read password for %s", dicfilename); } } ! if (hindofilename && ac > 8 && strcmp(av[7], "-")) { (void)strcpy(dicpasswdbuf, av[7]); hindopasswd = getdicpasswd(expandDicPath(hindopasswdbuf, env)); /* パスワードが読めなくても、エラーにはしない */ --- 1275,1281 ---- "can't read password for %s", dicfilename); } } ! if (hindofilename && ac >= 8 && strcmp(av[7], "-")) { (void)strcpy(dicpasswdbuf, av[7]); hindopasswd = getdicpasswd(expandDicPath(hindopasswdbuf, env)); /* パスワードが読めなくても、エラーにはしない */ *************** *** 1271,1277 **** "can't read password for %s", hindofilename); } } ! if (ac > 9) { rev = atoi(av[8]); } --- 1284,1290 ---- "can't read password for %s", hindofilename); } } ! if (ac >= 9) { rev = atoi(av[8]); }