From b536209dfb7bd50c37061735fe10d2c19a97d26d Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Thu, 29 May 2008 15:11:38 -0700 Subject: Move files out of root into core, dos, and utils Move source files out of the root directory; the root is a mess and has become virtually unmaintainable. The Syslinux core now lives in core/; the Linux and generic utilities has moved into utils/, and copybs.com has moved into dos/; it had to go somewhere, and it seemed as good a place as any. --- utils/syslinux2ansi | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100755 utils/syslinux2ansi (limited to 'utils/syslinux2ansi') diff --git a/utils/syslinux2ansi b/utils/syslinux2ansi new file mode 100755 index 00000000..085f6c97 --- /dev/null +++ b/utils/syslinux2ansi @@ -0,0 +1,53 @@ +#!/usr/bin/perl +# +# Perl script to convert a Syslinux-format screen to PC-ANSI +# to display in a color xterm or on the Linux console +# + +@ansicol = (0,4,2,6,1,5,3,7); + +$getting_file = 0; +$enable = 1; + +while ( read(STDIN, $ch, 1) > 0 ) { + if ( $ch eq "\x1A" ) { # EOF + last; + } elsif ( $ch eq "\x0C" ) { # Clear screen + print "\x1b[2J" if ( $enable && !$getting_file ); + } elsif ( $ch eq "\x0F" ) { # Attribute change + if ( !$getting_file ) { + if ( read(STDIN, $attr, 2) == 2 ) { + $attr = hex $attr; + if ( $enable ) { + print "\x1b[0;"; + if ( $attr & 0x80 ) { + print "5;"; + $attr &= ~0x80; + } + if ( $attr & 0x08 ) { + print "1;"; + $attr &= ~0x08; + } + printf "%d;%dm", + $ansicol[$attr >> 4] + 40, $ansicol[$attr & 7] + 30; + } + } + } + } elsif ( $ch eq "\x18" ) { # Display image + # We can't display an image; pretend to be a text screen + # Ignore all input until end of line + $getting_file = 1; + } elsif ( (ord($ch) & ~07) == 0x10 ) { # Mode controls + $enable = (ord($ch) & 0x01); # Emulate the text screen + } elsif ( $ch eq "\x0D" ) { # Carriage return + # Ignore + } elsif ( $ch eq "\x0A" ) { # Line feed + if ( $getting_file ) { + $getting_file = 0; + } else { + print $ch if ( $enable ); + } + } else { + print $ch if ( $enable && !$getting_file ); + } +} -- cgit v1.2.1