Index: kterm/KTerm.ad
diff -c kterm/KTerm.ad:1.1.1.1 kterm/KTerm.ad:1.4
*** kterm/KTerm.ad:1.1.1.1	Fri Apr  7 18:06:45 2000
--- kterm/KTerm.ad	Fri Apr 14 01:15:27 2000
***************
*** 45,59 ****
  *vtMenu*vthide*Label:  Hide VT Window
  *vtMenu*statusline*Label:  Enable Status Line
  *vtMenu*reversestatus*Label:  Status Line Reverse Video
! *vtMenu*eucmode*Label:  Japanese EUC Mode
  *vtMenu*sjismode*Label:  Shift-JIS Mode
  *vtMenu*openim*Label:  Open Input Method
  
  *fontMenu.Label:  VT Fonts
  *fontMenu*fontdefault*Label:	Default
! *VT100*fontList:	-*-fixed-medium-r-normal--14-*,\
! 			-*-gothic-medium-r-normal--14-*,\
! 			-*-mincho-medium-r-normal--14-*
  !*VT100*boldFontList:	-*-fixed-bold-r-normal--14-*,\
  !			-*-gothic-bold-r-normal--14-*,\
  !			-*-mincho-bold-r-normal--14-*
--- 45,61 ----
  *vtMenu*vthide*Label:  Hide VT Window
  *vtMenu*statusline*Label:  Enable Status Line
  *vtMenu*reversestatus*Label:  Status Line Reverse Video
! *vtMenu*eucjpmode*Label:  Japanese EUC Mode
  *vtMenu*sjismode*Label:  Shift-JIS Mode
+ *vtMenu*euckrmode*Label:  Korean EUC Mode
+ *vtMenu*fontstrict*Label:  Strict Charset Match
  *vtMenu*openim*Label:  Open Input Method
  
  *fontMenu.Label:  VT Fonts
  *fontMenu*fontdefault*Label:	Default
! *VT100*fontList:	-*-fixed-medium-r-normal--16-*,\
! 			-*-gothic-medium-r-normal--16-*,\
! 			-*-mincho-medium-r-normal--16-*
  !*VT100*boldFontList:	-*-fixed-bold-r-normal--14-*,\
  !			-*-gothic-bold-r-normal--14-*,\
  !			-*-mincho-bold-r-normal--14-*
Index: kterm/VTPrsTbl.c
diff -c kterm/VTPrsTbl.c:1.1.1.1 kterm/VTPrsTbl.c:1.2
*** kterm/VTPrsTbl.c:1.1.1.1	Fri Apr  7 18:06:46 2000
--- kterm/VTPrsTbl.c	Fri Apr  7 18:09:11 2000
***************
*** 2746,2769 ****
  #ifdef KTERM
  /*	0		1		2		3	*/
  CASE_GSETS,
! CASE_GSETS,
! CASE_GSETS,
! CASE_GSETS,
  /*	4		5		6		7	*/
! CASE_GSETS,
! CASE_GSETS,
! CASE_GSETS,
! CASE_GSETS,
  /*	8		9		:		;	*/
! CASE_GSETS,
! CASE_GSETS,
! CASE_GSETS,
! CASE_GSETS,
  /*	<		=		>		?	*/
! CASE_GSETS,
! CASE_GSETS,
! CASE_GSETS,
! CASE_GSETS,
  /*	@		A		B		C	*/
  CASE_GSETS,
  CASE_GSETS,
--- 2746,2769 ----
  #ifdef KTERM
  /*	0		1		2		3	*/
  CASE_GSETS,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*	4		5		6		7	*/
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*	8		9		:		;	*/
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*	<		=		>		?	*/
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*	@		A		B		C	*/
  CASE_GSETS,
  CASE_GSETS,
***************
*** 2823,2847 ****
  CASE_GSETS,
  CASE_GSETS,
  CASE_GSETS,
! CASE_GROUND_STATE, /* GSET('p') >= 0x40 (MBCS flag) */
  /*	p		q		r		s	*/
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*	t		u		v		w	*/
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*	x		y		z		{	*/
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*	|		}		~		DEL	*/
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  CASE_GROUND_STATE, /* empty character set */
  CASE_GROUND_STATE,
  #else /* !KTERM */
--- 2823,2847 ----
  CASE_GSETS,
  CASE_GSETS,
  CASE_GSETS,
! CASE_GSETS,
  /*	p		q		r		s	*/
! CASE_GSETS,
! CASE_GSETS,
! CASE_GSETS,
! CASE_GSETS,
  /*	t		u		v		w	*/
! CASE_GSETS,
! CASE_GSETS,
! CASE_GSETS,
! CASE_GSETS,
  /*	x		y		z		{	*/
! CASE_GSETS,
! CASE_GSETS,
! CASE_GSETS,
! CASE_GSETS,
  /*	|		}		~		DEL	*/
! CASE_GSETS,
! CASE_GSETS,
  CASE_GROUND_STATE, /* empty character set */
  CASE_GROUND_STATE,
  #else /* !KTERM */
Index: kterm/button.c
diff -c kterm/button.c:1.1.1.1 kterm/button.c:1.2
*** kterm/button.c:1.1.1.1	Fri Apr  7 18:06:46 2000
--- kterm/button.c	Fri Apr 14 00:51:23 2000
***************
*** 368,374 ****
  	int n;
  	int convCStoJIS();
  # ifdef KTERM_KANJIMODE
! 	int convCStoEUC(), convCStoSJIS();
  # endif /* KTERM_KANJIMODE */
  	Ichr cbuf[256 + 1];
  
--- 368,374 ----
  	int n;
  	int convCStoJIS();
  # ifdef KTERM_KANJIMODE
! 	int convCStoEUCJP(), convCStoEUCKR(), convCStoSJIS();
  # endif /* KTERM_KANJIMODE */
  	Ichr cbuf[256 + 1];
  
***************
*** 382,390 ****
  	(void)convCTtoCS(ct, *length, cs);
  
  # ifdef KTERM_KANJIMODE
! 	switch (((XtermWidget)w)->flags & (EUC_KANJI|SJIS_KANJI)) {
  	case EUC_KANJI:
! 	    func = convCStoEUC;
  	    break;
  	case SJIS_KANJI:
  	    func = convCStoSJIS;
--- 382,393 ----
  	(void)convCTtoCS(ct, *length, cs);
  
  # ifdef KTERM_KANJIMODE
! 	switch (((XtermWidget)w)->flags & (EUC_KANJI|SJIS_KANJI|EUC_KOREAN)) {
  	case EUC_KANJI:
! 	    func = convCStoEUCJP;
! 	    break;
! 	case EUC_KOREAN:
! 	    func = convCStoEUCKR;
  	    break;
  	case SJIS_KANJI:
  	    func = convCStoSJIS;
Index: kterm/charproc.c
diff -c kterm/charproc.c:1.1.1.1 kterm/charproc.c:1.4
*** kterm/charproc.c:1.1.1.1	Fri Apr  7 18:06:47 2000
--- kterm/charproc.c	Fri Apr 14 00:51:23 2000
***************
*** 1200,1209 ****
  			screen->curss = 0;
  			continue;
  		}
! 	        switch (parsestate[c]) {
  #else /* !KTERM_KANJIMODE */
! 	        switch (parsestate[c = doinput()]) {
  #endif /* !KTERM_KANJIMODE */
  		 case CASE_PRINT:
  			/* printable characters */
  #ifdef KTERM
--- 1200,1210 ----
  			screen->curss = 0;
  			continue;
  		}
! 	        switch (parsestate[c])
  #else /* !KTERM_KANJIMODE */
! 	        switch (parsestate[c = doinput()])
  #endif /* !KTERM_KANJIMODE */
+ 		{
  		 case CASE_PRINT:
  			/* printable characters */
  #ifdef KTERM
***************
*** 1773,1779 ****
--- 1774,1788 ----
  
  		 case CASE_GSETS:
  #ifdef KTERM
+ 			if (c == '0' && !cs96
  # ifdef KTERM_MBCS
+ 			    && !mbcs
+ # endif
+ 			    ) { /* hack for ESC ( 0 */
+ 				c = '@' - 1;
+ 				cs96 = CS96;
+ 			}
+ # ifdef KTERM_MBCS
  			screen->gsets[scstype] = GSET(c) | cs96 | mbcs;
  # else /* !KTERM_MBCS */
  			screen->gsets[scstype] = GSET(c) | cs96;
***************
*** 1958,1968 ****
  			restoremodes(term);
  			parsestate = groundtable;
  			break;
- #ifdef KTERM_KANJIMODE
- 		}
- #else /* !KTERM_KANJIMODE */
  		}
- #endif /* !KTERM_KANJIMODE */
  	}
  }
  
--- 1967,1973 ----
***************
*** 3564,3572 ****
  	setupgset();
  	screen->gsets[0] = GSET_ASCII;
  # ifdef KTERM_KANJIMODE
! 	screen->gsets[1] = (term->flags & EUC_KANJI) ? GSET_KANJI : GSET_KANA;
! 	screen->gsets[2] = (term->flags & EUC_KANJI) ? GSET_KANA : GSET_ASCII;
! 	screen->gsets[3] = (term->flags & EUC_KANJI) ? GSET_HOJOKANJI : GSET_ASCII;
  # else /* !KTERM_KANJIMODE */
  	screen->gsets[1] = GSET_KANA;
  	screen->gsets[2] = GSET_ASCII;
--- 3569,3591 ----
  	setupgset();
  	screen->gsets[0] = GSET_ASCII;
  # ifdef KTERM_KANJIMODE
! 	switch (term->flags & (EUC_KANJI | SJIS_KANJI | EUC_KOREAN)) {
! 	case EUC_KANJI:
! 		screen->gsets[1] = GSET_KANJI;
! 		screen->gsets[2] = GSET_KANA;
! 		screen->gsets[3] = GSET_HOJOKANJI;
! 		break;
! 	case EUC_KOREAN:
! 		screen->gsets[1] = GSET_HANJA;
! 		screen->gsets[2] = GSET_ASCII;
! 		screen->gsets[3] = GSET_ASCII;
! 		break;
! 	default:
! 		screen->gsets[1] = GSET_KANA;
! 		screen->gsets[2] = GSET_ASCII;
! 		screen->gsets[3] = GSET_ASCII;
! 		break;
! 	}
  # else /* !KTERM_KANJIMODE */
  	screen->gsets[1] = GSET_KANA;
  	screen->gsets[2] = GSET_ASCII;
***************
*** 4104,4115 ****
  #ifdef KTERM
  		screen->gsets[0] = GSET_ASCII;
  # ifdef KTERM_KANJIMODE
! 		screen->gsets[1] = (term->flags & EUC_KANJI)
! 					? GSET_KANJI : GSET_KANA;
! 		screen->gsets[2] = (term->flags & EUC_KANJI)
! 					? GSET_KANA : GSET_ASCII;
! 		screen->gsets[3] = (term->flags & EUC_KANJI)
! 					? GSET_HOJOKANJI : GSET_ASCII;
  # else /* !KTERM_KANJIMODE */
  		screen->gsets[1] = GSET_KANA;
  		screen->gsets[2] = GSET_ASCII;
