From nobody@FreeBSD.org  Tue Mar 25 19:55:34 2008
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6976D1065670
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 25 Mar 2008 19:55:34 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 618AD8FC2A
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 25 Mar 2008 19:55:34 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m2PJtLS5081613
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 25 Mar 2008 19:55:21 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m2PJtLqL081611;
	Tue, 25 Mar 2008 19:55:21 GMT
	(envelope-from nobody)
Message-Id: <200803251955.m2PJtLqL081611@www.freebsd.org>
Date: Tue, 25 Mar 2008 19:55:21 GMT
From: Yuri <yuri@tsoft.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [PATCH] [PORT chinese/chinput3] fixed locale problem
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         122091
>Category:       ports
>Synopsis:       [PATCH] chinese/chinput3: fixed locale problem
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 25 20:00:03 UTC 2008
>Closed-Date:    Sun Apr 06 11:58:48 UTC 2008
>Last-Modified:  Sun Apr  6 12:00:09 UTC 2008
>Originator:     Yuri
>Release:        7.0-STABLE
>Organization:
n/a
>Environment:
>Description:
chinput3 was expecting non-existent in FreeBSD chinese locales.
Please apply the patch, it makes it run.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

diff -uNr chinese/chinput3.orig/files/patch-src_Chinput-3.0.2_resource_Chinput.ad chinese/chinput3/files/patch-src_Chinput-3.0.2_resource_Chinput.ad
--- chinese/chinput3.orig/files/patch-src_Chinput-3.0.2_resource_Chinput.ad	1969-12-31 16:00:00.000000000 -0800
+++ chinese/chinput3/files/patch-src_Chinput-3.0.2_resource_Chinput.ad	2008-03-25 12:32:59.000000000 -0700
@@ -0,0 +1,13 @@
+--- src/Chinput-3.0.2/resource/Chinput.ad.orig	2008-03-25 12:16:09.000000000 -0700
++++ src/Chinput-3.0.2/resource/Chinput.ad	2008-03-25 12:21:36.000000000 -0700
+@@ -2,8 +2,8 @@
+ !It based on chinput
+ 
+ 
+-chinput.gblocale	=	zh_CN.EUC
+-chinput.big5locale	=	zh_CN.EUC
++chinput.gblocale	=	zh_CN.GB2312
++chinput.big5locale	=	zh_CN.GB2312
+ 
+ !
+ ! input style: AUTO, ROOT, OVERSPOT, ONSPOT, OFFSPOT
diff -uNr chinese/chinput3.orig/files/patch-src_Chinput-3.0.2_src_init.c chinese/chinput3/files/patch-src_Chinput-3.0.2_src_init.c
--- chinese/chinput3.orig/files/patch-src_Chinput-3.0.2_src_init.c	1969-12-31 16:00:00.000000000 -0800
+++ chinese/chinput3/files/patch-src_Chinput-3.0.2_src_init.c	2008-03-25 12:32:36.000000000 -0700
@@ -0,0 +1,32 @@
+--- src/Chinput-3.0.2/src/init.c.orig	2008-03-25 11:18:01.000000000 -0700
++++ src/Chinput-3.0.2/src/init.c	2008-03-25 12:23:41.000000000 -0700
+@@ -94,6 +94,13 @@
+         load_font(&font_info, font_latin);
+ }
+ 
++static int is_locale_supported(char *locale) {
++  char *setlocale_string = setlocale(LC_ALL, locale);
++  int success = (setlocale_string != NULL && strcmp(setlocale_string, locale)==0 && XSupportsLocale());
++  if (!success && locale[0] != 0 && setlocale_string != NULL && setlocale_string[0] != 0) {
++    fprintf(stderr, "Error : requested locale '%s' not supported\n");
++  }
++}
+ 
+ void HZinitServerGC(void)
+ {
+@@ -103,12 +110,9 @@
+ 	char fontname[256];
+ 
+ 	//create font set
+-	if(strcmp(setlocale(LC_ALL, gb18030locale), gb18030locale) || 	
+-		!XSupportsLocale()){
+-		if(strcmp(setlocale(LC_ALL, gbklocale), gbklocale) ||
+-			!XSupportsLocale()){
+-			if(strcmp(setlocale(LC_ALL, gblocale), gblocale) ||
+-				!XSupportsLocale()){
++	if(!is_locale_supported(gb18030locale)){
++		if(!is_locale_supported(gbklocale)){
++			if(!is_locale_supported(gblocale)){
+ 				fprintf(stderr, "Error : Chinese Locale not supported!\n");
+ 				exit(1);
+ 			}


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: rafan 
State-Changed-When: Sun Apr 6 11:58:47 UTC 2008 
State-Changed-Why:  
Committed. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=122091 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/122091: commit references a PR
Date: Sun,  6 Apr 2008 11:58:40 +0000 (UTC)

 rafan       2008-04-06 11:58:29 UTC
 
   FreeBSD ports repository
 
   Modified files:
     chinese/chinput3     Makefile 
     chinese/chinput3/files pkg-message.in 
   Added files:
     chinese/chinput3/files 
                            patch-src_Chinput-3.0.2_resource_Chinput.ad 
                            patch-src_Chinput-3.0.2_src_init.c 
   Log:
   - Use correct locale zh_CN.GB2312 instead of invalid locale zh_CN.EUC
   - Bump PORTREVISION
   
   PR:             ports/122091
   Submitted by:   Yuri <yuri at tsoft.com>
   
   Revision  Changes    Path
   1.29      +1 -1      ports/chinese/chinput3/Makefile
   1.1       +13 -0     ports/chinese/chinput3/files/patch-src_Chinput-3.0.2_resource_Chinput.ad (new)
   1.1       +32 -0     ports/chinese/chinput3/files/patch-src_Chinput-3.0.2_src_init.c (new)
   1.2       +1 -1      ports/chinese/chinput3/files/pkg-message.in
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
