Subject: bin/3693: fmt(1) filters out all chars > 128
To: None <gnats-bugs@gnats.netbsd.org>
From: Jaromir Dolecek <dolecek@moria.ics.muni.cz>
List: netbsd-bugs
Date: 05/31/1997 12:52:22
>Number:         3693
>Category:       bin
>Synopsis:       fmt(1) filters out all chars > 128
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 31 05:05:01 1997
>Last-Modified:
>Originator:     Jaromir Dolecek
>Organization:
	ICS MU, Brno, Czech Republic
>Release:        1.2E
>Environment:
	
System: NetBSD moria.ics.muni.cz 1.2E NetBSD 1.2E (f) #3: Sat May 31 10:56:10 MET DST 1997 dolecek@saruman.ics.muni.cz:/home/dolecek/tmp/f/src/sys/arch/i386/compile/f i386


>Description:
	fmt(1) filters out (or better said, ignores) all chars > 128.
	This leads to all national characters beeing swept out of
	fmt(1)ted text.

>How-To-Repeat:
	Create some text w/ national characters in and try filter it through 
	fmt(1)
>Fix:
	Okay, maybe one should use locale here somehow, but it's not
	working now for anything other than C and POSIX (at least
	I'm in impression of that). So this patch would change
	fmt(1)'s behaviour in way it would filter out only chars
	0-31, 128-159, as all others are chars valid in ISO-8859-XX fonts.
	As the end text won't contain any control or 128 + control
	chars, it won't break terminal even if it's 7bit one.

	It's working well for me. It's possible it can break some
	16bit charsets if one of chars from 8bit pair is filtered
	out while the other not, but it was happening now too, so
	no change encountered ;-)

*** src/usr.bin/fmt/fmt.c.orig	Sat May 31 12:37:18 1997
--- src/usr.bin/fmt/fmt.c	Sat May 31 12:35:27 1997
***************
*** 157,163 ****
  				c = getc(fi);
  				continue;
  			}
! 			if ((c < ' ' || c >= 0177) && c != '\t') {
  				c = getc(fi);
  				continue;
  			}
--- 157,164 ----
  				c = getc(fi);
  				continue;
  			}
! 			if ((c < ' ' || ( c >= 0177 && c < 0177 + ' ' ) )
! 				&& c != '\t') {
  				c = getc(fi);
  				continue;
  			}
>Audit-Trail:
>Unformatted: