[comp.sources.bugs] less underlining patch

edf@rocky2.rockefeller.edu (David MacKenzie) (09/20/88)

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 <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  less.ulpatch
# Wrapped by dave@zedfdc  on Mon Sep 19 14:02:36 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'less.ulpatch' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'less.ulpatch'\"
else
echo shar: Extracting \"'less.ulpatch'\" \(1279 characters\)
sed "s/^X//" >'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)