Problem
The "more" command in SCO OpenServer Release 5.0.0 was derived
from the BSD4.4 source, plus modifications to support POSIX.2
and XPG4. It is new source for SCO. The new more(C) interprets
all control characters and displays them instead of ignoring them
and passing them. As a side effect, DOS files that have "\r"
will show up as ^M instead of just passing the values through.To see an example of this problem, pipe the output of the setcolor(C) program, which uses escape lead-in sequences to change the screen color, to more(C):
setcolor | moreorsetcolor | more -vIn SCO OpenServer Release 5.0.0, the output is identical. more(C) does not differentiate the input from setcolor(C). In SCO Open Desktop Release 3.0, more(C) would show different output in either case.
Solution
Here is a sample program that works in SCO Open Desktop 3.0
version of more(C). Following this example is the same program
modified for SCO OpenServer Release 5.0.0.#!/bin/sh
#==============================================================================
#
echo=/bin/echoESC=`$echo "\033\c"`
BK2=`$echo "\010\010\c"`if [ "$TERM" = "ansi" -o "$TERM" = "pansi" ]
then
_e="${ESC}[1;31;40m" # Error text (red)
_h="${ESC}[1;32;40m" # Highlighted text (green on black)
_w="${ESC}[1;36;40m" # Warning text (cyan on black)
_n="${ESC}[0;37;40m" # Normal text (white on black)
else
_e=
_n=
_h=
_w=
fiUNAME=`uname`
uname()
{
echo " " >/tmp/$$.out
echo "ERROR:${_e} $UNAME ${_n} " >>/tmp/$$.out
echo "cat /tmp/$$.out | more"
cat /tmp/$$.out | more
echo "cat /tmp/$$.out | more -v"
cat /tmp/$$.out | more -v
echo "cat /tmp/$$.out | pg"
cat /tmp/$$.out |pg
}# Debug flag
#set -xuname
exitBelow is a work around for the more(C) command. It passes
the 8 bit sequences successfully. So instead of ESC[,
use the 0x9b or \0233 sequence.#!/bin/sh
#==============================================================================
#
echo=/bin/echo# use the 0x9b or 0233 8 bit escape sequence.
ESC=`$echo "\0233\c"`
BK2=`$echo "\010\010\c"`if [ "$TERM" = "ansi" -o "$TERM" = "pansi" ]
then
_e="${ESC}=4F" # Error text (red)
# _e="${ESC}[=4F" # Error text (red)
# _e="${ESC}[1;31;40m" # Error text (red)
_h="${ESC}[1;32;40m" # Highlighted text (green on black)
_w="${ESC}[1;36;40m" # Warning text (cyan on black)
# _n="${ESC}[0;37;40m" # Normal text (white on black)
# _n="${ESC}[=7F${ESC}[=0G" # Normal text (white on black)
_n="${ESC}=7F${ESC}[=0G" # Normal text (white on black)
else
_e=
_n=
_h=
_w=
fiUNAME=`uname`
uname()
{
echo " " /tmp/$$.out
echo "ERROR:${_e} $UNAME ${_n} " >/tmp/$$.out
echo "cat /tmp/$$.out | more"
cat /tmp/$$.out | more
echo "cat /tmp/$$.out | more -v"
cat /tmp/$$.out | more -v
echo "cat /tmp/$$.out | pg"
cat /tmp/$$.out |pg
}# Debug flag
#set -xuname
exit