From owner-svn-src-all@FreeBSD.ORG Wed Sep 2 04:26:34 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC8C8106566B; Wed, 2 Sep 2009 04:26:34 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 822778FC17; Wed, 2 Sep 2009 04:26:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n824QYsM081389; Wed, 2 Sep 2009 04:26:34 GMT (envelope-from ache@svn.freebsd.org) Received: (from ache@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n824QY98081387; Wed, 2 Sep 2009 04:26:34 GMT (envelope-from ache@svn.freebsd.org) Message-Id: <200909020426.n824QY98081387@svn.freebsd.org> From: "Andrey A. Chernov" Date: Wed, 2 Sep 2009 04:26:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196750 - head/contrib/ee X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Sep 2009 04:26:34 -0000 Author: ache Date: Wed Sep 2 04:26:34 2009 New Revision: 196750 URL: http://svn.freebsd.org/changeset/base/196750 Log: 1) Use isprint() instead of hardcoded values to detect non-printable. 2) Use (unsigned char) cast in waddch() calls. It fix highlighting bug: sign extension of 8bit to the attributes area. 3) Use setlocale() in any case. Modified: head/contrib/ee/ee.c Modified: head/contrib/ee/ee.c ============================================================================== --- head/contrib/ee/ee.c Wed Sep 2 03:03:53 2009 (r196749) +++ head/contrib/ee/ee.c Wed Sep 2 04:26:34 2009 (r196750) @@ -726,7 +726,7 @@ int character; /* new character */ } *point = character; /* insert new character */ wclrtoeol(text_win); - if (((character >= 0) && (character < ' ')) || (character >= 127)) /* check for TAB character*/ + if (!isprint((unsigned char)character)) /* check for TAB character*/ { scr_pos = scr_horz += out_char(text_win, character, scr_horz); point++; @@ -734,7 +734,7 @@ int character; /* new character */ } else { - waddch(text_win, character); + waddch(text_win, (unsigned char)character); scr_pos = ++scr_horz; point++; position ++; @@ -969,17 +969,17 @@ int column; } else { - waddch(window, (char)character ); + waddch(window, (unsigned char)character ); return(1); } } else { - waddch(window, (char)character); + waddch(window, (unsigned char)character); return(1); } for (i2 = 0; (string[i2] != '\0') && (((column+i2+1)-horiz_offset) < last_col); i2++) - waddch(window, string[i2]); + waddch(window, (unsigned char)string[i2]); return(strlen(string)); } @@ -1044,7 +1044,7 @@ int length; /* length (in bytes) of line wclrtoeol(text_win); while ((posit < length) && (column <= last_col)) { - if ((*temp < 32) || (*temp >= 127)) + if (!isprint(*temp)) { column += len_char(*temp, abs_column); abs_column += out_char(text_win, *temp, abs_column); @@ -1923,13 +1923,13 @@ int advance; /* if true, skip leading s } *nam_str = in; g_pos++; - if (((in < ' ') || (in > 126)) && (g_horz < (last_col - 1))) + if (!isprint((unsigned char)in) && (g_horz < (last_col - 1))) g_horz += out_char(com_win, in, g_horz); else { g_horz++; if (g_horz < (last_col - 1)) - waddch(com_win, in); + waddch(com_win, (unsigned char)in); } nam_str++; } @@ -5085,8 +5085,8 @@ strings_init() { int counter; -#ifndef NO_CATGETS setlocale(LC_ALL, ""); +#ifndef NO_CATGETS catalog = catopen("ee", NL_CAT_LOCALE); #endif /* NO_CATGETS */