svn commit: r315418 - in head/sys/teken: . libteken

Oliver Pinter oliver.pinter at hardenedbsd.org
Thu Mar 16 18:45:04 UTC 2017


On 3/16/17, Bruce Evans <brde at optusnet.com.au> wrote:
> On Thu, 16 Mar 2017, Bruce Evans wrote:
>
>> Log:
>>  Add teken_256to16() to convert xterm-256 256-color codes to xterm
>> 16-color
>>  codes.  This will be used to fix bright colors.
>>
>>  Improve teken_256to8().  Use a lookup table instead of calculations.
>> The
>>  ...
>
> A shell script for printing some text color maps is attached.  Also a
> sloppier one for printing some CSI sequences.
>
> The first one can easily be translated to xterm sequences.  I used syscons
> F and G sequences to print bright colors with sc and vt since pure xterm
> bright colors are too broken to display themselves without bold hacks.
> The F and G sequences generate bold hacks in the kernel, and further
> complications are needed to turn these off to test if bright colors
> are fixed.  Real xterm doesn't fake bold using brightness, so bold
> hacks on dark characters don't work for it.
>
> The first one needs the user to load a cp437 font for syscons and a
> unicode font for vt.  The script doesn't load a font since it is too
> hard to restore or reset fonts.  Similarly for colors.
>
> Run the first one on a kernel without this commit to see the old color
> map.  It looked just wrong (unstructured) before I found a good
> tabular format to print it.  I then wrote "improved" maps based on
> expanding the 2x2x2 and 3x3x3 maps.  These were too simple.  Some of
> the comments/printfs are out of date and still refer to this expansion.

If I'm not wrong, these scripts where made on OS X. They use \r\n line endings,
and this triggers random cryptic runtime errors:

op at opn /tmp> sh -x sc-vt-CSI
+ printf $'\\033[m\r'
+ printf $'\\033[x\r'
sc-vt-CSI: 5: Syntax error: word unexpected

The simple fix is to delete the '\r's from the scripts:

cat sc-vt-CSI | tr -d '\r' > trans.sh

op
>
> Bruce


More information about the svn-src-all mailing list