KENJIRO comes to get a dictionary list from a NDTP server by
applying the following patch.

KENJIRO is a NDTP client software, included in the DSERVER
distribution.


*** kenjiro/kenjiro.h.ORG	Tue Jun 27 01:21:31 1995
--- kenjiro/kenjiro.h	Fri Jan  2 19:57:59 1998
***************
*** 20,25 ****
--- 20,26 ----
  #define BAD		3
  #define ENG		0
  #define JPN		1
+ #define UNKNOWN		2
  #define TOROM()		if ( inkan ) { fputs(toroma,stdout); inkan = 0; }
  #define TOKAN()		if ( !inkan ) { fputs(tokanzi,stdout); inkan = 1; }
  #define KANJI(a)	a & 128
***************
*** 41,55 ****
  #define F(n) (1 << n)
  
  typedef struct {
! 	char name[10];
! 	unsigned char prompt[25];
  	int inputmode;
  	int filter;
  } dicttype;
  
  #include "config.h"
- 
- #define MAXMODE		sizeof(dictionaries)/sizeof(dicttype)
  
  typedef struct {
  	char *roma;
--- 42,54 ----
  #define F(n) (1 << n)
  
  typedef struct {
! 	char name[64];
! 	unsigned char prompt[128];
  	int inputmode;
  	int filter;
  } dicttype;
  
  #include "config.h"
  
  typedef struct {
  	char *roma;
*** kenjiro/sub.c.ORG	Tue Jun 27 01:21:31 1995
--- kenjiro/sub.c	Fri Jan  2 21:59:42 1998
***************
*** 13,24 ****
  int numk;
  int mode;
  int fd1 = 0;
! int inputmode;
  int co, li;
  unsigned char *prompt;
  
  int current_dict_num;
  
  void romakana_stty()
  {
  #ifdef TERMIO
--- 13,32 ----
  int numk;
  int mode;
  int fd1 = 0;
! int inputmode = ENG;
  int co, li;
  unsigned char *prompt;
  
  int current_dict_num;
  
+ int maxmode = 4;
+ dicttype dictionaries[KOUHO] = {
+ 	{ "nodict" , "»ØÄê¼­½ñ¤Ê¤·"	, ENG ,  },
+ 	{ "eiwa"   , "±ÑÏÂ¼­Åµ"	, ENG ,  },
+ 	{ "waei"   , "ÏÂ±Ñ¼­Åµ"	, JPN ,  },
+ 	{ "kojien" , "¹ñ¸ì¼­Åµ"	, JPN ,  },
+ };
+ 
  void romakana_stty()
  {
  #ifdef TERMIO
***************
*** 199,205 ****
  	int j;
  
  	for (j = 0;j < numk;j++) {
! 		if (j + i >= MAXMODE) break;
  		putchar('\n');
  		printf("%d. ",(j==9)?0:j+1);
  		dispstr(dictionaries[j+i].prompt);
--- 207,213 ----
  	int j;
  
  	for (j = 0;j < numk;j++) {
! 		if (j + i >= maxmode) break;
  		putchar('\n');
  		printf("%d. ",(j==9)?0:j+1);
  		dispstr(dictionaries[j+i].prompt);
***************
*** 227,239 ****
  	if (ch == '*') {
  		mode = i;
  		prompt = dictionaries[mode].prompt;
! 		inputmode = dictionaries[mode].inputmode;
  		current_dict_num=mode;
  		return TRUE;
  	} else if (ch == '&') {
  		mode = 0;
  		prompt = dictionaries[mode].prompt;
! 		inputmode = dictionaries[mode].inputmode;
  		current_dict_num=mode;
  		return FALSE;
  	} else {
--- 235,249 ----
  	if (ch == '*') {
  		mode = i;
  		prompt = dictionaries[mode].prompt;
! 		if (dictionaries[mode].inputmode != UNKNOWN)
! 			inputmode = dictionaries[mode].inputmode;
  		current_dict_num=mode;
  		return TRUE;
  	} else if (ch == '&') {
  		mode = 0;
  		prompt = dictionaries[mode].prompt;
! 		if (dictionaries[mode].inputmode != UNKNOWN)
! 			inputmode = dictionaries[mode].inputmode;
  		current_dict_num=mode;
  		return FALSE;
  	} else {
***************
*** 269,279 ****
  			break; */
  		case 'n':
  			i += numk;
! 			if (i >= MAXMODE) i = 0;
  			goto j2;
  		case 'p':
  			i -= numk;
! 			if (i < 0) i = (MAXMODE / numk) * numk;
  j2:			printf("%c",c);
  			print_dict(i);
  			break;
--- 279,289 ----
  			break; */
  		case 'n':
  			i += numk;
! 			if (i >= maxmode) i = 0;
  			goto j2;
  		case 'p':
  			i -= numk;
! 			if (i < 0) i = (maxmode / numk) * numk;
  j2:			printf("%c",c);
  			print_dict(i);
  			break;
***************
*** 281,287 ****
  			j = ((c=='0')? 9:c-'1');
  			if (j >= numk) break;
  			j += i;
! 			if (j >= MAXMODE) break;
  			printf("%c\n",c);
  			if (!(set_dict(j))) 
  				dispstr("Can't change to that dictionary\n");
--- 291,297 ----
  			j = ((c=='0')? 9:c-'1');
  			if (j >= numk) break;
  			j += i;
! 			if (j >= maxmode) break;
  			printf("%c\n",c);
  			if (!(set_dict(j))) 
  				dispstr("Can't change to that dictionary\n");
***************
*** 294,300 ****
  {
  	int i;
  
! 	for(i=0;i<MAXMODE;i++)
  		if (set_dict(i)) return;
  	fprintf(stderr,"No dictionaries are available!\n");
  	quit();
--- 304,310 ----
  {
  	int i;
  
! 	for(i=0;i<maxmode;i++)
  		if (set_dict(i)) return;
  	fprintf(stderr,"No dictionaries are available!\n");
  	quit();
*** kenjiro/config.h.ORG	Tue Jun 27 01:21:34 1995
--- kenjiro/config.h	Fri Jan  2 20:04:01 1998
***************
*** 9,20 ****
  #ifdef PORT
  #undef SERVICE
  #endif 
- 
- static dicttype dictionaries[] = {
- 	{ "nodict" , "»ØÄê¼­½ñ¤Ê¤·"	, ENG ,  },
- 	{ "eiwa"   , "¸¦µæ¼Ò±ÑÏÂ"	, ENG ,  },
- 	{ "waei"   , "¸¦µæ¼ÒÏÂ±Ñ"	, JPN ,  },
- 	{ "kojien" , "¹­¼­±ñ"		, JPN ,  },
- 	{ "CDkojien" , "CD¹­¼­±ñ"		, JPN ,  },
- 	{ "readers" , "¥ê¡¼¥À¡¼¤º±ÑÏÂ"		, ENG ,  },
- };
--- 9,11 ----
*** kenjiro/read.c.ORG	Tue Jun 27 01:21:30 1995
--- kenjiro/read.c	Fri Jan  2 21:31:47 1998
***************
*** 4,9 ****
--- 4,11 ----
  extern int mode;
  extern int mflag;
  extern int numk;
+ extern int maxmode;
+ extern dicttype dictionaries[];
  
  int read_to_ret(buf)
  char *buf;
***************
*** 162,164 ****
--- 164,198 ----
  	if ((mflag) && (len >= li)) disp_with_more();
  	else disp_cat();
  }
+ 
+ int read_dictionaries()
+ {
+ 	char buf[LBUF], name[LBUF], prompt[LBUF];
+ 
+ 	write1("T\n",2);
+ 	read_to_ret(buf);
+ 	if (strcmp(buf, "$I") == 0) {
+ 		read_to_ret(buf);
+ 	} else if (strcmp(buf, "$?") == 0) {
+ 		return TRUE;
+ 	}
+ 
+ 	for (maxmode = 1; strcmp(buf, "$*") != 0 && maxmode < KOUHO;
+ 		maxmode++) {
+ 		if (buf[0] == ' ')
+ 			sscanf(buf, " %s\t%s", name, prompt);
+ 		else
+ 			sscanf(buf, "%s\t%s", name, prompt);
+ 		strcpy(dictionaries[maxmode].name, name);
+ 		strcpy(dictionaries[maxmode].prompt, prompt);
+ 		dictionaries[maxmode].inputmode = UNKNOWN;
+ 		read_to_ret(buf);
+ 	}
+ 	if (maxmode == KOUHO) {
+ 		while (strcmp(buf, "$*") != 0)
+ 			read_to_ret(buf);
+ 	}
+ 
+ 	return TRUE;
+ }
+ 
*** kenjiro/main.c.ORG	Tue Jun 27 01:21:30 1995
--- kenjiro/main.c	Sat Jan  3 14:09:39 1998
***************
*** 98,103 ****
--- 98,104 ----
  
  	entry();
  
+ 	read_dictionaries();
  	init_mode();
  	use_word();
  }
*** kenjiro/filter.c.ORG	Tue Jun 27 01:21:31 1995
--- kenjiro/filter.c	Fri Jan  2 20:20:39 1998
***************
*** 2,7 ****
--- 2,8 ----
  
  extern int co;
  extern int mode;
+ extern dicttype dictionaries[];
  datatype data;
  
  #define set_one_char(c) cpt->dt[i++] = c;\