--- 4123,4145 ----
  #ifdef KTERM
  		screen->gsets[0] = GSET_ASCII;
  # ifdef KTERM_KANJIMODE
! 		switch (term->flags & (EUC_KANJI | SJIS_KANJI | EUC_KOREAN)) {
! 		case EUC_KANJI:
! 			screen->gsets[1] = GSET_KANJI;
! 			screen->gsets[2] = GSET_KANA;
! 			screen->gsets[3] = GSET_HOJOKANJI;
! 			break;
! 		case EUC_KOREAN:
! 			screen->gsets[1] = GSET_HANJA;
! 			screen->gsets[2] = GSET_ASCII;
! 			screen->gsets[3] = GSET_ASCII;
! 			break;
! 		default:
! 			screen->gsets[1] = GSET_KANA;
! 			screen->gsets[2] = GSET_ASCII;
! 			screen->gsets[3] = GSET_ASCII;
! 			break;
! 		}
  # else /* !KTERM_KANJIMODE */
  		screen->gsets[1] = GSET_KANA;
  		screen->gsets[2] = GSET_ASCII;
***************
*** 4713,4718 ****
--- 4743,4751 ----
  				}
  			}
  		}
+ 
+ 		if (screen->font_strict)
+ 			break;
  	}
  	return NULL;
  }
Index: kterm/convert.c
diff -c kterm/convert.c:1.1.1.1 kterm/convert.c:1.2
*** kterm/convert.c:1.1.1.1	Fri Apr  7 18:06:47 2000
--- kterm/convert.c	Fri Apr 14 00:51:23 2000
***************
*** 43,51 ****
  	return convCStoANY(cs, js, NULL);
  }
  
! /* CS -> EUC */
  static int
! CStoEUC(cs_p, es_p)
  Ichr	**cs_p;
  Char	**es_p;
  {
--- 43,51 ----
  	return convCStoANY(cs, js, NULL);
  }
  
! /* CS -> EUCJP */
  static int
! CStoEUCJP(cs_p, es_p)
  Ichr	**cs_p;
  Char	**es_p;
  {
***************
*** 76,86 ****
  }
  
  int
! convCStoEUC(cs, es)
  Ichr	*cs;
  Char	*es;
  {
! 	return convCStoANY(cs, es, CStoEUC);
  }
  
  /* CS -> SJIS */
--- 76,126 ----
  }
  
  int
! convCStoEUCJP(cs, es)
  Ichr	*cs;
  Char	*es;
  {
! 	return convCStoANY(cs, es, CStoEUCJP);
! }
! 
! /* CS -> EUCKR */
! static int
! CStoEUCKR(cs_p, es_p)
! Ichr	**cs_p;
! Char	**es_p;
! {
! 	int	c1, c2;
! 	Ichr	*cs = *cs_p;
! 	Char	*es = *es_p;
! 	if (cs->gset == GSET_KANA) {
! 		c1 = cs++->code;
! 		if (es) {
! 			*es++ = SS2;
! 			*es++ = c1 | 0x80;
! 		}
! 		*es_p = es;
! 		*cs_p = cs;
! 		return 2;
! 	} else if (cs->gset == GSET_HANJA) {
! 		c1 = cs++->code;
! 		c2 = cs++->code;
! 		if (es) {
! 			*es++ = c1 | 0x80;
! 			*es++ = c2 | 0x80;
! 		}
! 		*es_p = es;
! 		*cs_p = cs;
! 		return 2;
! 	}
! 	return 0;
! }
! 
! int
! convCStoEUCKR(cs, es)
! Ichr	*cs;
! Char	*es;
! {
! 	return convCStoANY(cs, es, CStoEUCKR);
  }
  
  /* CS -> SJIS */
Index: kterm/gset.c
diff -c kterm/gset.c:1.1.1.1 kterm/gset.c:1.5
*** kterm/gset.c:1.1.1.1	Fri Apr  7 18:06:47 2000
--- kterm/gset.c	Mon Apr 10 01:15:40 2000
***************
*** 28,149 ****
  #include "ptyx.h"
  #include "data.h"
  
  int gsettofnum[256];
  Boolean gsetontheright[256];
! Char *gsetmaponfont[256];
! static Char irv[128];
! static Char uk[128];
! static Char swedish[128];
! static Char norwegian[128];
! static Char german[128];
! static Char french[128];
! static Char italian[128];
! static Char spanish[128];
  
! void
! setupgset()
  {
! 	int i;
  
! 	for (i = 0; i < 128; i ++) {
! 		irv[i] = uk[i] = swedish[i] = norwegian[i] =
! 		 german[i] = french[i] = italian[i] = spanish[i] = i;
  	}
  
  	gsettofnum[GSET_GRAPH] = F_ISO8859_1;
  	gsetontheright[GSET_GRAPH] = False;
  
  	gsettofnum[GSET_IRV] = F_ISO8859_1;
  	gsetontheright[GSET_IRV] = False;
! 	gsetmaponfont[GSET_IRV] = irv;
! 	irv['$'] = '\244';	/* currency sign */
! 	irv['~'] = '\257';	/* macron */
  
  	gsettofnum[GSET_UK] = F_ISO8859_1;
  	gsetontheright[GSET_UK] = False;
! 	gsetmaponfont[GSET_UK] = uk;
! 	uk['#'] = '\243';	/* pound sign */
! 	uk['~'] = '\257';	/* macron */
  
  	gsettofnum[GSET_ASCII] = F_ISO8859_1;
  	gsetontheright[GSET_ASCII] = False;
  
! 	gsettofnum[GSET_SWEDISH] = F_ISO8859_1;
! 	gsetontheright[GSET_SWEDISH] = False;
! 	gsetmaponfont[GSET_SWEDISH] = swedish;
! 	swedish['@'] = '\311';	/* capital letter E with acute accent */
! 	swedish['['] = '\304';	/* capital letter A with diaeresis */
! 	swedish['\\']= '\326';	/* capital letter O with diaeresis */
! 	swedish[']'] = '\305';	/* capital letter A with ring above */
! 	swedish['^'] = '\334';	/* capital letter U with diaeresis */
! 	swedish['`'] = '\351';	/* small letter e with acute accent */
! 	swedish['{'] = '\344';	/* small letter a with diaeresis */
! 	swedish['|'] = '\366';	/* small letter o with diaeresis */
! 	swedish['}'] = '\345';	/* small letter a with ring above */
! 	swedish['~'] = '\374';	/* small letter u with diaeresis */
! 
! 	gsettofnum[GSET_NORWEGIAN] = F_ISO8859_1;
! 	gsetontheright[GSET_NORWEGIAN] = False;
! 	gsetmaponfont[GSET_NORWEGIAN] = norwegian;
! 	norwegian['['] = '\306';/* capital diphthong A with E */
! 	norwegian['\\']= '\330';/* capital letter O with oblique stroke */
! 	norwegian[']'] = '\305';/* capital letter A with ring above */
! 	norwegian['^'] = '\334';/* capital letter U with diaeresis */
! 	norwegian['{'] = '\346';/* small diphthong e with e */
! 	norwegian['|'] = '\370';/* small letter o with oblique stroke */
! 	norwegian['}'] = '\345';/* small letter a with ring above */
! 	norwegian['~'] = '\374';/* small letter u with diaeresis */
! 
! 	gsettofnum[GSET_GERMAN] = F_ISO8859_1;
! 	gsetontheright[GSET_GERMAN] = False;
! 	gsetmaponfont[GSET_GERMAN] = german;
! 	german['@'] = '\247';	/* paragraph sign, section sign */
! 	german['['] = '\304';	/* capital letter A with diaeresis */
! 	german['\\']= '\326';	/* capital letter O with diaeresis */
! 	german[']'] = '\334';	/* capital letter U with diaeresis */
! 	german['{'] = '\344';	/* small letter a with diaeresis */
! 	german['|'] = '\366';	/* small letter o with diaeresis */
! 	german['}'] = '\374';	/* small letter u with diaeresis */
! 	german['~'] = '\337';	/* small german letter sharp s */
! 
! 	gsettofnum[GSET_FRENCH] = F_ISO8859_1;
! 	gsetontheright[GSET_FRENCH] = False;
! 	gsetmaponfont[GSET_FRENCH] = french;
! 	french['#'] = '\243';	/* pound sign */
! 	french['@'] = '\340';	/* small letter a with grave accent */
! 	french['['] = '\260';	/* ring above, degree sign */
! 	french['\\']= '\347';	/* small letter c with cedilla */
! 	french[']'] = '\247';	/* paragraph sign, section sign */
! 	french['{'] = '\351';	/* small letter e with acute accent */
! 	french['|'] = '\371';	/* small letter u with grave accent */
! 	french['}'] = '\350';	/* small letter e with grave accent */
! 	french['~'] = '\250';	/* diaeresis */
! 
! 	gsettofnum[GSET_ITALIAN] = F_ISO8859_1;
! 	gsetontheright[GSET_ITALIAN] = False;
! 	gsetmaponfont[GSET_ITALIAN] = italian;
! 	italian['#'] = '\243';	/* pound sign */
! 	italian['@'] = '\247';	/* paragraph sign, section sign */
! 	italian['['] = '\260';	/* ring above, degree sign */
! 	italian['\\']= '\347';	/* small letter c with cedilla */
! 	italian[']'] = '\351';	/* small letter e with acute accent */
! 	italian['`'] = '\371';	/* small letter u with grave accent */
! 	italian['{'] = '\340';	/* small letter a with grave accent */
! 	italian['|'] = '\362';	/* small letter o with grave accent */
! 	italian['}'] = '\350';	/* small letter e with grave accent */
! 	italian['~'] = '\354';	/* small letter i with grave accent */
! 
! 	gsettofnum[GSET_SPANISH] = F_ISO8859_1;
! 	gsetontheright[GSET_SPANISH] = False;
! 	gsetmaponfont[GSET_SPANISH] = spanish;
! 	spanish['#'] = '\243';	/* pound sign */
! 	spanish['@'] = '\247';	/* paragraph sign, section sign */
! 	spanish['['] = '\241';	/* inverted exclamation mark */
! 	spanish['\\']= '\321';	/* capital letter N with tilde */
! 	spanish[']'] = '\277';	/* inverted question mark */
! 	spanish['{'] = '\260';	/* ring above, degree sign */
! 	spanish['|'] = '\361';	/* small letter n with tilde */
! 	spanish['}'] = '\347';	/* small letter c with cedilla */
  
  	gsettofnum[GSET_LATIN1R] = F_ISO8859_1;
  	gsetontheright[GSET_LATIN1R] = True;
--- 28,753 ----
  #include "ptyx.h"
  #include "data.h"
  
+ #define LATIN1_exclam_down	'\241'
+ #define LATIN1_pound	'\243'
+ #define LATIN1_currency	'\244'
+ #define LATIN1_yen	'\245'
+ #define LATIN1_section	'\247'
+ #define	LATIN1_diaeresis	'\250'
+ #define LATIN1_guillemotleft	'\253'
+ #define LATIN1_hyphen	'\255'
+ #define LATIN1_macron	'\257'
+ #define LATIN1_degree	'\260'
+ #define LATIN1_acute	'\264'
+ #define LATIN1_micro	'\265'
+ #define LATIN1_centerdot	'\267'
+ #define LATIN1_guillemotright	'\273'
+ #define LATIN1_quest_down	'\277'
+ #define LATIN1_A_tilde	'\303'
+ #define LATIN1_A_diaeresis	'\304'
+ #define LATIN1_A_ring	'\305'
+ #define LATIN1_AE	'\306'
+ #define LATIN1_C_cedilla	'\307'
+ #define LATIN1_E_grave	'\310'
+ #define LATIN1_E_acute	'\311'
+ #define LATIN1_N_tilde	'\321'
+ #define LATIN1_O_tilde	'\325'
+ #define LATIN1_O_diaeresis	'\326'
+ #define LATIN1_O_slash	'\330'
+ #define LATIN1_U_diaeresis	'\334'
+ #define LATIN1_ss	'\337'
+ #define LATIN1_a_grave	'\340'
+ #define LATIN1_a_acute	'\341'
+ #define LATIN1_a_circumflex	'\342'
+ #define LATIN1_a_tilde	'\343'
+ #define LATIN1_a_diaeresis	'\344'
+ #define LATIN1_a_ring	'\345'
+ #define LATIN1_ae	'\346'
+ #define LATIN1_c_cedilla	'\347'
+ #define LATIN1_e_grave	'\350'
+ #define LATIN1_e_acute	'\351'
+ #define LATIN1_e_circumflex	'\352'
+ #define LATIN1_i_grave	'\354'
+ #define LATIN1_i_circumflex	'\356'
+ #define LATIN1_n_tilde	'\361'
+ #define LATIN1_o_grave	'\362'
+ #define LATIN1_o_circumflex	'\364'
+ #define LATIN1_o_tilde	'\365'
+ #define LATIN1_o_diaeresis	'\366'
+ #define LATIN1_o_slash	'\370'
+ #define LATIN1_u_grave	'\371'
+ #define LATIN1_u_circumflex	'\373'
+ #define LATIN1_u_diaeresis	'\374'
+ 
+ #define LATIN2_currency	'\244'
+ #define LATIN2_S_caron	'\251'
+ #define LATIN2_Z_caron	'\256'
+ #define LATIN2_s_caron	'\271'
+ #define LATIN2_z_caron	'\276'
+ #define LATIN2_long_umlaut	'\275'
+ #define LATIN2_A_acute	'\301'
+ #define LATIN2_C_acute	'\306'
+ #define LATIN2_C_caron	'\310'
+ #define LATIN2_E_acute	'\311'
+ #define LATIN2_D_dash	'\320'
+ #define LATIN2_O_diaeresis	'\326'
+ #define LATIN2_U_diaeresis	'\334'
+ #define LATIN2_a_acute	'\341'
+ #define LATIN2_c_acute	'\346'
+ #define LATIN2_c_caron	'\350'
+ #define LATIN2_e_acute	'\351'
+ #define LATIN2_d_dash	'\360'
+ #define LATIN2_o_diaeresis	'\366'
+ #define LATIN2_u_diaeresis	'\374'
+ 
  int gsettofnum[256];
  Boolean gsetontheright[256];
! Char (*gsetmaponfont[256])();
  
! static Char
! gsetmap_irv(c)
! Char c;
! {
! 	switch (c) {
! 	case '$':
! 		return LATIN1_currency;
! 	case '~':
! 		return LATIN1_macron;
! 	default:
! 		return c;
! 	}
! }
! 
! static Char
! gsetmap_uk(c)
! Char c;
! {
! 	switch (c) {
! 	case '#':
! 		return LATIN1_pound;
! 	case '~':
! 		return LATIN1_macron;
! 	default:
! 		return c;
! 	}
! }
! 
! static Char
! gsetmap_nats_fi_se(c)
! Char c;
! {
! 	switch (c) {
! 	case '@':
! 		return ' ';	/* should be unit space A */
! 	case '`':
! 		return ' ';	/* should be unit space B */
! 	case '^':
! 		return '\177';	/* quick hack for solid */
! 	case '[':
! 		return LATIN1_A_diaeresis;
! 	case '\\':
! 		return LATIN1_O_diaeresis;
! 	case ']':
! 		return LATIN1_A_ring;
! 	case '{':
! 		return LATIN1_a_diaeresis;
! 	case '|':
! 		return LATIN1_o_diaeresis;
! 	case '}':
! 		return LATIN1_a_ring;
! 	case '~':
! 		return LATIN1_hyphen;
! 	default:
! 		return c;
! 	}
! }
! 
! static Char
! gsetmap_nats_dk_no(c)
! Char c;
! {
! 	switch (c) {
! 	case '@':
! 		return ' ';	/* should be unit space A */
! 	case '`':
! 		return ' ';	/* should be unit space B */
! 	case '^':
! 		return '\177';	/* quick hack for solid */
! 	case '"':
! 		return LATIN1_guillemotleft;
! 	case '#':
! 		return LATIN1_guillemotright;
! 	case '[':
! 		return LATIN1_AE;
! 	case '\\':
! 		return LATIN1_O_slash;
! 	case ']':
! 		return LATIN1_A_ring;
! 	case '{':
! 		return LATIN1_ae;
! 	case '|':
! 		return LATIN1_o_slash;
! 	case '}':
! 		return LATIN1_a_ring;
! 	case '~':
! 		return LATIN1_hyphen;
! 	default:
! 		return c;
! 	}
! }
! 
! static Char
! gsetmap_se(c)
! Char c;
! {
! 	switch (c) {
! 	case '$':
! 		return LATIN1_currency;
! 	case '[':
! 		return LATIN1_A_diaeresis;
! 	case '\\':
! 		return LATIN1_O_diaeresis;
! 	case ']':
! 		return LATIN1_A_ring;
! 	case '{':
! 		return LATIN1_a_diaeresis;
! 	case '|':
! 		return LATIN1_o_diaeresis;
! 	case '}':
! 		return LATIN1_a_ring;
! 	default:
! 		return c;
! 	}
! }
! 
! static Char
! gsetmap_se_c(c)
! Char c;
! {
! 	switch (c) {
! 	case '$':
! 		return LATIN1_currency;
! 	case '@':
! 		return LATIN1_E_acute;
! 	case '[':
! 		return LATIN1_A_diaeresis;
! 	case '\\':
! 		return LATIN1_O_diaeresis;
! 	case ']':
! 		return LATIN1_A_ring;
! 	case '^':
! 		return LATIN1_U_diaeresis;
! 	case '`':
! 		return LATIN1_e_acute;
! 	case '{':
! 		return LATIN1_a_diaeresis;
! 	case '|':
! 		return LATIN1_o_diaeresis;
! 	case '}':
! 		return LATIN1_a_ring;
! 	case '~':
! 		return LATIN1_u_diaeresis;
! 	default:
! 		return c;
! 	}
! }
! 
! static Char
! gsetmap_no(c)
! Char c;
! {
! 	switch (c) {
! 	case '[':
! 		return LATIN1_AE;
! 	case '\\':
! 		return LATIN1_O_slash;
! 	case ']':
! 		return LATIN1_A_ring;
! 	case '{':
! 		return LATIN1_ae;
! 	case '|':
! 		return LATIN1_o_slash;
! 	case '}':
! 		return LATIN1_a_ring;
! 	case '~':
! 		return LATIN1_macron;
! 	default:
! 		return c;
! 	}
! }
! 
! static Char
! gsetmap_no2(c)
! Char c;
! {
! 	switch (c) {
! 	case '#':
! 		return LATIN1_section;
! 	case '[':
! 		return LATIN1_AE;
! 	case '\\':
! 		return LATIN1_O_slash;
! 	case ']':
! 		return LATIN1_A_ring;
! 	case '{':
! 		return LATIN1_ae;
! 	case '|':
! 		return LATIN1_o_slash;
! 	case '}':
! 		return LATIN1_a_ring;
! 	case '~':
! 		return '|';
! 	default:
! 		return c;
! 	}
! }
! 
! static Char
! gsetmap_cn(c)
! Char c;
! {
! 	switch (c) {
! 	case '$':
! 		return LATIN1_yen;
! 	case '~':
! 		return LATIN1_macron;
! 	default:
! 		return c;
! 	}
! }
! 
! static Char
! gsetmap_de(c)
! Char c;
! {
! 	switch (c) {
! 	case '@':
! 		return LATIN1_section;
! 	case '[':
! 		return LATIN1_A_diaeresis;
! 	case '\\':
! 		return LATIN1_O_diaeresis;
! 	case ']':
! 		return LATIN1_U_diaeresis;
! 	case '{':
! 		return LATIN1_a_diaeresis;
! 	case '|':
! 		return LATIN1_o_diaeresis;
! 	case '}':
! 		return LATIN1_u_diaeresis;
! 	case '~':
! 		return LATIN1_ss;
! 	default:
! 		return c;
! 	}
! }
! 
! static Char
! gsetmap_old_fr(c)
! Char c;
  {
! 	switch (c) {
! 	case '#':
! 		return LATIN1_pound;
! 	case '@':
! 		return LATIN1_a_grave;
! 	case '[':
! 		return LATIN1_degree;
! 	case '\\':
! 		return LATIN1_c_cedilla;
! 	case ']':
! 		return LATIN1_section;
! 	case '{':
! 		return LATIN1_e_acute;
! 	case '|':
! 		return LATIN1_u_grave;
! 	case '}':
! 		return LATIN1_e_grave;
! 	case '~':
! 		return LATIN1_diaeresis;
! 	default:
! 		return c;
! 	}
! }
  
! static Char
! gsetmap_fr(c)
! Char c;
! {
! 	switch (c) {
! 	case '#':
! 		return LATIN1_pound;
! 	case '@':
! 		return LATIN1_a_grave;
! 	case '[':
! 		return LATIN1_degree;
! 	case '\\':
! 		return LATIN1_c_cedilla;
! 	case ']':
! 		return LATIN1_section;
! 	case '`':
! 		return LATIN1_micro;
! 	case '{':
! 		return LATIN1_e_acute;
! 	case '|':
! 		return LATIN1_u_grave;
! 	case '}':
! 		return LATIN1_e_grave;
! 	case '~':
! 		return LATIN1_diaeresis;
! 	default:
! 		return c;
  	}
+ }
  
+ static Char
+ gsetmap_it(c)
+ Char c;
+ {
+ 	switch (c) {
+ 	case '#':
+ 		return LATIN1_pound;
+ 	case '@':
+ 		return LATIN1_section;
+ 	case '[':
+ 		return LATIN1_degree;
+ 	case '\\':
+ 		return LATIN1_c_cedilla;
+ 	case ']':
+ 		return LATIN1_e_acute;
+ 	case '`':
+ 		return LATIN1_u_grave;
+ 	case '{':
+ 		return LATIN1_a_grave;
+ 	case '|':
+ 		return LATIN1_o_grave;
+ 	case '}':
+ 		return LATIN1_e_grave;
+ 	case '~':
+ 		return LATIN1_i_grave;
+ 	default:
+ 		return c;
+ 	}
+ }
+ 
+ static Char
+ gsetmap_o_es(c)
+ Char c;
+ {
+ 	switch (c) {
+ 	case '#':
+ 		return LATIN1_pound;
+ 	case '$':
+ 		return LATIN1_currency;
+ 	case '@':
+ 		return LATIN1_section;
+ 	case '[':
+ 		return LATIN1_exclam_down;
+ 	case '\\':
+ 		return LATIN1_N_tilde;
+ 	case ']':
+ 		return LATIN1_quest_down;
+ 	case '{':
+ 		return LATIN1_degree;
+ 	case '|':
+ 		return LATIN1_n_tilde;
+ 	case '}':
+ 		return LATIN1_c_cedilla;
+ 	default:
+ 		return c;
+ 	}
+ }
+ 
+ static Char
+ gsetmap_ibm_es(c)
+ Char c;
+ {
+ 	switch (c) {
+ 	case '@':
+ 		return LATIN1_centerdot;
+ 	case '[':
+ 		return LATIN1_exclam_down;
+ 	case '\\':
+ 		return LATIN1_N_tilde;
+ 	case ']':
+ 		return LATIN1_C_cedilla;
+ 	case '^':
+ 		return LATIN1_quest_down;
+ 	case '{':
+ 		return LATIN1_acute;
+ 	case '|':
+ 		return LATIN1_n_tilde;
+ 	case '}':
+ 		return LATIN1_c_cedilla;
+ 	case '~':
+ 		return LATIN1_diaeresis;
+ 	default:
+ 		return c;
+ 	}
+ }
+ 
+ static Char
+ gsetmap_o_pt(c)
+ Char c;
+ {
+ 	switch (c) {
+ 	case '@':
+ 		return LATIN1_section;
+ 	case '[':
+ 		return LATIN1_A_tilde;
+ 	case '\\':
+ 		return LATIN1_C_cedilla;
+ 	case ']':
+ 		return LATIN1_O_tilde;
+ 	case '{':
+ 		return LATIN1_a_tilde;
+ 	case '|':
+ 		return LATIN1_c_cedilla;
+ 	case '}':
+ 		return LATIN1_o_tilde;
+ 	case '~':
+ 		return LATIN1_degree;
+ 	default:
+ 		return c;
+ 	}
+ }
+ 
+ static Char
+ gsetmap_ibm_pt(c)
+ Char c;
+ {
+ 	switch (c) {
+ 	case '@':
+ 		return LATIN1_acute;
+ 	case '[':
+ 		return LATIN1_A_tilde;
+ 	case '\\':
+ 		return LATIN1_C_cedilla;
+ 	case ']':
+ 		return LATIN1_O_tilde;
+ 	case '{':
+ 		return LATIN1_a_tilde;
+ 	case '|':
+ 		return LATIN1_c_cedilla;
+ 	case '}':
+ 		return LATIN1_o_tilde;
+ 	default:
+ 		return c;
+ 	}
+ }
+ 
+ static Char
+ gsetmap_ca1(c)
+ Char c;
+ {
+ 	switch (c) {
+ 	case '@':
+ 		return LATIN1_a_grave;
+ 	case '[':
+ 		return LATIN1_a_circumflex;
+ 	case '\\':
+ 		return LATIN1_c_cedilla;
+ 	case ']':
+ 		return LATIN1_e_circumflex;
+ 	case '^':
+ 		return LATIN1_i_circumflex;
+ 	case '`':
+ 		return LATIN1_o_circumflex;
+ 	case '{':
+ 		return LATIN1_e_acute;
+ 	case '|':
+ 		return LATIN1_u_grave;
+ 	case '}':
+ 		return LATIN1_e_grave;
+ 	case '~':
+ 		return LATIN1_u_circumflex;
+ 	default:
+ 		return c;
+ 	}
+ }
+ 
+ static Char
+ gsetmap_ca2(c)
+ Char c;
+ {
+ 	switch (c) {
+ 	case '@':
+ 		return LATIN1_a_grave;
+ 	case '[':
+ 		return LATIN1_a_circumflex;
+ 	case '\\':
+ 		return LATIN1_c_cedilla;
+ 	case ']':
+ 		return LATIN1_e_circumflex;
+ 	case '^':
+ 		return LATIN1_E_acute;
+ 	case '`':
+ 		return LATIN1_o_circumflex;
+ 	case '{':
+ 		return LATIN1_e_acute;
+ 	case '|':
+ 		return LATIN1_u_grave;
+ 	case '}':
+ 		return LATIN1_e_grave;
+ 	case '~':
+ 		return LATIN1_u_circumflex;
+ 	default:
+ 		return c;
+ 	}
+ }
+ 
+ static Char
+ gsetmap_hu(c)
+ Char c;
+ {
+ 	switch (c) {
+ 	case '$':
+ 		return LATIN2_currency;
+ 	case '@':
+ 		return LATIN2_A_acute;
+ 	case '[':
+ 		return LATIN2_E_acute;
+ 	case '\\':
+ 		return LATIN2_O_diaeresis;
+ 	case ']':
+ 		return LATIN2_U_diaeresis;
+ 	case '`':
+ 		return LATIN2_a_acute;
+ 	case '{':
+ 		return LATIN2_e_acute;
+ 	case '|':
+ 		return LATIN2_o_diaeresis;
+ 	case '}':
+ 		return LATIN2_u_diaeresis;
+ 	case '~':
+ 		return LATIN2_long_umlaut;
+ 	default:
+ 		return c;
+ 	}
+ }
+ 
+ static Char
+ gsetmap_yu(c)
+ Char c;
+ {
+ 	switch (c) {
+ 	case '@':
+ 		return LATIN2_Z_caron;
+ 	case '[':
+ 		return LATIN2_S_caron;
+ 	case '\\':
+ 		return LATIN2_D_dash;
+ 	case ']':
+ 		return LATIN2_C_acute;
+ 	case '^':
+ 		return LATIN2_C_caron;
+ 	case '`':
+ 		return LATIN2_z_caron;
+ 	case '{':
+ 		return LATIN2_s_caron;
+ 	case '|':
+ 		return LATIN2_d_dash;
+ 	case '}':
+ 		return LATIN2_c_acute;
+ 	case '~':
+ 		return LATIN2_c_caron;
+ 	default:
+ 		return c;
+ 	}
+ }
+ 
+ void
+ setupgset()
+ {
  	gsettofnum[GSET_GRAPH] = F_ISO8859_1;
  	gsetontheright[GSET_GRAPH] = False;
  
  	gsettofnum[GSET_IRV] = F_ISO8859_1;
  	gsetontheright[GSET_IRV] = False;
! 	gsetmaponfont[GSET_IRV] = gsetmap_irv;
  
  	gsettofnum[GSET_UK] = F_ISO8859_1;
  	gsetontheright[GSET_UK] = False;
! 	gsetmaponfont[GSET_UK] = gsetmap_uk;
  
  	gsettofnum[GSET_ASCII] = F_ISO8859_1;
  	gsetontheright[GSET_ASCII] = False;
  
! 	gsettofnum[GSET_NATS_FI_SE] = F_ISO8859_1;
! 	gsetontheright[GSET_NATS_FI_SE] = False;
! 	gsetmaponfont[GSET_NATS_FI_SE] = gsetmap_nats_fi_se;
! 
! 	gsettofnum[GSET_NATS_DK_NO] = F_ISO8859_1;
! 	gsetontheright[GSET_NATS_DK_NO] = False;
! 	gsetmaponfont[GSET_NATS_DK_NO] = gsetmap_nats_dk_no;
! 
! 	gsettofnum[GSET_SE] = F_ISO8859_1;
! 	gsetontheright[GSET_SE] = False;
! 	gsetmaponfont[GSET_SE] = gsetmap_se;
! 	
! 	gsettofnum[GSET_SE_C] = F_ISO8859_1;
! 	gsetontheright[GSET_SE_C] = False;
! 	gsetmaponfont[GSET_SE_C] = gsetmap_se_c;
! 	
! 	gsettofnum[GSET_NO] = F_ISO8859_1;
! 	gsetontheright[GSET_NO] = False;
! 	gsetmaponfont[GSET_NO] = gsetmap_no;
! 	
! 	gsettofnum[GSET_NO2] = F_ISO8859_1;
! 	gsetontheright[GSET_NO2] = False;
! 	gsetmaponfont[GSET_NO2] = gsetmap_no2;
! 
! 	gsettofnum[GSET_CN] = F_ISO8859_1;
! 	gsetontheright[GSET_CN] = False;
! 	gsetmaponfont[GSET_CN] = gsetmap_cn;
! 	
! 	gsettofnum[GSET_DE] = F_ISO8859_1;
! 	gsetontheright[GSET_DE] = False;
! 	gsetmaponfont[GSET_DE] = gsetmap_de;
! 	
! 	gsettofnum[GSET_OLD_FR] = F_ISO8859_1;
! 	gsetontheright[GSET_OLD_FR] = False;
! 	gsetmaponfont[GSET_OLD_FR] = gsetmap_old_fr;
! 	
! 	gsettofnum[GSET_FR] = F_ISO8859_1;
! 	gsetontheright[GSET_FR] = False;
! 	gsetmaponfont[GSET_FR] = gsetmap_fr;
! 	
! 	gsettofnum[GSET_IT] = F_ISO8859_1;
! 	gsetontheright[GSET_IT] = False;
! 	gsetmaponfont[GSET_IT] = gsetmap_it;
! 	
! 	gsettofnum[GSET_O_ES] = F_ISO8859_1;
! 	gsetontheright[GSET_O_ES] = False;
! 	gsetmaponfont[GSET_O_ES] = gsetmap_o_es;
! 	
! 	gsettofnum[GSET_IBM_ES] = F_ISO8859_1;
! 	gsetontheright[GSET_IBM_ES] = False;
! 	gsetmaponfont[GSET_IBM_ES] = gsetmap_ibm_es;
! 	
! 	gsettofnum[GSET_O_PT] = F_ISO8859_1;
! 	gsetontheright[GSET_O_PT] = False;
! 	gsetmaponfont[GSET_O_PT] = gsetmap_o_pt;
! 	
! 	gsettofnum[GSET_IBM_PT] = F_ISO8859_1;
! 	gsetontheright[GSET_IBM_PT] = False;
! 	gsetmaponfont[GSET_IBM_PT] = gsetmap_ibm_pt;
! 
! 	gsettofnum[GSET_CA1] = F_ISO8859_1;
! 	gsetontheright[GSET_CA1] = False;
! 	gsetmaponfont[GSET_CA1] = gsetmap_ca1;
! 
! 	gsettofnum[GSET_CA2] = F_ISO8859_1;
! 	gsetontheright[GSET_CA2] = False;
! 	gsetmaponfont[GSET_CA2] = gsetmap_ca2;
! 
! 	gsettofnum[GSET_HU] = F_ISO8859_2;
! 	gsetontheright[GSET_HU] = False;
! 	gsetmaponfont[GSET_HU] = gsetmap_hu;
! 
! 	gsettofnum[GSET_YU] = F_ISO8859_2;
! 	gsetontheright[GSET_YU] = False;
! 	gsetmaponfont[GSET_YU] = gsetmap_yu;
  
  	gsettofnum[GSET_LATIN1R] = F_ISO8859_1;
  	gsetontheright[GSET_LATIN1R] = True;
***************
*** 185,191 ****
  	gsettofnum[GSET_KANJI] = F_JISX0208_0;
  	gsetontheright[GSET_KANJI] = False;
  
! 	gsettofnum[GSET_HOJOKANJI] = F_JISX0212_0;
  	gsetontheright[GSET_HOJOKANJI] = False;
  
  	gsettofnum[GSET_HANZI] = F_GB2312_0;
--- 789,795 ----
  	gsettofnum[GSET_KANJI] = F_JISX0208_0;
  	gsetontheright[GSET_KANJI] = False;
  
! 	gsettofnum[GSET_HOJOKANJI] = F_JISX0212_1990_0;
  	gsetontheright[GSET_HOJOKANJI] = False;
  
  	gsettofnum[GSET_HANZI] = F_GB2312_0;
***************
*** 193,198 ****
--- 797,829 ----
  
  	gsettofnum[GSET_HANJA] = F_KSC5601_0;
  	gsetontheright[GSET_HANJA] = False;
+ 
+ 	gsettofnum[GSET_JIS0213_1] = F_JISX0213_2000_1;
+ 	gsetontheright[GSET_JIS0213_1] = False;
+ 
+ 	gsettofnum[GSET_JIS0213_2] = F_JISX0213_2000_2;
+ 	gsetontheright[GSET_JIS0213_2] = False;
+ 
+ 	gsettofnum[GSET_CNS11643_1] = F_CNS11643_1;
+ 	gsetontheright[GSET_CNS11643_1] = False;
+ 
+ 	gsettofnum[GSET_CNS11643_2] = F_CNS11643_2;
+ 	gsetontheright[GSET_CNS11643_2] = False;
+ 
+ 	gsettofnum[GSET_CNS11643_3] = F_CNS11643_3;
+ 	gsetontheright[GSET_CNS11643_3] = False;
+ 
+ 	gsettofnum[GSET_CNS11643_4] = F_CNS11643_4;
+ 	gsetontheright[GSET_CNS11643_4] = False;
+ 
+ 	gsettofnum[GSET_CNS11643_5] = F_CNS11643_5;
+ 	gsetontheright[GSET_CNS11643_5] = False;
+ 
+ 	gsettofnum[GSET_CNS11643_6] = F_CNS11643_6;
+ 	gsetontheright[GSET_CNS11643_6] = False;
+ 
+ 	gsettofnum[GSET_CNS11643_7] = F_CNS11643_7;
+ 	gsetontheright[GSET_CNS11643_7] = False;
  # endif /* KTERM_MBCS */
  }
  
***************
*** 212,221 ****
  	screen->_box[F_JISX0201_0] = VTbox;
  #ifdef KTERM_MBCS
  	screen->_box[F_JISX0208_0] = VTwbox;
! 	screen->_box[F_JISX0212_0] = VTwbox;
  	screen->_box[F_GB2312_0] = VTwbox;
  	screen->_box[F_KSC5601_0] = VTwbox;
  	screen->_box[F_JISC6226_0] = VTwbox;
  #endif /* KTERM_MBCS */
  }
  
--- 843,862 ----
  	screen->_box[F_JISX0201_0] = VTbox;
  #ifdef KTERM_MBCS
  	screen->_box[F_JISX0208_0] = VTwbox;
! 	screen->_box[F_JISX0208_1990_0] = VTwbox;
! 	screen->_box[F_JISX0212_1990_0] = VTwbox;
  	screen->_box[F_GB2312_0] = VTwbox;
  	screen->_box[F_KSC5601_0] = VTwbox;
  	screen->_box[F_JISC6226_0] = VTwbox;
+ 	screen->_box[F_JISX0213_2000_1] = VTwbox;
+ 	screen->_box[F_JISX0213_2000_2] = VTwbox;
+ 	screen->_box[F_CNS11643_1] = VTwbox;
+ 	screen->_box[F_CNS11643_2] = VTwbox;
+ 	screen->_box[F_CNS11643_3] = VTwbox;
+ 	screen->_box[F_CNS11643_4] = VTwbox;
+ 	screen->_box[F_CNS11643_5] = VTwbox;
+ 	screen->_box[F_CNS11643_6] = VTwbox;
+ 	screen->_box[F_CNS11643_7] = VTwbox;
  #endif /* KTERM_MBCS */
  }
  
***************
*** 235,245 ****
  		{"iso8859-9"},				/* F_ISO8859_9 */
  		{"jisx0201.1976-0"},			/* F_JISX0201_0 */
  #ifdef KTERM_MBCS
! 		{"jisx0208.1990-0", "jisx0208.1983-0"},	/* F_JISX0208_0 */
! 		{"jisx0212.1990-0"},			/* F_JISX0212_0 */
  		{"gb2312.1980-0"},			/* F_GB2312_0 */
  		{"ksc5601.1987-0"},			/* F_KSC5601_0 */
! 		{"jisc6226.1978-0", "jisx0208.1983-0"},	/* F_JISC6226_0 */
  #endif /* KTERM_MBCS */
  	};
  
--- 876,896 ----
  		{"iso8859-9"},				/* F_ISO8859_9 */
  		{"jisx0201.1976-0"},			/* F_JISX0201_0 */
  #ifdef KTERM_MBCS
! 		{"jisx0208.1983-0", "jisx0208.1990-0"},	/* F_JISX0208_0 */
! 		{"jisx0208.1990-0", "jisx0208.1983-0"},	/* F_JISX0208_1990_0 */
! 		{"jisx0212.1990-0"},			/* F_JISX0212_1990_0 */
  		{"gb2312.1980-0"},			/* F_GB2312_0 */
  		{"ksc5601.1987-0"},			/* F_KSC5601_0 */
! 		{"jisc6226.1978-0"},			/* F_JISC6226_0 */
! 		{"jisx0213.2000-1"},			/* F_JISX0213_2000_1 */
! 		{"jisx0213.2000-2"},			/* F_JISX0213_2000_2 */
! 		{"cns11643.1992-1"},			/* F_CNS11643_1 */
! 		{"cns11643.1992-2"},			/* F_CNS11643_2 */
! 		{"cns11643.1992-3"},			/* F_CNS11643_3 */
! 		{"cns11643.1992-4"},			/* F_CNS11643_4 */
! 		{"cns11643.1992-5"},			/* F_CNS11643_5 */
! 		{"cns11643.1992-6"},			/* F_CNS11643_6 */
! 		{"cns11643.1992-7"},			/* F_CNS11643_7 */
  #endif /* KTERM_MBCS */
  	};
  
Index: kterm/gset.h
diff -c kterm/gset.h:1.1.1.1 kterm/gset.h:1.5
*** kterm/gset.h:1.1.1.1	Fri Apr  7 18:06:47 2000
--- kterm/gset.h	Mon Apr 10 01:15:40 2000
***************
*** 29,70 ****
  #define MBCS		0x40 /* multi-byte character sets */
  #define MBC2		0x7f /* second byte of a mbcs character */
    /*
!    * No character set uses designating characters less than '/'.
!    * Final characters more than 'n' can not be used in current kterm.
     */
! #define GSET(c)		((c) - '/')
! #define GSETFC(i)	(((i) & ~(MBCS|CS96)) + '/')
  		/* final character of a designation sequense for a gset */
  /* code of Ichr,Bchr */
  
! #define GSET_GRAPH	GSET('0')
! #define GSET_IRV	GSET('@')
! #define GSET_UK		GSET('A')
! #define GSET_ASCII	GSET('B')
! #define GSET_SWEDISH	GSET('C')
! #define GSET_NORWEGIAN	GSET('E')
! #define GSET_KANA	GSET('I')
! #define GSET_JISROMAN	GSET('J')
! #define GSET_GERMAN	GSET('K')
! #define GSET_FRENCH	GSET('R')
! #define GSET_ITALIAN	GSET('Y')
! #define GSET_SPANISH	GSET('Z')
! #define GSET_LATIN1R	(CS96|GSET('A'))
! #define GSET_LATIN2R	(CS96|GSET('B'))
! #define GSET_LATIN3R	(CS96|GSET('C'))
! #define GSET_LATIN4R	(CS96|GSET('D'))
! #define GSET_CYRILLIC	(CS96|GSET('L'))
! #define GSET_ARABIC	(CS96|GSET('G'))
! #define GSET_GREEK	(CS96|GSET('F'))
! #define GSET_HEBREW	(CS96|GSET('H'))
! #define GSET_LATIN5R	(CS96|GSET('M'))
  
  #ifdef KTERM_MBCS
! # define GSET_OLDKANJI	(MBCS|GSET('@'))
! # define GSET_HANZI	(MBCS|GSET('A'))
! # define GSET_KANJI	(MBCS|GSET('B'))
! # define GSET_HANJA	(MBCS|GSET('C'))
! # define GSET_HOJOKANJI	(MBCS|GSET('D'))
  #endif /* KTERM_MBCS */
  
  #define F_ISO8859_1	0
--- 29,101 ----
  #define MBCS		0x40 /* multi-byte character sets */
  #define MBC2		0x7f /* second byte of a mbcs character */
    /*
!    * No character set uses designating characters less than '@'
!    * except for ESC ( 0.
     */
! #define GSET(c)		((c) - ('@' - 1))
! #define GSETFC(i)	(((i) & ~(MBCS|CS96)) + ('@' - 1))
  		/* final character of a designation sequense for a gset */
  /* code of Ichr,Bchr */
  
! #define CODE8(x,y)	(((x) << 4) + (y))
! #define GSET2(x,y)	GSET(CODE8((x),(y)))
  
+ #define GSET_GRAPH	(CS96|0) /* quick hack for ESC ( 0 */
+ 
+ #define GSET_IRV	GSET2(4, 0) /* ISO 646-1973 IRV */
+ #define GSET_UK		GSET2(4, 1) /* BS 4730 [United Kingdom] */
+ #define GSET_ASCII	GSET2(4, 2) /* ANSI X3.4-1968 [aka ASCII] */
+ #define GSET_NATS_FI_SE	GSET2(4, 3) /* NATS Primary Set for Finland and Sweden */
+ #define GSET_NATS_DK_NO	GSET2(4, 5) /* NATS Primary Set for Denmark and Norway */
+ #define GSET_SE		GSET2(4, 7) /* SEN 85 02 00 Annex B [Sweden] */
+ #define GSET_SE_C	GSET2(4, 8) /* SEN 85 02 00 Annex C [Sweden] */
+ #define GSET_NO		GSET2(6, 0) /* NS 4551 Version 1 [Norway] */
+ #define GSET_NO2	GSET2(6, 1) /* NS 4551 Version 2 [Norway] */
+ #define GSET_CN		GSET2(5, 4) /* GB 1988-80 [P.R.China] */
+ #define GSET_DE		GSET2(4,11) /* DIN 66 003 [Germany] */
+ #define GSET_OLD_FR	GSET2(5, 2) /* NF Z 62-010-1973 [France] */
+ #define GSET_FR		GSET2(6, 6) /* NF Z 62-010-1982 [France] */
+ #define GSET_IT		GSET2(5, 9) /* UNI 0204-70 [Italy] */
+ #define GSET_O_ES	GSET2(5,10) /* Olivetti Spanish */
+ #define GSET_IBM_ES	GSET2(6, 8) /* IBM Spanish */
+ #define GSET_O_PT	GSET2(4,12) /* Olivetti Portuguese */
+ #define GSET_IBM_PT	GSET2(6, 7) /* IBM Portuguese */
+ #define GSET_CA1	GSET2(7, 7) /* CSA Z 243.4-1985 Alternate Primary Set No.1 [Canada] */
+ #define GSET_CA2	GSET2(7, 8) /* CSA Z 243.4-1985 Alternate Primary Set No.2 [Canada] */
+ 
+ #define GSET_HU		GSET2(6, 9) /* MS Z 7795/3 [Hungary] */
+ #define GSET_YU		GSET2(7,10) /* JUS I.B1.002 [Yugoslavia] */
+ 
+ #define GSET_KANA	GSET2(4, 9) /* JIS C 6220-1969 Katakana [Japan] */
+ #define GSET_JISROMAN	GSET2(4,10) /* JIS C 6220-1969 Roman [Japan] */
+ 
+ #define GSET_LATIN1R	(CS96|GSET2(4, 1)) /* ISO 8859/1-1987 */
+ #define GSET_LATIN2R	(CS96|GSET2(4, 2)) /* ISO 8859/2-1987 */
+ #define GSET_LATIN3R	(CS96|GSET2(4, 3)) /* ISO 8859/3-1988 */
+ #define GSET_LATIN4R	(CS96|GSET2(4, 4)) /* ISO 8859/4-1988 */
+ #define GSET_CYRILLIC	(CS96|GSET2(4,12)) /* ISO 8859/5-1988 */
+ #define GSET_ARABIC	(CS96|GSET2(4, 7)) /* ISO 8859/6-1987 */
+ #define GSET_GREEK	(CS96|GSET2(4, 6)) /* ISO 8859/7-1987 */
+ #define GSET_HEBREW	(CS96|GSET2(4, 8)) /* ISO 8859/8-1988 */
+ #define GSET_LATIN5R	(CS96|GSET2(4,13)) /* ISO 8859/9-1989 */
+ 
+ #define ISNATS(gs)	((gs) == GSET_NATS_FI_SE || (gs) == GSET_NATS_DK_NO)
+ 
  #ifdef KTERM_MBCS
! # define GSET_OLDKANJI	(MBCS|GSET2(4, 0)) /* JIS C 6226-1978 [Japan] */
! # define GSET_HANZI	(MBCS|GSET2(4, 1)) /* GB 2312-80 [P.R.China] */
! # define GSET_KANJI	(MBCS|GSET2(4, 2)) /* JIS X 0208-1983/1990 [Japan] */
! # define GSET_HANJA	(MBCS|GSET2(4, 3)) /* KS C 5601-1987 [R.Korea] */
! # define GSET_HOJOKANJI	(MBCS|GSET2(4, 4)) /* JIS X 0212-1990 [Japan] */
! # define GSET_JIS0213_1	(MBCS|GSET2(4,15)) /* JIS X 0213-2000-1 [Japan] */
! # define GSET_JIS0213_2	(MBCS|GSET2(5, 0)) /* JIS X 0213-2000-2 [Japan] */
! # define GSET_CNS11643_1 (MBCS|GSET2(4, 7)) /* CNS 11643-1992-1 [China] */
! # define GSET_CNS11643_2 (MBCS|GSET2(4, 8)) /* CNS 11643-1992-2 [China] */
! # define GSET_CNS11643_3 (MBCS|GSET2(4, 9)) /* CNS 11643-1992-3 [China] */
! # define GSET_CNS11643_4 (MBCS|GSET2(4,10)) /* CNS 11643-1992-4 [China] */
! # define GSET_CNS11643_5 (MBCS|GSET2(4,11)) /* CNS 11643-1992-5 [China] */
! # define GSET_CNS11643_6 (MBCS|GSET2(4,12)) /* CNS 11643-1992-6 [China] */
! # define GSET_CNS11643_7 (MBCS|GSET2(4,13)) /* CNS 11643-1992-7 [China] */
  #endif /* KTERM_MBCS */
  
  #define F_ISO8859_1	0
***************
*** 78,93 ****
  #define F_ISO8859_9	8
  #define F_JISX0201_0	9
  #ifdef KTERM_MBCS
! #  define F_JISX0208_0	10
! #  define F_JISX0212_0	11
! #  define F_GB2312_0	12
! #  define F_KSC5601_0	13
! #  define F_JISC6226_0	14
! #  define FCNT		15
  #else
  #  define FCNT		10
  #endif
  
  extern int gsettofnum[];
  extern Boolean gsetontheright[];
! extern Char *gsetmaponfont[];
--- 109,134 ----
  #define F_ISO8859_9	8
  #define F_JISX0201_0	9
  #ifdef KTERM_MBCS
! #  define F_JISX0208_0		10
! #  define F_JISX0208_1990_0	11
! #  define F_JISX0212_1990_0	12
! #  define F_GB2312_0		13
! #  define F_KSC5601_0		14
! #  define F_JISC6226_0		15
! #  define F_JISX0213_2000_1	16
! #  define F_JISX0213_2000_2	17
! #  define F_CNS11643_1		18
! #  define F_CNS11643_2		19
! #  define F_CNS11643_3		20
! #  define F_CNS11643_4		21
! #  define F_CNS11643_5		22
! #  define F_CNS11643_6		23
! #  define F_CNS11643_7		24
! #  define FCNT		25
  #else
  #  define FCNT		10
  #endif
  
  extern int gsettofnum[];
  extern Boolean gsetontheright[];
! extern Char (*gsetmaponfont[])();
Index: kterm/input.c
diff -c kterm/input.c:1.1.1.1 kterm/input.c:1.2
*** kterm/input.c:1.1.1.1	Fri Apr  7 18:06:47 2000
--- kterm/input.c	Fri Apr 14 00:51:23 2000
***************
*** 183,189 ****
  			Char outbuf[STRBUFSIZE];
  			Char *obuf, *optr;
  			int n, (*func)();
! 			if (term->flags & EUC_KANJI) {
  				while (nbytes-- > 0)
  					unparseputc(*string++, pty);
  			} else {
--- 183,189 ----
  			Char outbuf[STRBUFSIZE];
  			Char *obuf, *optr;
  			int n, (*func)();
! 			if (term->flags & (EUC_KANJI | EUC_KOREAN)) {
  				while (nbytes-- > 0)
  					unparseputc(*string++, pty);
  			} else {
Index: kterm/kinput2.c
diff -c kterm/kinput2.c:1.1.1.1 kterm/kinput2.c:1.2
*** kterm/kinput2.c:1.1.1.1	Fri Apr  7 18:06:47 2000
--- kterm/kinput2.c	Fri Apr 14 00:51:23 2000
***************
*** 33,39 ****
  extern int	_beginConversionWithAttributes();
  extern void	_changeConversionAttributes();
  extern int	convCTtoCS();
! extern int	convCStoEUC();
  extern int	convCStoSJIS();
  extern int	convCStoJIS();
  
--- 33,40 ----
  extern int	_beginConversionWithAttributes();
  extern void	_changeConversionAttributes();
  extern int	convCTtoCS();
! extern int	convCStoEUCJP();
! extern int	convCStoEUCKR();
  extern int	convCStoSJIS();
  extern int	convCStoJIS();
  
***************
*** 172,180 ****
  			       : cbuf;
  		(void)convCTtoCS(str, size, cs);
  		if (term->flags & EUC_KANJI)
! 		    convfunc = convCStoEUC;
  		else if (term->flags & SJIS_KANJI)
  		    convfunc = convCStoSJIS;
  		else
  		    convfunc = convCStoJIS;
  
--- 173,183 ----
  			       : cbuf;
  		(void)convCTtoCS(str, size, cs);
  		if (term->flags & EUC_KANJI)
! 		    convfunc = convCStoEUCJP;
  		else if (term->flags & SJIS_KANJI)
  		    convfunc = convCStoSJIS;
+ 		if (term->flags & EUC_KOREAN)
+ 		    convfunc = convCStoEUCKR;
  		else
  		    convfunc = convCStoJIS;
  
Index: kterm/kterm.h
diff -c kterm/kterm.h:1.1.1.1 kterm/kterm.h:1.2
*** kterm/kterm.h:1.1.1.1	Fri Apr  7 18:06:47 2000
--- kterm/kterm.h	Fri Apr  7 18:09:12 2000
***************
*** 28,34 ****
  #ifndef _KTERM_H_
  #define _KTERM_H_
  
! #define KTERM_VERSION	"6.2.0"
  #define KTERM_MBCS	/* multi-byte character set */
  #define KTERM_MBCC	/* multi-byte character class for word selection */
  #define KTERM_KANJIMODE	/* euc/sjis Kanji modes */
--- 28,34 ----
  #ifndef _KTERM_H_
  #define _KTERM_H_
  
! #define KTERM_VERSION	"6.2.0.wd0.2"
  #define KTERM_MBCS	/* multi-byte character set */
  #define KTERM_MBCC	/* multi-byte character class for word selection */
  #define KTERM_KANJIMODE	/* euc/sjis Kanji modes */
Index: kterm/kterm.jman
diff -c kterm/kterm.jman:1.1.1.1 kterm/kterm.jman:1.3
*** kterm/kterm.jman:1.1.1.1	Fri Apr  7 18:06:47 2000
--- kterm/kterm.jman	Fri Apr  7 18:31:25 2000
***************
*** 74,80 ****
  .br
  "ksc5601.1987-0",
  .br
! "jisc6226.1978-0" または "jisx0208.1983-0"。
  .TP 8
  .BI \-fn " iso8859/1-font"
  Latin-1 (ASCII を含む) のテキストを表示する時に用いる、通常の(ボールド
--- 74,86 ----
  .br
  "ksc5601.1987-0",
  .br
! "jisc6226.1978-0" または "jisx0208.1983-0",
! .br
! "jisx0213.2000-1",
! .br
! "jisx0213.2000-2",
! .br
! "cns11643.1992-1" から "cns11643.1992-7"。
  .TP 8
  .BI \-fn " iso8859/1-font"
  Latin-1 (ASCII を含む) のテキストを表示する時に用いる、通常の(ボールド
Index: kterm/kterm.man
diff -c kterm/kterm.man:1.1.1.1 kterm/kterm.man:1.3
*** kterm/kterm.man:1.1.1.1	Fri Apr  7 18:06:47 2000
--- kterm/kterm.man	Fri Apr  7 18:31:25 2000
***************
*** 73,81 ****
  .br
  "gb2312.1980-0",
  .br
! "ksc5601.1987-0", and
  .br
! "jisc6226.1978-0" or "jisx0208.1983-0".
  .TP 8
  .BI \-fn " iso8859/1-font"
  This option specifies a normal (non-bold) ISO8859/1 font to be used
--- 73,87 ----
  .br
  "gb2312.1980-0",
  .br
! "ksc5601.1987-0",
  .br
! "jisc6226.1978-0" or "jisx0208.1983-0",
! .br
! "jisx0213.2000-1",
! .br
! "jisx0213.2000-2", and
! .br
! "cns11643.1992-1" to "cns11643.1992-7".
  .TP 8
  .BI \-fn " iso8859/1-font"
  This option specifies a normal (non-bold) ISO8859/1 font to be used
Index: kterm/main.c
diff -c kterm/main.c:1.1.1.1 kterm/main.c:1.2
*** kterm/main.c:1.1.1.1	Fri Apr  7 18:06:47 2000
--- kterm/main.c	Fri Apr  7 18:09:12 2000
***************
*** 238,248 ****
--- 238,259 ----
  
  #ifdef _POSIX_SOURCE
  #define USE_POSIX_WAIT
+ #define HAS_POSIX_SAVED_IDS
  #endif
  #ifdef SVR4
  #define USE_POSIX_WAIT
+ #define HAS_POSIX_SAVED_IDS
  #endif
  
+ #if !defined(MINIX) && !defined(WIN32)
+ #include <sys/param.h>	/* for NOFILE */
+ #endif
+ 
+ #if (BSD >= 199103)
+ #define USE_POSIX_WAIT
+ #define HAS_POSIX_SAVED_IDS
+ #endif
+ 
  #include <stdio.h>
  #include <errno.h>
  #include <setjmp.h>
***************
*** 1307,1328 ****
  
  	/* Init the Toolkit. */
  	XtSetErrorHandler(xt_error);
  #ifdef KTERM
! 	toplevel = XtAppInitialize (&app_con, "KTerm", 
  #else /* !KTERM */
! 	toplevel = XtAppInitialize (&app_con, "XTerm", 
  #endif /* !KTERM */
  				    optionDescList, XtNumber(optionDescList), 
  				    &argc, argv, fallback_resources, NULL, 0);
  
! 	XtGetApplicationResources(toplevel, (XtPointer) &resource,
  				  application_resources,
  				  XtNumber(application_resources), NULL, 0);
  
  #ifdef __sgi
! 	if (resource.useLocale)
! 	    setlocale(LC_ALL,"");
  #endif
  
  	waiting_for_initial_map = resource.wait_for_map;
  
--- 1318,1367 ----
  
  	/* Init the Toolkit. */
  	XtSetErrorHandler(xt_error);
+ 	{
+ #ifdef HAS_POSIX_SAVED_IDS
+ 	    uid_t euid = geteuid();
+ 	    gid_t egid = getegid();
+ 	    uid_t ruid = getuid();
+ 	    gid_t rgid = getgid();
+ 
+ 	    if (setegid(rgid) == -1)
+ 		(void) fprintf(stderr, "setegid(%d): %s\n",
+ 			       (int) rgid, strerror(errno));
+ 
+ 	    if (seteuid(ruid) == -1)
+ 		(void) fprintf(stderr, "seteuid(%d): %s\n",
+ 			       (int) ruid, strerror(errno));
+ #endif
+ 
+ 	    XtSetErrorHandler(xt_error);
  #ifdef KTERM
! 	    toplevel = XtAppInitialize (&app_con, "KTerm", 
  #else /* !KTERM */
! 	    toplevel = XtAppInitialize (&app_con, "XTerm", 
  #endif /* !KTERM */
  				    optionDescList, XtNumber(optionDescList), 
  				    &argc, argv, fallback_resources, NULL, 0);
  
! 	    XtGetApplicationResources(toplevel, (XtPointer) &resource,
  				  application_resources,
  				  XtNumber(application_resources), NULL, 0);
  
  #ifdef __sgi
! 	    if (resource.useLocale)
! 		setlocale(LC_ALL,"");
! #endif
! 
! #ifdef HAS_POSIX_SAVED_IDS
! 	    if (seteuid(euid) == -1)
! 		(void) fprintf(stderr, "seteuid(%d): %s\n",
! 			       (int) euid, strerror(errno));
! 
! 	    if (setegid(egid) == -1)
! 		(void) fprintf(stderr, "setegid(%d): %s\n",
! 			       (int) egid, strerror(errno));
  #endif
+ 	}
  
  	waiting_for_initial_map = resource.wait_for_map;
  
***************
*** 1469,1475 ****
  	    switch (term->misc.k_m[0]) {
  		case 'e': case 'E': case 'x': case 'X': case 'u': case 'U':
  		    term->flags |= EUC_KANJI;
! 		    update_eucmode();
  		    break;
  		case 's': case 'S': case 'm': case 'M':
  		    term->flags |= SJIS_KANJI;
--- 1508,1514 ----
  	    switch (term->misc.k_m[0]) {
  		case 'e': case 'E': case 'x': case 'X': case 'u': case 'U':
  		    term->flags |= EUC_KANJI;
! 		    update_eucjpmode();
  		    break;
  		case 's': case 'S': case 'm': case 'M':
  		    term->flags |= SJIS_KANJI;
***************
*** 2445,2450 ****
--- 2484,2492 ----
  				close (tty);
  			}
  #endif /* TIOCNOTTY */
+ #if (BSD >= 199103)
+ 			(void)revoke(ttydev);
+ #endif
  			if ((tty = open(ttydev, O_RDWR, 0)) >= 0) {
  #if defined(CRAY) && defined(TCSETCTTY)
  			    /* make /dev/tty work */
Index: kterm/menu.c
diff -c kterm/menu.c:1.1.1.1 kterm/menu.c:1.4
*** kterm/menu.c:1.1.1.1	Fri Apr  7 18:06:47 2000
--- kterm/menu.c	Fri Apr 14 00:51:23 2000
***************
*** 73,81 ****
  static void do_statusline(), do_reversestatus();
  #endif /* STATUSLINE */
  #ifdef KTERM_KANJIMODE
! static void do_eucmode();
  static void do_sjismode();
  #endif /* KTERM_KANJIMODE */
  #ifdef KTERM_XIM
  static void do_openim();
  #endif /* KTERM_XIM */
--- 73,85 ----
  static void do_statusline(), do_reversestatus();
  #endif /* STATUSLINE */
  #ifdef KTERM_KANJIMODE
! static void do_eucjpmode();
  static void do_sjismode();
+ static void do_euckrmode();
  #endif /* KTERM_KANJIMODE */
+ #ifdef KTERM
+ static void do_fontstrict();
+ #endif
  #ifdef KTERM_XIM
  static void do_openim();
  #endif /* KTERM_XIM */
***************
*** 136,146 ****
      { "reversestatus",	do_reversestatus, NULL },	/* 25 */
  # endif /* STATUSLINE */
  # ifdef KTERM_KANJIMODE
!     { "eucmode",	do_eucmode, NULL },		/* 24 or 26 */
      { "sjismode",	do_sjismode, NULL },		/* 25 or 27 */
  # endif /* KTERM_KANJIMODE */
  # ifdef KTERM_XIM
!     { "openim",		do_openim, NULL },		/* 24, 26 or 28 */
  # endif /* KTERM_XIM */
      };
  #else /* !STATUSLINE && !KTERM */
--- 140,154 ----
      { "reversestatus",	do_reversestatus, NULL },	/* 25 */
  # endif /* STATUSLINE */
  # ifdef KTERM_KANJIMODE
!     { "eucjpmode",	do_eucjpmode, NULL },		/* 24 or 26 */
      { "sjismode",	do_sjismode, NULL },		/* 25 or 27 */
+     { "euckrmode",	do_euckrmode, NULL },		/* 24 or 26 */
  # endif /* KTERM_KANJIMODE */
+ #ifdef KTERM
+     { "fontstrict",	do_fontstrict, NULL },		/* 24, 26 or 28 */
+ #endif
  # ifdef KTERM_XIM
!     { "openim",		do_openim, NULL },		/* 25, 27 or 29 */
  # endif /* KTERM_XIM */
      };
  #else /* !STATUSLINE && !KTERM */
***************
*** 257,265 ****
  	    update_reversestatus();
  #endif /* STATUSLINE */
  #ifdef KTERM_KANJIMODE
! 	    update_eucmode();
  	    update_sjismode();
  #endif /* KTERM_KANJIMODE */
  #ifdef KTERM_XIM
  	    update_openim();
  #endif /* KTERM_XIM */
--- 265,277 ----
  	    update_reversestatus();
  #endif /* STATUSLINE */
  #ifdef KTERM_KANJIMODE
! 	    update_eucjpmode();
  	    update_sjismode();
+ 	    update_euckrmode();
  #endif /* KTERM_KANJIMODE */
+ #ifdef KTERM
+ 	    update_fontstrict();
+ #endif
  #ifdef KTERM_XIM
  	    update_openim();
  #endif /* KTERM_XIM */
***************
*** 828,846 ****
  {
      register TScreen *screen = &term->screen;
  
!     term->flags &= ~EUC_KANJI;
!     term->flags &= ~SJIS_KANJI;
      screen->gsets[0] = GSET_ASCII;
      screen->gsets[1] = GSET_KANA;
      screen->gsets[2] = GSET_ASCII;
      screen->gsets[3] = GSET_ASCII;
      screen->curgr = 1;
!     update_eucmode();
      update_sjismode();
  }
  
  
! static void do_eucmode (gw, closure, data)
      Widget gw;
      caddr_t closure, data;
  {
--- 840,858 ----
  {
      register TScreen *screen = &term->screen;
  
!     term->flags &= ~(EUC_KANJI | SJIS_KANJI | EUC_KOREAN);
      screen->gsets[0] = GSET_ASCII;
      screen->gsets[1] = GSET_KANA;
      screen->gsets[2] = GSET_ASCII;
      screen->gsets[3] = GSET_ASCII;
      screen->curgr = 1;
!     update_eucjpmode();
      update_sjismode();
+     update_euckrmode();
  }
  
  
! static void do_eucjpmode (gw, closure, data)
      Widget gw;
      caddr_t closure, data;
  {
***************
*** 850,863 ****
  	do_jismode(gw, closure, data);
      } else {
  	term->flags |= EUC_KANJI;
! 	term->flags &= ~SJIS_KANJI;
  	screen->gsets[0] = GSET_ASCII;
  	screen->gsets[1] = GSET_KANJI;
  	screen->gsets[2] = GSET_KANA;
  	screen->gsets[3] = GSET_HOJOKANJI;
  	screen->curgr = 1;
! 	update_eucmode();
  	update_sjismode();
      }
  }
  
--- 862,876 ----
  	do_jismode(gw, closure, data);
      } else {
  	term->flags |= EUC_KANJI;
! 	term->flags &= ~(SJIS_KANJI | EUC_KOREAN);
  	screen->gsets[0] = GSET_ASCII;
  	screen->gsets[1] = GSET_KANJI;
  	screen->gsets[2] = GSET_KANA;
  	screen->gsets[3] = GSET_HOJOKANJI;
  	screen->curgr = 1;
! 	update_eucjpmode();
  	update_sjismode();
+ 	update_euckrmode();
      }
  }
  
***************
*** 871,889 ****
      if (term->flags & SJIS_KANJI) {
  	do_jismode(gw, closure, data);
      } else {
! 	term->flags &= ~EUC_KANJI;
  	term->flags |= SJIS_KANJI;
  	screen->gsets[0] = GSET_ASCII;
  	screen->gsets[1] = GSET_KANA;
  	screen->gsets[2] = GSET_ASCII;
  	screen->gsets[3] = GSET_ASCII;
  	screen->curgr = 1;
! 	update_eucmode();
  	update_sjismode();
      }
  }
  #endif /* KTERM_KANJIMODE */
  
  #ifdef KTERM_XIM
  static void do_openim (gw, closure, data)
      Widget gw;
--- 884,938 ----
      if (term->flags & SJIS_KANJI) {
  	do_jismode(gw, closure, data);
      } else {
! 	term->flags &= ~(EUC_KANJI | EUC_KOREAN);
  	term->flags |= SJIS_KANJI;
  	screen->gsets[0] = GSET_ASCII;
  	screen->gsets[1] = GSET_KANA;
  	screen->gsets[2] = GSET_ASCII;
  	screen->gsets[3] = GSET_ASCII;
  	screen->curgr = 1;
! 	update_eucjpmode();
  	update_sjismode();
+ 	update_euckrmode();
      }
  }
+ 
+ 
+ static void do_euckrmode (gw, closure, data)
+     Widget gw;
+     caddr_t closure, data;
+ {
+     register TScreen *screen = &term->screen;
+ 
+     if (term->flags & EUC_KOREAN) {
+ 	do_jismode(gw, closure, data);
+     } else {
+ 	term->flags |= EUC_KOREAN;
+ 	term->flags &= ~(SJIS_KANJI | EUC_KANJI);
+ 	screen->gsets[0] = GSET_ASCII;
+ 	screen->gsets[1] = GSET_HANJA;
+ 	screen->gsets[2] = GSET_ASCII;
+ 	screen->gsets[3] = GSET_ASCII;
+ 	screen->curgr = 1;
+ 	update_eucjpmode();
+ 	update_sjismode();
+ 	update_euckrmode();
+     }
+ }
  #endif /* KTERM_KANJIMODE */
  
+ #ifdef KTERM
+ static void do_fontstrict (gw, closure, data)
+     Widget gw;
+     caddr_t closure, data;
+ {
+     register TScreen *screen = &term->screen;
+ 
+     screen->font_strict = !screen->font_strict;
+     update_fontstrict();
+ }
+ #endif
+ 
  #ifdef KTERM_XIM
  static void do_openim (gw, closure, data)
      Widget gw;
***************
*** 1492,1498 ****
  	    break;
  	  case 'e': case 'E': case 'x': case 'X': case 'u': case 'U':
  	    term->flags &= ~EUC_KANJI;
! 	    do_eucmode (w, NULL, NULL);
  	    break;
  	  case 's': case 'S': case 'm': case 'M':
  	    term->flags &= ~SJIS_KANJI;
--- 1541,1547 ----
  	    break;
  	  case 'e': case 'E': case 'x': case 'X': case 'u': case 'U':
  	    term->flags &= ~EUC_KANJI;
! 	    do_eucjpmode (w, NULL, NULL);
  	    break;
  	  case 's': case 'S': case 'm': case 'M':
  	    term->flags &= ~SJIS_KANJI;
Index: kterm/menu.h
diff -c kterm/menu.h:1.1.1.1 kterm/menu.h:1.4
*** kterm/menu.h:1.1.1.1	Fri Apr  7 18:06:47 2000
--- kterm/menu.h	Fri Apr 14 00:51:23 2000
***************
*** 148,169 ****
  #endif /* STATUSLINE */
  #ifdef KTERM_KANJIMODE
  #  ifdef vtMenu_reversestatus
! #    define vtMenu_eucmode (vtMenu_reversestatus+1)
  #  else
! #    define vtMenu_eucmode (vtMenu_line3+1)
  #  endif
! #  define vtMenu_sjismode (vtMenu_eucmode+1)
  #endif /* KTERM_KANJIMODE */
! #ifdef KTERM_XIM
! #  ifdef vtMenu_sjismode
! #    define vtMenu_openim (vtMenu_sjismode+1)
  #  else
  #    ifdef vtMenu_reversestatus
! #      define vtMenu_openim (vtMenu_reversestatus+1)
  #    else
! #      define vtMenu_openim (vtMenu_line3+1)
  #    endif
  #  endif
  #endif /* KTERM_XIM */
  
  /*
--- 148,173 ----
  #endif /* STATUSLINE */
  #ifdef KTERM_KANJIMODE
  #  ifdef vtMenu_reversestatus
! #    define vtMenu_eucjpmode (vtMenu_reversestatus+1)
  #  else
! #    define vtMenu_eucjpmode (vtMenu_line3+1)
  #  endif
! #  define vtMenu_sjismode (vtMenu_eucjpmode+1)
! #  define vtMenu_euckrmode (vtMenu_sjismode+1)
  #endif /* KTERM_KANJIMODE */
! #ifdef KTERM
! #  ifdef vtMenu_euckrmode
! #    define vtMenu_fontstrict (vtMenu_euckrmode+1)
  #  else
  #    ifdef vtMenu_reversestatus
! #      define vtMenu_fontstrict (vtMenu_reversestatus+1)
  #    else
! #      define vtMenu_fontstrict (vtMenu_line3+1)
  #    endif
  #  endif
+ #endif
+ #ifdef KTERM_XIM	/*implies KTERM*/
+ #  define vtMenu_openim (vtMenu_fontstrict+1)
  #endif /* KTERM_XIM */
  
  /*
***************
*** 344,359 ****
  		    term->screen.reversestatus)
  #endif /* STATUSLINE */
  #ifdef KTERM_KANJIMODE
! #define update_eucmode() \
    update_menu_item (term->screen.vtMenu, \
! 		    vtMenuEntries[vtMenu_eucmode].widget, \
  		    term->flags & EUC_KANJI)
  
  #define update_sjismode() \
    update_menu_item (term->screen.vtMenu, \
  		    vtMenuEntries[vtMenu_sjismode].widget, \
  		    term->flags & SJIS_KANJI)
  #endif /* KTERM_KANJIMODE */
  #ifdef KTERM_XIM
  #define update_openim() \
    update_menu_item (term->screen.vtMenu, \
--- 348,374 ----
  		    term->screen.reversestatus)
  #endif /* STATUSLINE */
  #ifdef KTERM_KANJIMODE
! #define update_eucjpmode() \
    update_menu_item (term->screen.vtMenu, \
! 		    vtMenuEntries[vtMenu_eucjpmode].widget, \
  		    term->flags & EUC_KANJI)
  
  #define update_sjismode() \
    update_menu_item (term->screen.vtMenu, \
  		    vtMenuEntries[vtMenu_sjismode].widget, \
  		    term->flags & SJIS_KANJI)
+ 
+ #define update_euckrmode() \
+   update_menu_item (term->screen.vtMenu, \
+ 		    vtMenuEntries[vtMenu_euckrmode].widget, \
+ 		    term->flags & EUC_KOREAN)
  #endif /* KTERM_KANJIMODE */
+ #ifdef KTERM
+ #define update_fontstrict() \
+   update_menu_item (term->screen.vtMenu, \
+ 		    vtMenuEntries[vtMenu_fontstrict].widget, \
+ 		    term->screen.font_strict)
+ #endif
  #ifdef KTERM_XIM
  #define update_openim() \
    update_menu_item (term->screen.vtMenu, \
Index: kterm/ptyx.h
diff -c kterm/ptyx.h:1.1.1.1 kterm/ptyx.h:1.4
*** kterm/ptyx.h:1.1.1.1	Fri Apr  7 18:06:47 2000
--- kterm/ptyx.h	Fri Apr 14 00:51:23 2000
***************
*** 418,423 ****
--- 418,424 ----
  	int		refresh_amt;	/* amount to refresh		*/
  	Boolean		jumpscroll;	/* whether we should jumpscroll */
  	Boolean         always_highlight; /* whether to highlight cursor */
+ 	Boolean		font_strict;	/* strict/loose match for fonts */
  
  #ifndef KTERM_NOTEK
  /* Tektronix window parameters */
***************
*** 668,675 ****
  #define SMOOTHSCROLL	0x1000000	/* true if in smooth scroll mode */
  #define IN132COLUMNS	0x2000000	/* true if in 132 column mode */
  #ifdef KTERM_KANJIMODE
! #define	EUC_KANJI	0x4000000	/* true if in EUC mode */
! #define	SJIS_KANJI	0x8000000	/* true if in SJIS mode */
  #endif /* KTERM_KANJIMODE */
  #else /* !KTERM */
  #define WRAPAROUND	0x400	/* true if auto wraparound mode */
--- 669,677 ----
  #define SMOOTHSCROLL	0x1000000	/* true if in smooth scroll mode */
  #define IN132COLUMNS	0x2000000	/* true if in 132 column mode */
  #ifdef KTERM_KANJIMODE
! #define	SJIS_KANJI	0x4000000	/* true if in SJIS mode */
! #define	EUC_KANJI	0x8000000	/* true if in EUCJP mode */
! #define	EUC_KOREAN	0x10000000	/* true if in EUCKR mode */
  #endif /* KTERM_KANJIMODE */
  #else /* !KTERM */
  #define WRAPAROUND	0x400	/* true if auto wraparound mode */
Index: kterm/screen.c
diff -c kterm/screen.c:1.1.1.1 kterm/screen.c:1.2
*** kterm/screen.c:1.1.1.1	Fri Apr  7 18:06:47 2000
--- kterm/screen.c	Fri Apr  7 18:09:13 2000
***************
*** 1177,1183 ****
  		if (gset) {
  			for (c = col, n = 0; c < endcol; c++, n++) {
  				dbuf[n] = gsetmaponfont[gset]
! 					    ? gsetmaponfont[gset][str[c].code]
  					    : str[c].code;
  			}
  		} else {
--- 1177,1183 ----
  		if (gset) {
  			for (c = col, n = 0; c < endcol; c++, n++) {
  				dbuf[n] = gsetmaponfont[gset]
! 					    ? (*gsetmaponfont[gset])(str[c].code)
  					    : str[c].code;
  			}
  		} else {
***************
*** 1256,1261 ****
--- 1256,1271 ----
  			if (flags & BOLD && screen->normalboldGC == screen->normalGC)
  			    XDrawString(screen->display, TextWindow(screen),
  				gc, x + 1, Y, dbuf, n);
+ 			if (ISNATS(gset)) { /* quick hack for solid */
+ 				int	col, X;
+ 				for (col = 0, X = x; col < n; col ++, X += FontWidth(screen)) {
+ 					if (dbuf[col] == '\177') {
+ 						XFillRectangle(screen->display, TextWindow(screen), gc,
+ 							       X, y,
+ 							       FontWidth(screen), FontHeight(screen));
+ 					}
+ 				}
+ 			}
  		}
  		if (flags & UNDERLINE) 
  		    XDrawLine(screen->display, TextWindow(screen),
