[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xterm: Changes to 'upstream-unstable'



 MANIFEST               |    3 
 Tekproc.c              |   17 
 aclocal.m4             |  296 ++++--
 button.c               |   14 
 charproc.c             |  100 +-
 configure              | 2265 ++++++++++++++++++++++++++++++++++---------------
 configure.in           |    8 
 error.h                |    3 
 fontutils.c            |   11 
 main.c                 |  142 +--
 menu.c                 |    4 
 misc.c                 |   91 +
 os2main.c              |    9 
 print.c                |    6 
 ptyx.h                 |   12 
 resize.c               |   21 
 screen.c               |   76 -
 scrollbar.c            |   25 
 trace.c                |   94 +-
 trace.h                |    7 
 util.c                 |   28 
 version.h              |    4 
 vttests/query-fonts.pl |  166 +++
 xterm.log.html         |   44 
 xterm.man              |   72 +
 xterm_io.h             |   10 
 xtermcap.c             |    4 
 27 files changed, 2414 insertions(+), 1118 deletions(-)

New commits:
commit e1a934caebec27fe54d1f49c43dc495fb09a87c0
Author: Julien Cristau <jcristau@debian.org>
Date:   Sun Jun 6 13:48:33 2010 +0200

    Imported Upstream version 259

diff --git a/MANIFEST b/MANIFEST
index 262de0b..f56b8fd 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,4 +1,4 @@
-MANIFEST for xterm-258, version xterm-258
+MANIFEST for xterm-259, version xterm-259
 --------------------------------------------------------------------------------
 MANIFEST                        this file
 256colres.h                     resource-definitions for 256-color mode
@@ -144,6 +144,7 @@ vttests/dynamic.sh              script to illustrate the dynamic colors control
 vttests/dynamic2.sh             complete example of dynamic colors
 vttests/fonts.sh                script to demonstrate font-switching sequences
 vttests/paste64.pl              script to test base64-selection option
+vttests/query-fonts.pl          script to demo/test font-querying
 vttests/resize.pl               translated resize.sh to perl since it is easy to test, and I needed
 vttests/resize.sh               script to demonstrate resizing
 vttests/tcapquery.pl            script to test tcap-query option
diff --git a/Tekproc.c b/Tekproc.c
index b5ae9d2..f12aa5c 100644
--- a/Tekproc.c
+++ b/Tekproc.c
@@ -1,4 +1,4 @@
-/* $XTermId: Tekproc.c,v 1.176 2010/04/18 16:22:54 tom Exp $ */
+/* $XTermId: Tekproc.c,v 1.178 2010/06/04 09:39:15 tom Exp $ */
 
 /*
  * Warning, there be crufty dragons here.
@@ -707,7 +707,6 @@ Tekparse(TekWidget tw)
 	case CASE_PRINT:
 	    TRACE(("case: printable character\n"));
 	    ch = c;
-	    c = (IChar) tekscr->cur.fontsize;
 	    x = (int) (tekscr->cur_X * TekScale(tekscr))
 		+ screen->border;
 	    y = (int) ((TEKHEIGHT + TEKTOPPAD - tekscr->cur_Y) * TekScale(tekscr))
@@ -869,13 +868,15 @@ Tinput(TekWidget tw)
     tek = TekRecord;
     if (tek->count >= TEK_LINK_BLOCK_SIZE
 	|| tek->fontsize != tekscr->cur.fontsize) {
-	if ((TekRecord = tek->next = CastMalloc(TekLink)) == 0)
+	if ((TekRecord = tek->next = CastMalloc(TekLink)) == 0) {
 	    Panic("Tinput: malloc error (%d)\n", errno);
-	tek = tek->next;
-	tek->next = (TekLink *) 0;
-	tek->fontsize = (unsigned short) tekscr->cur.fontsize;
-	tek->count = 0;
-	tek->ptr = tek->data;
+	} else {
+	    tek = tek->next;
+	    tek->next = (TekLink *) 0;
+	    tek->fontsize = (unsigned short) tekscr->cur.fontsize;
+	    tek->count = 0;
+	    tek->ptr = tek->data;
+	}
     }
     tek->count++;
 
diff --git a/aclocal.m4 b/aclocal.m4
index 70fb1fc..f9efe05 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,4 +1,4 @@
-dnl $XTermId: aclocal.m4,v 1.269 2010/04/17 20:32:28 tom Exp $
+dnl $XTermId: aclocal.m4,v 1.284 2010/06/05 15:31:37 tom Exp $
 dnl
 dnl ---------------------------------------------------------------------------
 dnl
@@ -55,7 +55,7 @@ AC_DEFUN([AM_LANGINFO_CODESET],
   fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_ADD_CFLAGS version: 9 updated: 2010/01/09 11:05:50
+dnl CF_ADD_CFLAGS version: 10 updated: 2010/05/26 05:38:42
 dnl -------------
 dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
 dnl The second parameter if given makes this macro verbose.
@@ -125,17 +125,17 @@ esac
 done
 
 if test -n "$cf_new_cflags" ; then
-	ifelse($2,,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
+	ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
 	CFLAGS="$CFLAGS $cf_new_cflags"
 fi
 
 if test -n "$cf_new_cppflags" ; then
-	ifelse($2,,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
+	ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
 	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
 fi
 
 if test -n "$cf_new_extra_cppflags" ; then
-	ifelse($2,,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
+	ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
 	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
 fi
 
@@ -143,6 +143,22 @@ AC_SUBST(EXTRA_CPPFLAGS)
 
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05
+dnl ----------
+dnl Add a library, used to enforce consistency.
+dnl
+dnl $1 = library to add, without the "-l"
+dnl $2 = variable to update (default $LIBS)
+AC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_ADD_LIBS version: 1 updated: 2010/06/02 05:03:05
+dnl -----------
+dnl Add one or more libraries, used to enforce consistency.
+dnl
+dnl $1 = libraries to add, with the "-l", etc.
+dnl $2 = variable to update (default $LIBS)
+AC_DEFUN([CF_ADD_LIBS],[ifelse($2,,LIBS,[$2])="$1 [$]ifelse($2,,LIBS,[$2])"])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_ANSI_CC_CHECK version: 9 updated: 2001/12/30 17:53:34
 dnl ----------------
 dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
@@ -207,7 +223,7 @@ dnl Allow user to enable a normally-off option.
 AC_DEFUN([CF_ARG_ENABLE],
 [CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_ARG_OPTION version: 3 updated: 1997/10/18 14:42:41
+dnl CF_ARG_OPTION version: 4 updated: 2010/05/26 05:38:42
 dnl -------------
 dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
 dnl values.
@@ -219,13 +235,13 @@ dnl $3 = action to perform if option is not default
 dnl $4 = action if perform if option is default
 dnl $5 = default option value (either 'yes' or 'no')
 AC_DEFUN([CF_ARG_OPTION],
-[AC_ARG_ENABLE($1,[$2],[test "$enableval" != ifelse($5,no,yes,no) && enableval=ifelse($5,no,no,yes)
+[AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes)
   if test "$enableval" != "$5" ; then
-ifelse($3,,[    :]dnl
-,[    $3]) ifelse($4,,,[
+ifelse([$3],,[    :]dnl
+,[    $3]) ifelse([$4],,,[
   else
     $4])
-  fi],[enableval=$5 ifelse($4,,,[
+  fi],[enableval=$5 ifelse([$4],,,[
   $4
 ])dnl
   ])])dnl
@@ -287,7 +303,7 @@ AC_TRY_LINK([#include <stdio.h>],[printf("Hello world");],,
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CHECK_ERRNO version: 10 updated: 2008/08/22 16:33:22
+dnl CF_CHECK_ERRNO version: 11 updated: 2010/05/26 05:38:42
 dnl --------------
 dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g.,
 dnl the 'errno' variable.  Define a DECL_xxx symbol if we must declare it
@@ -305,7 +321,7 @@ AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[
 #include <stdio.h>
 #include <sys/types.h>
 #include <errno.h> ],
-    ifelse($2,,int,$2) x = (ifelse($2,,int,$2)) $1,
+    ifelse([$2],,int,[$2]) x = (ifelse([$2],,int,[$2])) $1,
     [cf_cv_dcl_$1=yes],
     [cf_cv_dcl_$1=no])
 ])
@@ -316,7 +332,7 @@ if test "$cf_cv_dcl_$1" = no ; then
 fi
 
 # It's possible (for near-UNIX clones) that the data doesn't exist
-CF_CHECK_EXTERN_DATA($1,ifelse($2,,int,$2))
+CF_CHECK_EXTERN_DATA($1,ifelse([$2],,int,[$2]))
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl CF_CHECK_EXTERN_DATA version: 3 updated: 2001/12/30 18:03:23
@@ -466,7 +482,7 @@ int main() {
 	fi
 ])])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_FUNC_TGETENT version: 12 updated: 2010/01/04 19:48:45
+dnl CF_FUNC_TGETENT version: 15 updated: 2010/06/04 20:54:56
 dnl ---------------
 dnl Check for tgetent function in termcap library.  If we cannot find this,
 dnl we'll use the $LINES and $COLUMNS environment variables to pass screen
@@ -511,7 +527,7 @@ else
 fi
 for cf_termlib in '' $cf_TERMLIB ; do
 	LIBS="$cf_save_LIBS"
-	test -n "$cf_termlib" && LIBS="$LIBS -l$cf_termlib"
+	test -n "$cf_termlib" && CF_ADD_LIB($cf_termlib)
 	AC_TRY_RUN([
 /* terminfo implementations ignore the buffer argument, making it useless for
  * the xterm application, which uses this information to make a new TERMCAP
@@ -541,7 +557,7 @@ LIBS="$cf_save_LIBS"
 # not have side effects other than setting the cache variable, because
 # they are not executed when a cached value exists.)
 if test "$cf_cv_lib_tgetent" != no ; then
-	test "$cf_cv_lib_tgetent" != yes && LIBS="$LIBS $cf_cv_lib_tgetent"
+	test "$cf_cv_lib_tgetent" != yes && CF_ADD_LIBS($cf_cv_lib_tgetent)
 	AC_DEFINE(USE_TERMCAP)
 	if test "$cf_full_tgetent" = no ; then
 		AC_TRY_COMPILE([
@@ -571,7 +587,7 @@ else
 	])
 
 	if test "$cf_cv_lib_part_tgetent" != no ; then
-		LIBS="$LIBS $cf_cv_lib_part_tgetent"
+		CF_ADD_LIBS($cf_cv_lib_part_tgetent)
 		AC_CHECK_HEADERS(termcap.h)
 
                 # If this is linking against ncurses, we'll trigger the
@@ -691,7 +707,7 @@ rm -rf conftest*
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_GCC_VERSION version: 4 updated: 2005/08/27 09:53:42
+dnl CF_GCC_VERSION version: 5 updated: 2010/04/24 11:02:31
 dnl --------------
 dnl Find version of gcc
 AC_DEFUN([CF_GCC_VERSION],[
@@ -699,13 +715,13 @@ AC_REQUIRE([AC_PROG_CC])
 GCC_VERSION=none
 if test "$GCC" = yes ; then
 	AC_MSG_CHECKING(version of $CC)
-	GCC_VERSION="`${CC} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
+	GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
 	test -z "$GCC_VERSION" && GCC_VERSION=unknown
 	AC_MSG_RESULT($GCC_VERSION)
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_GCC_WARNINGS version: 24 updated: 2009/02/01 15:21:00
+dnl CF_GCC_WARNINGS version: 25 updated: 2010/04/24 11:03:31
 dnl ---------------
 dnl Check if the compiler supports useful warning options.  There's a few that
 dnl we don't use, simply because they're too noisy:
@@ -773,10 +789,10 @@ elif test "$GCC" = yes
 then
 	AC_CHECKING([for $CC warning options])
 	cf_save_CFLAGS="$CFLAGS"
-	EXTRA_CFLAGS="-W -Wall"
+	EXTRA_CFLAGS=
 	cf_warn_CONST=""
 	test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
-	for cf_opt in \
+	for cf_opt in W Wall \
 		Wbad-function-cast \
 		Wcast-align \
 		Wcast-qual \
@@ -851,7 +867,7 @@ AC_DEFUN([CF_HELP_MESSAGE],
 [AC_DIVERT_HELP([$1])dnl
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_IMAKE_CFLAGS version: 30 updated: 2008/03/23 15:04:54
+dnl CF_IMAKE_CFLAGS version: 31 updated: 2010/05/26 05:38:42
 dnl ---------------
 dnl Use imake to obtain compiler flags.  We could, in principle, write tests to
 dnl get these, but if imake is properly configured there is no point in doing
@@ -909,8 +925,8 @@ CF_EOF
 
 	cat >> ./Imakefile <<'CF_EOF'
 findstddefs:
-	@echo IMAKE ${ALLDEFINES}ifelse($1,,,[ $1])       | sed -f fix_cflags.sed
-	@echo IMAKE ${EXTRA_LOAD_FLAGS}ifelse($2,,,[ $2]) | sed -f fix_lflags.sed
+	@echo IMAKE ${ALLDEFINES}ifelse([$1],,,[ $1])       | sed -f fix_cflags.sed
+	@echo IMAKE ${EXTRA_LOAD_FLAGS}ifelse([$2],,,[ $2]) | sed -f fix_lflags.sed
 CF_EOF
 
 	if ( $IMAKE $cf_imake_opts 1>/dev/null 2>&AC_FD_CC && test -f Makefile)
@@ -1037,7 +1053,7 @@ AC_TRY_LINK([
 [cf_cv_input_method=no])])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_INTEL_COMPILER version: 3 updated: 2005/08/06 18:37:29
+dnl CF_INTEL_COMPILER version: 4 updated: 2010/05/26 05:38:42
 dnl -----------------
 dnl Check if the given compiler is really the Intel compiler for Linux.  It
 dnl tries to imitate gcc, but does not return an error when it finds a mismatch
@@ -1051,24 +1067,24 @@ dnl $1 = GCC (default) or GXX
 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
 dnl $3 = CFLAGS (default) or CXXFLAGS
 AC_DEFUN([CF_INTEL_COMPILER],[
-ifelse($2,,INTEL_COMPILER,[$2])=no
+ifelse([$2],,INTEL_COMPILER,[$2])=no
 
-if test "$ifelse($1,,[$1],GCC)" = yes ; then
+if test "$ifelse([$1],,[$1],GCC)" = yes ; then
 	case $host_os in
 	linux*|gnu*)
-		AC_MSG_CHECKING(if this is really Intel ifelse($1,GXX,C++,C) compiler)
-		cf_save_CFLAGS="$ifelse($3,,CFLAGS,[$3])"
-		ifelse($3,,CFLAGS,[$3])="$ifelse($3,,CFLAGS,[$3]) -no-gcc"
+		AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler)
+		cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
+		ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc"
 		AC_TRY_COMPILE([],[
 #ifdef __INTEL_COMPILER
 #else
 make an error
 #endif
-],[ifelse($2,,INTEL_COMPILER,[$2])=yes
+],[ifelse([$2],,INTEL_COMPILER,[$2])=yes
 cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
 ],[])
-		ifelse($3,,CFLAGS,[$3])="$cf_save_CFLAGS"
-		AC_MSG_RESULT($ifelse($2,,INTEL_COMPILER,[$2]))
+		ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
+		AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2]))
 		;;
 	esac
 fi
@@ -1101,7 +1117,7 @@ AC_TRY_COMPILE([
 test $cf_cv_path_lastlog != no && AC_DEFINE(USE_LASTLOG)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_LD_RPATH_OPT version: 2 updated: 2010/03/27 19:27:54
+dnl CF_LD_RPATH_OPT version: 3 updated: 2010/06/02 05:03:05
 dnl ---------------
 dnl For the given system and compiler, find the compiler flags to pass to the
 dnl loader to use the "rpath" feature.
@@ -1146,7 +1162,7 @@ case "x$LD_RPATH_OPT" in #(vi
 x-R*)
 	AC_MSG_CHECKING(if we need a space after rpath option)
 	cf_save_LIBS="$LIBS"
-	LIBS="${LD_RPATH_OPT}$libdir $LIBS"
+	CF_ADD_LIBS(${LD_RPATH_OPT}$libdir)
 	AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes)
 	LIBS="$cf_save_LIBS"
 	AC_MSG_RESULT($cf_rpath_space)
@@ -1230,7 +1246,7 @@ AC_DEFUN([CF_MSG_LOG],[
 echo "${as_me-configure}:__oline__: testing $* ..." 1>&AC_FD_CC
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_PATHSEP version: 4 updated: 2009/01/11 20:30:23
+dnl CF_PATHSEP version: 5 updated: 2010/05/26 05:38:42
 dnl ----------
 dnl Provide a value for the $PATH and similar separator
 AC_DEFUN([CF_PATHSEP],
@@ -1239,7 +1255,7 @@ AC_DEFUN([CF_PATHSEP],
 	os2*)	PATH_SEPARATOR=';'  ;;
 	*)	PATH_SEPARATOR=':'  ;;
 	esac
-ifelse($1,,,[$1=$PATH_SEPARATOR])
+ifelse([$1],,,[$1=$PATH_SEPARATOR])
 	AC_SUBST(PATH_SEPARATOR)
 ])dnl
 dnl ---------------------------------------------------------------------------
@@ -1287,7 +1303,7 @@ if test -n "$cf_path_prog" ; then
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_PATH_SYNTAX version: 12 updated: 2008/03/23 14:45:59
+dnl CF_PATH_SYNTAX version: 13 updated: 2010/05/26 05:38:42
 dnl --------------
 dnl Check the argument to see that it looks like a pathname.  Rewrite it if it
 dnl begins with one of the prefix/exec_prefix variables, and then again if the
@@ -1319,7 +1335,7 @@ case ".[$]$1" in #(vi
   $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
   ;;
 *)
-  ifelse($2,,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
+  ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
   ;;
 esac
 ])dnl
@@ -1356,7 +1372,7 @@ fi
 AC_SUBST(PKG_CONFIG)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_POSIX_C_SOURCE version: 7 updated: 2010/01/09 11:05:50
+dnl CF_POSIX_C_SOURCE version: 8 updated: 2010/05/26 05:38:42
 dnl -----------------
 dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
 dnl
@@ -1372,7 +1388,7 @@ dnl Parameters:
 dnl	$1 is the nominal value for _POSIX_C_SOURCE
 AC_DEFUN([CF_POSIX_C_SOURCE],
 [
-cf_POSIX_C_SOURCE=ifelse($1,,199506L,$1)
+cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1])
 
 cf_save_CFLAGS="$CFLAGS"
 cf_save_CPPFLAGS="$CPPFLAGS"
@@ -1575,7 +1591,7 @@ AC_SUBST(PROG_EXT)
 test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT")
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_REGEX version: 6 updated: 2010/03/27 13:41:56
+dnl CF_REGEX version: 7 updated: 2010/05/29 16:31:02
 dnl --------
 dnl Attempt to determine if we've got one of the flavors of regular-expression
 dnl code that we can support.
@@ -1588,7 +1604,7 @@ AC_CHECK_FUNC(regcomp,[cf_regex_func=regcomp],[
 	for cf_regex_lib in regex re
 	do
 		AC_CHECK_LIB($cf_regex_lib,regcomp,[
-				LIBS="-l$cf_regex_lib $LIBS"
+				CF_ADD_LIB($cf_regex_lib)
 				cf_regex_func=regcomp
 				break])
 	done
@@ -1597,7 +1613,7 @@ AC_CHECK_FUNC(regcomp,[cf_regex_func=regcomp],[
 if test "$cf_regex_func" = no ; then
 	AC_CHECK_FUNC(compile,[cf_regex_func=compile],[
 		AC_CHECK_LIB(gen,compile,[
-				LIBS="-lgen $LIBS"
+				CF_ADD_LIB(gen)
 				cf_regex_func=compile])])
 fi
 
@@ -2037,6 +2053,29 @@ foo.c_ospeed = B9600;
 test "$cf_cv_termio_c_ispeed" = yes && AC_DEFINE(HAVE_TERMIO_C_ISPEED)
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_TRY_PKG_CONFIG version: 3 updated: 2010/06/02 05:03:05
+dnl -----------------
+dnl This is a simple wrapper to use for pkg-config, for libraries which may be
+dnl available in that form.
+dnl
+dnl $1 = package name
+dnl $2 = extra logic to use, if any, after updating CFLAGS and LIBS
+dnl $3 = logic to use if pkg-config does not have the package
+AC_DEFUN([CF_TRY_PKG_CONFIG],[
+AC_REQUIRE([CF_PKG_CONFIG])
+
+if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $1; then
+	CF_VERBOSE(found package $1)
+	cf_pkgconfig_incs="`$PKG_CONFIG --cflags $1 2>/dev/null`"
+	cf_pkgconfig_libs="`$PKG_CONFIG --libs   $1 2>/dev/null`"
+	CF_ADD_CFLAGS($cf_pkgconfig_incs)
+	CF_ADD_LIBS($cf_pkgconfig_libs)
+	ifelse([$2],,:,[$2])
+else
+	ifelse([$3],,:,[$3])
+fi
+])
+dnl ---------------------------------------------------------------------------
 dnl CF_TTY_GROUP version: 7 updated: 2007/03/14 16:43:59
 dnl ------------
 dnl Check if the system has a tty-group defined.  This is used in xterm when
@@ -2229,14 +2268,14 @@ AC_DEFUN([CF_UPPER],
 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_UTEMPTER version: 2 updated: 2000/01/22 22:50:59
+dnl CF_UTEMPTER version: 3 updated: 2010/06/02 05:03:05
 dnl -----------
 dnl Try to link with utempter library
 AC_DEFUN([CF_UTEMPTER],
 [
 AC_CACHE_CHECK(if we can link with utempter library,cf_cv_have_utempter,[
 cf_save_LIBS="$LIBS"
-LIBS="-lutempter $LIBS"
+CF_ADD_LIB(utempter)
 AC_TRY_LINK([
 #include <utempter.h>
 ],[
@@ -2249,7 +2288,7 @@ LIBS="$cf_save_LIBS"
 ])
 if test "$cf_cv_have_utempter" = yes ; then
 	AC_DEFINE(USE_UTEMPTER)
-	LIBS="-lutempter $LIBS"
+	CF_ADD_LIB(utempter)
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
@@ -2521,7 +2560,7 @@ AC_DEFUN([CF_VERBOSE],
 CF_MSG_LOG([$1])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_WITH_IMAKE_CFLAGS version: 8 updated: 2005/11/02 15:04:41
+dnl CF_WITH_IMAKE_CFLAGS version: 9 updated: 2010/05/26 05:38:42
 dnl --------------------
 dnl xterm and similar programs build more readily when propped up with imake's
 dnl hand-tuned definitions.  If we do not use imake, provide fallbacks for the
@@ -2537,7 +2576,7 @@ CF_ARG_DISABLE(imake,
 AC_MSG_RESULT($enable_imake)
 
 if test "$enable_imake" = yes ; then
-	CF_IMAKE_CFLAGS(ifelse($1,,,$1))
+	CF_IMAKE_CFLAGS(ifelse([$1],,,[$1]))
 fi
 
 if test -n "$IMAKE" && test -n "$IMAKE_CFLAGS" ; then
@@ -2597,7 +2636,7 @@ else
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_WITH_PATH version: 8 updated: 2007/05/13 13:16:35
+dnl CF_WITH_PATH version: 9 updated: 2010/05/26 05:38:42
 dnl ------------
 dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
 dnl defaulting to yes/no.
@@ -2609,16 +2648,16 @@ dnl $4 = default value, shown in the help-message, must be a constant
 dnl $5 = default value, if it's an expression & cannot be in the help-message
 dnl
 AC_DEFUN([CF_WITH_PATH],
-[AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
-ifelse($4,,[withval="${$3}"],[withval="${$3-ifelse($5,,$4,$5)}"]))dnl
-if ifelse($5,,true,[test -n "$5"]) ; then
+[AC_ARG_WITH($1,[$2 ](default: ifelse([$4],,empty,[$4])),,
+ifelse([$4],,[withval="${$3}"],[withval="${$3-ifelse([$5],,[$4],[$5])}"]))dnl
+if ifelse([$5],,true,[test -n "$5"]) ; then
 CF_PATH_SYNTAX(withval)
 fi
 $3="$withval"
 AC_SUBST($3)dnl
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_WITH_PCRE version: 3 updated: 2006/02/12 17:28:56
+dnl CF_WITH_PCRE version: 8 updated: 2010/06/05 11:30:21
 dnl ------------
 dnl Add PCRE (Perl-compatible regular expressions) to the build if it is
 dnl available and the user requests it.  Assume the application will otherwise
@@ -2627,6 +2666,8 @@ dnl
 dnl TODO allow $withval to specify package location
 AC_DEFUN([CF_WITH_PCRE],
 [
+AC_REQUIRE([CF_PKG_CONFIG])
+
 AC_MSG_CHECKING(if you want to use PCRE for regular-expressions)
 AC_ARG_WITH(pcre,
 	[  --with-pcre             use PCRE for regular-expressions])
@@ -2634,16 +2675,25 @@ test -z "$with_pcre" && with_pcre=no
 AC_MSG_RESULT($with_pcre)
 
 if test "$with_pcre" != no ; then
-	AC_CHECK_LIB(pcre,pcre_compile,
-		[AC_CHECK_HEADER(pcreposix.h,
-			[AC_CHECK_LIB(pcreposix,pcreposix_regcomp,
-				[AC_DEFINE(HAVE_LIB_PCRE)
-				 AC_DEFINE(HAVE_PCREPOSIX_H)
-				 LIBS="-lpcreposix -lpcre $LIBS"],
-				AC_MSG_ERROR(Cannot find PCRE POSIX library),
-				"-lpcre")],
-			AC_MSG_ERROR(Cannot find PCRE POSIX header))],
-		AC_MSG_ERROR(Cannot find PCRE library))
+	CF_TRY_PKG_CONFIG(libpcre,,[
+		AC_CHECK_LIB(pcre,pcre_compile,,
+			AC_MSG_ERROR(Cannot find PCRE library))])
+
+		AC_DEFINE(HAVE_LIB_PCRE)
+
+		case $LIBS in #(vi
+		*pcreposix*) #(vi
+			;;
+		*)
+			AC_CHECK_LIB(pcreposix,pcreposix_regcomp,
+				[AC_DEFINE(HAVE_PCREPOSIX_H)
+				 CF_ADD_LIB(pcreposix)],
+				[AC_CHECK_LIB(pcreposix,regcomp,[
+					AC_DEFINE(HAVE_PCREPOSIX_H)
+					CF_ADD_LIB(pcreposix)],
+					AC_MSG_ERROR(Cannot find PCRE POSIX library)]))
+			;;
+		esac
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
@@ -2665,7 +2715,7 @@ AC_TRY_LINK([
 test "$cf_cv_xkb_bell_ext" = yes && AC_DEFINE(HAVE_XKB_BELL_EXT)
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_XOPEN_SOURCE version: 33 updated: 2010/03/28 15:35:52
+dnl CF_XOPEN_SOURCE version: 34 updated: 2010/05/26 05:38:42
 dnl ---------------
 dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
 dnl or adapt to the vendor's definitions to get equivalent functionality,
@@ -2676,8 +2726,8 @@ dnl	$1 is the nominal value for _XOPEN_SOURCE
 dnl	$2 is the nominal value for _POSIX_C_SOURCE
 AC_DEFUN([CF_XOPEN_SOURCE],[
 
-cf_XOPEN_SOURCE=ifelse($1,,500,$1)
-cf_POSIX_C_SOURCE=ifelse($2,,199506L,$2)
+cf_XOPEN_SOURCE=ifelse([$1],,500,[$1])
+cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
 cf_xopen_source=
 
 case $host_os in #(vi
@@ -2767,13 +2817,13 @@ if test -n "$cf_xopen_source" ; then
 fi
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_X_ATHENA version: 12 updated: 2004/06/15 21:14:41
+dnl CF_X_ATHENA version: 15 updated: 2010/06/02 05:03:05
 dnl -----------
 dnl Check for Xaw (Athena) libraries
 dnl
 dnl Sets $cf_x_athena according to the flavor of Xaw which is used.
 AC_DEFUN([CF_X_ATHENA],
-[AC_REQUIRE([CF_X_TOOLKIT])
+[
 cf_x_athena=${cf_x_athena-Xaw}
 
 AC_MSG_CHECKING(if you want to link with Xaw 3d library)
@@ -2809,23 +2859,48 @@ else
 	AC_MSG_RESULT(no)
 fi
 
-AC_CHECK_LIB(Xext,XextCreateExtension,
-	[LIBS="-lXext $LIBS"])
-
 cf_x_athena_lib=""
 
-CF_X_ATHENA_CPPFLAGS($cf_x_athena)
-CF_X_ATHENA_LIBS($cf_x_athena)
+if test "$PKG_CONFIG" != none ; then
+	cf_athena_list=
+	test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6"
+	for cf_athena_pkg in \
+		$cf_athena_list \
+		${cf_x_athena} \
+		${cf_x_athena}-devel \
+		lib${cf_x_athena} \
+		lib${cf_x_athena}-devel
+	do
+		if "$PKG_CONFIG" --exists $cf_athena_pkg; then
+			CF_VERBOSE(found package $cf_athena_pkg)
+			cf_x_athena_inc="`$PKG_CONFIG --cflags $cf_athena_pkg 2>/dev/null`"
+			cf_x_athena_lib="`$PKG_CONFIG --libs   $cf_athena_pkg 2>/dev/null`"
+			CF_ADD_CFLAGS($cf_x_athena_inc)
+			CF_ADD_LIBS($cf_x_athena_lib)
+
+			CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena)
+			AC_DEFINE_UNQUOTED($cf_x_athena_LIBS)
+			break
+		fi
+	done
+fi
+
+if test -z "$cf_x_athena_lib" ; then
+	CF_X_EXT
+	CF_X_TOOLKIT
+	CF_X_ATHENA_CPPFLAGS($cf_x_athena)
+	CF_X_ATHENA_LIBS($cf_x_athena)
+fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_X_ATHENA_CPPFLAGS version: 3 updated: 2009/01/11 15:33:39
+dnl CF_X_ATHENA_CPPFLAGS version: 5 updated: 2010/05/26 17:35:30
 dnl --------------------
 dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
 dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
 AC_DEFUN([CF_X_ATHENA_CPPFLAGS],
 [
-cf_x_athena_root=ifelse($1,,Xaw,$1)
-cf_x_athena_include=""
+cf_x_athena_root=ifelse([$1],,Xaw,[$1])
+cf_x_athena_inc=""
 
 for cf_path in default \
 	/usr/contrib/X11R6 \
@@ -2833,7 +2908,7 @@ for cf_path in default \
 	/usr/lib/X11R5 \
 	/usr/local
 do
-	if test -z "$cf_x_athena_include" ; then
+	if test -z "$cf_x_athena_inc" ; then
 		cf_save="$CPPFLAGS"
 		cf_test=X11/$cf_x_athena_root/SimpleMenu.h
 		if test $cf_path != default ; then
@@ -2849,7 +2924,7 @@ do
 			[cf_result=no])
 		AC_MSG_RESULT($cf_result)
 		if test "$cf_result" = yes ; then
-			cf_x_athena_include=$cf_path
+			cf_x_athena_inc=$cf_path
 			break
 		else
 			CPPFLAGS="$cf_save"
@@ -2857,21 +2932,21 @@ do
 	fi
 done
 
-if test -z "$cf_x_athena_include" ; then
+if test -z "$cf_x_athena_inc" ; then
 	AC_MSG_WARN(
 [Unable to successfully find Athena header files with test program])
-elif test "$cf_x_athena_include" != default ; then
-	CPPFLAGS="$CPPFLAGS -I$cf_x_athena_include"
+elif test "$cf_x_athena_inc" != default ; then
+	CPPFLAGS="$CPPFLAGS -I$cf_x_athena_inc"
 fi
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_X_ATHENA_LIBS version: 7 updated: 2008/03/23 14:46:03
+dnl CF_X_ATHENA_LIBS version: 9 updated: 2010/06/02 05:03:05
 dnl ----------------
 dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
 dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
 AC_DEFUN([CF_X_ATHENA_LIBS],
 [AC_REQUIRE([CF_X_TOOLKIT])
-cf_x_athena_root=ifelse($1,,Xaw,$1)
+cf_x_athena_root=ifelse([$1],,Xaw,[$1])
 cf_x_athena_lib=""
 
 for cf_path in default \
@@ -2889,10 +2964,10 @@ do
 			cf_save="$LIBS"
 			cf_test=XawSimpleMenuAddGlobalActions
 			if test $cf_path != default ; then
-				LIBS="-L$cf_path/lib $cf_lib $LIBS"
+				CF_ADD_LIBS(-L$cf_path/lib $cf_lib)
 				AC_MSG_CHECKING(for $cf_lib in $cf_path)
 			else
-				LIBS="$cf_lib $LIBS"
+				CF_ADD_LIBS($cf_lib)
 				AC_MSG_CHECKING(for $cf_test in $cf_lib)
 			fi
 			AC_TRY_LINK([],[$cf_test()],
@@ -2917,7 +2992,15 @@ CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena)
 AC_DEFINE_UNQUOTED($cf_x_athena_LIBS)
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_X_FREETYPE version: 21 updated: 2009/01/25 18:17:50
+dnl CF_X_EXT version: 3 updated: 2010/06/02 05:03:05
+dnl --------
+AC_DEFUN([CF_X_EXT],[
+CF_TRY_PKG_CONFIG(Xext,,[
+	AC_CHECK_LIB(Xext,XextCreateExtension,
+		[CF_ADD_LIB(Xext)])])
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_X_FREETYPE version: 22 updated: 2010/06/02 05:03:05
 dnl -------------
 dnl Check for X FreeType headers and libraries (XFree86 4.x, etc).
 dnl
@@ -3000,7 +3083,7 @@ AC_MSG_CHECKING(if we can link with FreeType libraries)
 cf_save_LIBS="$LIBS"
 cf_save_INCS="$CPPFLAGS"
 
-LIBS="$cf_cv_x_freetype_libs $LIBS"
+CF_ADD_LIBS($cf_cv_x_freetype_libs)
 CPPFLAGS="$CPPFLAGS $cf_cv_x_freetype_incs"
 
 AC_TRY_LINK([
@@ -3016,7 +3099,7 @@ LIBS="$cf_save_LIBS"
 CPPFLAGS="$cf_save_INCS"
 
 if test "$cf_cv_found_freetype" = yes ; then
-	LIBS="$cf_cv_x_freetype_libs $LIBS"
+	CF_ADD_LIBS($cf_cv_x_freetype_libs)
 	CF_ADD_CFLAGS($cf_cv_x_freetype_incs)
 	AC_DEFINE(XRENDERFONT)
 
@@ -3037,7 +3120,7 @@ AC_SUBST(HAVE_TYPE_FCCHAR32)
 AC_SUBST(HAVE_TYPE_XFTCHARSPEC)
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_X_TOOLKIT version: 12 updated: 2008/03/23 15:04:54
+dnl CF_X_TOOLKIT version: 14 updated: 2010/06/02 05:03:05
 dnl ------------
 dnl Check for X Toolkit libraries
 dnl
@@ -3046,24 +3129,27 @@ AC_DEFUN([CF_X_TOOLKIT],
 AC_REQUIRE([AC_PATH_XTRA])
 AC_REQUIRE([CF_CHECK_CACHE])
 
-# SYSTEM_NAME=`echo "$cf_cv_system_name"|tr ' ' -`
-
 cf_have_X_LIBS=no
 
-LDFLAGS="$X_LIBS $LDFLAGS"
-CF_CHECK_CFLAGS($X_CFLAGS)
+CF_TRY_PKG_CONFIG(xt,[
+	cf_have_X_LIBS=yes
+],[
 
-AC_CHECK_FUNC(XOpenDisplay,,[
-AC_CHECK_LIB(X11,XOpenDisplay,
-	[LIBS="-lX11 $LIBS"],,
-	[$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
+	LDFLAGS="$X_LIBS $LDFLAGS"
+	CF_CHECK_CFLAGS($X_CFLAGS)
 
-AC_CHECK_FUNC(XtAppInitialize,,[
-AC_CHECK_LIB(Xt, XtAppInitialize,
-	[AC_DEFINE(HAVE_LIBXT)
-	 cf_have_X_LIBS=Xt
-	 LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"],,
-	[$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
+	AC_CHECK_FUNC(XOpenDisplay,,[
+	AC_CHECK_LIB(X11,XOpenDisplay,
+		[CF_ADD_LIB(X11)],,
+		[$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
+
+	AC_CHECK_FUNC(XtAppInitialize,,[
+	AC_CHECK_LIB(Xt, XtAppInitialize,
+		[AC_DEFINE(HAVE_LIBXT)
+		 cf_have_X_LIBS=Xt
+		 LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"],,
+		[$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
+])
 
 if test $cf_have_X_LIBS = no ; then
 	AC_MSG_WARN(
diff --git a/button.c b/button.c
index 2976538..67b50d4 100644
--- a/button.c
+++ b/button.c
@@ -1,4 +1,4 @@
-/* $XTermId: button.c,v 1.375 2010/04/18 17:48:58 tom Exp $ */
+/* $XTermId: button.c,v 1.377 2010/06/04 09:27:07 tom Exp $ */
 
 /*
  * Copyright 1999-2009,2010 by Thomas E. Dickey
@@ -797,7 +797,7 @@ ReadLineMovePoint(TScreen * screen, int col, int ldelta)
 	line[count++] = ANSI_ESC;
 	line[count++] = '[';	/* XXX maybe sometimes O is better? */
     }
