From owner-freebsd-hackers@FreeBSD.ORG Mon May 16 19:48:57 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8650C16A4D0 for ; Mon, 16 May 2005 19:48:57 +0000 (GMT) Received: from harmony.village.org (rover.village.org [168.103.84.182]) by mx1.FreeBSD.org (Postfix) with ESMTP id D3B3043D7D for ; Mon, 16 May 2005 19:48:56 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost.village.org [127.0.0.1]) by harmony.village.org (8.13.3/8.13.1) with ESMTP id j4GJl4O9024848; Mon, 16 May 2005 13:47:04 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Mon, 16 May 2005 13:47:04 -0600 (MDT) Message-Id: <20050516.134704.78731828.imp@bsdimp.com> To: arundel@h3c.de From: Warner Losh In-Reply-To: <20050516190113.GA20359@skatecity> References: <20050516171143.GA19979@skatecity> <20050516.121716.41656814.imp@bsdimp.com> <20050516190113.GA20359@skatecity> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: freebsd-hackers@freebsd.org Subject: Re: Console ASCII interpretation X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 May 2005 19:48:57 -0000 > Since there already is an ascii code for the white space (SP = 20h) I don't > quite understand why 00h is also interpreted as a white space. Because that > makes two values for a white space, but not a single value for the NOP > operator. If this behaviour of the console is due to historic reasons > (old BSD or AT&T Unix) then there should be a way of changing the code. The ANSI character set standard doesn't talk at all about how characters are rendering. Terminal emulation software renders the characters as they see fit. NIL is *NOT* a NOP. While the ansi standard suggests that, it isn't required to be. It is used for a variety of thing in a variety of places. Some terminals use it as a timing character to give other operations a chance to finish. Some terminals even use it to specify coordinates because their command set is binary in nature. In addtion, many terminal emulators will pass through characters that don't enter a meta mode unmolested. In this pass through, often times the default rendering for a character that is not otherwise present in the font is ' '. Sometimes another character is chosen (like a square box, a 1/2 tone triangle, a cursor outline rectangle, etc). That's just part of the game. You could argue that DEL is used to rubout (delete backwards character) a character, why then would you have BS (back space) do the same thing? (please don't argue, since both are right or wrong depending on the context). The point is that control sequences in ASCII aren't well standardized, and even if the original standards documents appear to say otherwise, time has shown a huge variety of implementations out there. You are running into one right now. You are output 4 bytes, when you should only be outputting 2 and are claiming that the bug is shomehow in the console software. Yet the console software is emulating something older with a high degree of fidelity. Were we to change today's implementation, there's code that's been written over time that depends on the current behavior. Maybe not much code, and one could argue that there are bugs in that code. But maybe a bunch of code... I guess what I'm trying to say is that if you output NUL, then you are telling the terminal emulation to do something. Don't be surprised when it does do something :-). The bottom line is that your code is wrong, and your understanding of NUL in this context is wrong and you need to fix both. Warner