Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!ukma!nrl-cmf!cmcl2!rocky8!rocky2.rockefeller.edu!edf
From: edf@rocky2.rockefeller.edu (David MacKenzie)
Newsgroups: comp.sources.bugs
Subject: less underlining patch
Keywords: less patch
Message-ID: <199@rocky8.rockefeller.edu>
Date: 20 Sep 88 06:12:57 GMT
Sender: notes@rocky8.rockefeller.edu
Reply-To: edf@rocky2.rockefeller.edu (David MacKenzie)
Organization: Environmental Defense Fund
Lines: 78
References:


The version of less posted recently has a problem doing underlining on
our system due to sign-extension.  Instead of underlining, "^"
characters appear surrounding the text.  The following patch corrects
that problem, and shouldn't hurt anything on systems where it was
already working.

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh 'less.ulpatch' <<'END_OF_FILE'
X*** less.h.orig
X--- less.h
X**************
X*** 59,68
X  #define	BS_CONTROL	2	/* \b treated as control char; prints as ^H */
X  
X  /* Special chars used to tell put_line() to do something special */
X! #define	UL_CHAR		'\201'	/* Enter underline mode */
X! #define	UE_CHAR		'\202'	/* Exit underline mode */
X! #define	BO_CHAR		'\203'	/* Enter boldface mode */
X! #define	BE_CHAR		'\204'	/* Exit boldface mode */
X  
X  #define	CONTROL(c)		((c)&037)
X  #define	SIGNAL(sig,func)	signal(sig,func)
X--- 59,68 -----
X  #define	BS_CONTROL	2	/* \b treated as control char; prints as ^H */
X  
X  /* Special chars used to tell put_line() to do something special */
X! #define	UL_CHAR		(unsigned) 0201	/* Enter underline mode */
X! #define	UE_CHAR		(unsigned) 0202	/* Exit underline mode */
X! #define	BO_CHAR		(unsigned) 0203	/* Enter boldface mode */
X! #define	BE_CHAR		(unsigned) 0204	/* Exit boldface mode */
X  
X  #define	CONTROL(c)		((c)&037)
X  #define	SIGNAL(sig,func)	signal(sig,func)
X*** output.c.orig
X--- output.c
X**************
X*** 44,50
X  	column = 0;
X  	for (p = line;  *p != '\0';  p++)
X  	{
X! 		switch (c = *p)
X  		{
X  		case UL_CHAR:
X  			ul_enter();
X--- 44,50 -----
X  	column = 0;
X  	for (p = line;  *p != '\0';  p++)
X  	{
X! 		switch (c = *p & 0377)
X  		{
X  		case UL_CHAR:
X  			ul_enter();
END_OF_FILE
if test 1279 -ne `wc -c <'less.ulpatch'`; then
    echo shar: \"'less.ulpatch'\" unpacked with wrong size!
fi
# end of 'less.ulpatch'
fi
echo shar: End of shell archive.
exit 0
-----
David MacKenzie
Environmental Defense Fund
edf@rocky2.rockefeller.edu (...rutgers!cmcl2!rocky2!edf)