-    line[count++] = CharOf(col > 0 ? 'C' : 'D');
+    line[count] = CharOf(col > 0 ? 'C' : 'D');
     if (col < 0)
 	col = -col;
     while (col--)
@@ -1185,7 +1185,7 @@ xtermUtf8ToTextList(XtermWidget xw,
 	    for (i = 0; i < *text_list_count; ++i) {
 		data = (Char *) (*text_list)[i];
 		size = strlen((*text_list)[i]) + 1;
-		data = UTF8toLatin1(screen, data, size, &size);
+		(void) UTF8toLatin1(screen, data, size, &size);
 		new_size += size + 1;
 	    }
 	    new_text_list =
@@ -3395,9 +3395,11 @@ AppendStrToSelectionBuffer(TScreen * screen, Char * text, size_t len)
 	    }
 	    screen->selection_size = k;
 	}
-	memcpy(screen->selection_data + screen->selection_length, text, len);
-	screen->selection_length += len;
-	screen->selection_data[screen->selection_length] = 0;
+	if (screen->selection_data != 0) {
+	    memcpy(screen->selection_data + screen->selection_length, text, len);
+	    screen->selection_length += len;
+	    screen->selection_data[screen->selection_length] = 0;
+	}
     }
 }
 
diff --git a/charproc.c b/charproc.c
index b996ac4..b0a6b3a 100644
--- a/charproc.c
+++ b/charproc.c
@@ -1,4 +1,4 @@
-/* $XTermId: charproc.c,v 1.1055 2010/04/18 17:48:58 tom Exp $ */
+/* $XTermId: charproc.c,v 1.1061 2010/06/04 09:29:09 tom Exp $ */
 
 /*
 
@@ -727,7 +727,7 @@ static XtResource xterm_resources[] =
 #endif
 
 #if OPT_SCROLL_LOCK
-    Bres(XtNallowScrollLock, XtCAllowScrollLock, screen.allowScrollLock0, True),
+    Bres(XtNallowScrollLock, XtCAllowScrollLock, screen.allowScrollLock0, False),
 #endif
 
 #if OPT_XMC_GLITCH
@@ -3260,7 +3260,6 @@ void
 v_write(int f, Char * data, unsigned len)
 {
     int riten;
-    unsigned c = len;
 
     TRACE2(("v_write(%d:%s)\n", len, visibleChars(data, len)));
     if (v_bufstr == NULL && len > 0) {
@@ -3336,7 +3335,6 @@ v_write(int f, Char * data, unsigned len)
 		    fprintf(stderr, "%s: cannot allocate buffer space\n",
 			    xterm_name);
 		    v_buffer = v_bufstr;	/* restore clobbered pointer */
-		    c = 0;
 		}
 	    }
 	}
@@ -3919,10 +3917,12 @@ HandleStructNotify(Widget w GCC_UNUSED,
 	break;
     case ConfigureNotify:
 	if (event->xconfigure.window == XtWindow(toplevel)) {
+#if !OPT_TOOLBAR
 	    int height, width;
 
 	    height = event->xconfigure.height;
 	    width = event->xconfigure.width;
+#endif
 	    TRACE(("HandleStructNotify(ConfigureNotify) %d,%d %dx%d\n",
 		   event->xconfigure.y, event->xconfigure.x,
 		   event->xconfigure.height, event->xconfigure.width));
@@ -4986,8 +4986,10 @@ window_ops(XtermWidget xw)
 	    reply.a_pintro = 0;
 	    reply.a_nparam = 3;
 	    reply.a_param[0] = 9;
-	    reply.a_param[1] = (ParmType) (root_height / FontHeight(screen));
-	    reply.a_param[2] = (ParmType) (root_width / FontWidth(screen));
+	    reply.a_param[1] = (ParmType) (root_height
+					   / (unsigned) FontHeight(screen));
+	    reply.a_param[2] = (ParmType) (root_width
+					   / (unsigned) FontWidth(screen));
 	    reply.a_inters = 0;
 	    reply.a_final = 't';
 	    unparseseq(xw, &reply);
@@ -5856,7 +5858,7 @@ set_flags_from_list(char *target,
 		    Cardinal limit)
 {
     Cardinal n;
-    int value;
+    int value = -1;
 
     while (*source != '\0') {
 	char *next = ParseList(&source);
@@ -7215,35 +7217,38 @@ xim_real_init(XtermWidget xw)
     } else {
 	s = xw->misc.input_method;
 	i = 5 + (unsigned) strlen(s);
+
 	t = (char *) MyStackAlloc(i, buf);
-	if (t == NULL)
+	if (t == NULL) {
 	    SysError(ERROR_VINIT);
+	} else {
 
-	for (ns = s; ns && *s;) {
-	    while (*s && isspace(CharOf(*s)))
-		s++;
-	    if (!*s)
-		break;
-	    if ((ns = end = strchr(s, ',')) == 0)
-		end = s + strlen(s);
-	    while ((end != s) && isspace(CharOf(end[-1])))
-		end--;
-
-	    if (end != s) {
-		strcpy(t, "@im=");
-		strncat(t, s, (size_t) (end - s));
-
-		if ((p = XSetLocaleModifiers(t)) != 0 && *p
-		    && (screen->xim = XOpenIM(XtDisplay(xw),
-					      NULL,
-					      NULL,
-					      NULL)) != 0)
+	    for (ns = s; ns && *s;) {
+		while (*s && isspace(CharOf(*s)))
+		    s++;
+		if (!*s)
 		    break;
+		if ((ns = end = strchr(s, ',')) == 0)
+		    end = s + strlen(s);
+		while ((end != s) && isspace(CharOf(end[-1])))
+		    end--;
+
+		if (end != s) {
+		    strcpy(t, "@im=");
+		    strncat(t, s, (size_t) (end - s));
+
+		    if ((p = XSetLocaleModifiers(t)) != 0 && *p
+			&& (screen->xim = XOpenIM(XtDisplay(xw),
+						  NULL,
+						  NULL,
+						  NULL)) != 0)
+			break;
 
+		}
+		s = ns + 1;
 	    }
-	    s = ns + 1;


Reply to: