Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
#######
#
# E-scripts on vcs, terminal emulation, etc.
#
# Note 1: use the eev command (defined in eev.el) and the
# ee alias (in my .zshrc) to execute parts of this file.
# Executing this file as a whole makes no sense.
# An introduction to eev can be found here:
#
#   (find-eev-quick-intro)
#   http://angg.twu.net/eev-intros/find-eev-quick-intro.html
#
# Note 2: be VERY careful and make sure you understand what
# you're doing.
#
# Note 3: If you use a shell other than zsh things like |&
# and the for loops may not work.
#
# Note 4: I always run as root.
#
# Note 5: some parts are too old and don't work anymore. Some
# never worked.
#
# Note 6: the definitions for the find-xxxfile commands are on my
# .emacs.
#
# Note 7: if you see a strange command check my .zshrc -- it may
# be defined there as a function or an alias.
#
# Note 8: the sections without dates are always older than the
# sections with dates.
#
# This file is at <http://angg.twu.net/e/console.e>
#           or at <http://angg.twu.net/e/console.e.html>.
#        See also <http://angg.twu.net/emacs.html>,
#                 <http://angg.twu.net/.emacs[.html]>,
#                 <http://angg.twu.net/.zshrc[.html]>,
#                 <http://angg.twu.net/escripts.html>,
#             and <http://angg.twu.net/>.
#
#######




Etc:
# «.setbell»		(to "setbell")
# «.less»		(to "less")
# «.screen»		(to "screen")
# «.screen_demo_eeg2»	(to "screen_demo_eeg2")
# «.screen-src»		(to "screen-src")
# «.screen-src-gdbk»	(to "screen-src-gdbk")
# «.console-tools-src»	(to "console-tools-src")
# «.svgatextmode»	(to "svgatextmode")
# «.svgatextmode0»	(to "svgatextmode0")
# «.avoiding_tty_reset»	(to "avoiding_tty_reset")
# «.framebuffer»	(to "framebuffer")
# «.fbset»		(to "fbset")
# «.toggle_meta»	(to "toggle_meta")
# «.ncurses-src»	(to "ncurses-src")
# «.ncurses_demos»	(to "ncurses_demos")
# «.ncurses_1»		(to "ncurses_1")
# «.key_charseq»	(to "key_charseq")

Keyboard:
# «.kbrequest_who»	(to "kbrequest_who")
# «.kbrequest-innards»	(to "kbrequest-innards")
# «.kbdrate_measuring»	(to "kbdrate_measuring")
# «.kbdrate_setting»	(to "kbdrate_setting")
# «.reduce_my_keymap»	(to "reduce_my_keymap")
# «.abnt2-keymap»	(to "abnt2-keymap")

Console fonts:
# «.console512»		(to "console512")
# «.chars256to511»	(to "chars256to511")
# «.vgafont_via_outbs»	(to "vgafont_via_outbs")
# «.glyphs512»		(to "glyphs512")
# «.RH_consolechar_bug»	(to "RH_consolechar_bug")
# «.hardware-fonts»	(to "hardware-fonts")

# «.vt-palette»		(to "vt-palette")
# «.ttyname»		(to "ttyname")
# «.non-utf-8»		(to "non-utf-8")
# «.default-keymap»	(to "default-keymap")
# «.vtutil4»		(to "vtutil4")

# «.terminfo»		(to "terminfo")
# «.tput»		(to "tput")
# «.ansi.lua»		(to "ansi.lua")
# «.TERM»		(to "TERM")
# «.xon-xoff»		(to "xon-xoff")
# «.ansi-color-apply»	(to "ansi-color-apply")




#####
#
# Setting the bell duration and frequency
# 2000nov22
#
#####

# «setbell»  (to ".setbell")
# Note to greppers: beep -> setbell.
# (find-man "4 console_codes" "frequency")
# (find-zshnode "Shell Builtin Commands" "\necho")
# (find-node "(bash)Bash Builtins" "`echo'")
# (find-kfile "drivers/char/console.c" "default bell parameters: 750HZ, 1/8th of a second")
# (find-k26file "drivers/char/vt.c" "default bell parameters: 750HZ, 1/8th of a second")

#*
# (find-angg ".zshrc.local.mcgill" "setbell")
function setbell () {
  echo -ne "\033[10;$1]\033[11;$2]"
}
sleep 1; echo -e '\a'
setbell 600 200
sleep 1; echo -e '\a'
setbell 22 40
sleep 1; echo -e '\a'
# Default:
setbell 750 125
sleep 1; echo -e '\a'
#*





#####
#
# less
# 2000jun22
#
#####

# «less»  (to ".less")

# (find-angg ".zshrc" "less")
# (find-man "less" "--RAW-CONTROL-CHARS")
# (find-man "less" "LESSCHARDEF")

# ascii     8bcccbcc18b95.b
# dos       8bcccbcc12bc5b95.b.
# ebcdic    5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b
#           9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b.
# iso8859   8bcccbcc18b95.33b.
# koi8-r    8bcccbcc18b95.b128.
# latin1    8bcccbcc18b95.33b.
# next      8bcccbcc18b95.bb125.bb

perl -e '
  for ($i = 0; $i <= 255; $i++) {
    printf "%d: %c\n", $i, $i
  }
' > /tmp/chars

# Display all chars except CSI and the obvious control chars:
LESSCHARDEF=8bcccbcc18b95.b27.b99.b \
  less -f /tmp/chars


# (find-angg ".zshrc" "less")

# Linux VTs are slow at backward scrolling; use -C.
# (eeman "less" "-C")
# (eeman "less" "-c")

# Give nice prompts at the last line:
# (eeman "less" "-M")





#####
#
# The scripts about Screen were moved to screen.e.
#
#####

# «screen»            (to ".screen")
# «screen_demo_eeg2»  (to ".screen_demo_eeg2")
# «screen-src»        (to ".screen-src")
# «screen-src-gdbk»   (to ".screen-src-gdbk")

# (find-es "screen" "screen")
# (find-es "screen" "screen_demo_eeg2")
# (find-es "screen" "screen-src")
# (find-es "screen" "screen-src-gdbk")





#####
#
# console-tools source (for 512-chars fonts)
#
#####

# «console-tools-src»  (to ".console-tools-src")
pdsc /big/slinks2/dists/slink/main/source/utils/console-tools_1998.08.11-3.dsc
cd /usr/src/console-tools-1998.08.11/

# (code-c-d "ct" "/usr/src/console-tools-1998.08.11/")
# (find-ctfile "")
# (find-ctfile "screenfonttools/showcfont.c")
# (find-ctfile "screenfonttools/consolechars.c")
# (find-ctfile "NEWS")

# (find-fline "/usr/include/linux/kd.h" "PIO_FONTX")
# (find-k2file "drivers/char/vt.c" "PIO_FONTX")

kglimpse kd.h





#####
#
# svgatextmode
# 2000jul24
#
#####

# «svgatextmode»  (to ".svgatextmode")
# (find-status "svgatextmode")
# (find-vldifile "svgatextmode.list")
# (find-vldifile "" "svgatextmode.list")
# (find-vldifile "svgatextmode.preinst")
# (find-vldifile "svgatextmode.postinst")
# (find-vldifile "svgatextmode.prerm")
# (find-vldifile "svgatextmode.postrm")
# (find-fline "/usr/doc/svgatextmode/")
# (find-fline "/usr/doc/svgatextmode/PROBLEMS_QuickStart")
# (eeman "SVGATextMode")

# (find-fline "/etc/init.d/svgatextmode")
# (find-fline "/etc/TextConfig")

# Use one of the two commands/pipelines below to create a new TextConfig...
# (find-fline "~/replace/TextConfig.sis6326-angg")
#
cp -v /etc/TextConfig ~/replace/TextConfig.sis6326-angg
cat   /etc/TextConfig \
  | egrep -v '^[ 	]*(#|$)' \
  | tee ~/replace/TextConfig.sis6326-angg

SVGATextMode
SVGATextMode -t ~/replace/TextConfig.sis6326-angg
# (find-fline "~/replace/TextConfig.sis6326-angg" "SiS")

# Modes grabbed with grabmode at angg with a SiS6326, 2000jul24:
#
#"132x44"   39.985   1056 1104 1280 1312   396 404 406 436   -Hsync +Vsync  font 8x9   # 30.476kHz/69.90Hz
#"132x49"   39.985   1056 1104 1280 1312   392 404 406 436   -Hsync +Vsync  font 8x8   # 30.476kHz/69.90Hz

SVGATextMode -t ~/replace/TextConfig.sis6326-angg -f sis132x44





######
#
# svgatextmode (and kbrequest)
# 99aug31
#
######

# «svgatextmode0»  (to ".svgatextmode0")
# (find-man "5 inittab" "kbrequest")
# (find-es "k22" "sysrq")
# (find-fline "~/bin/mystm")

apti svgatextmode
cd /etc/rc2.d/
mv -v S40svgatextmode _S40svgatextmode
cd /etc/rc3.d/
mv -v S40svgatextmode _S40svgatextmode

cd /etc/rcS.d/
mv -v S60svgatextmode _S60svgatextmode

# (find-vldifile "svgatextmode.list")
# (find-fline "/usr/doc/svgatextmode/")
# (find-fline "/usr/doc/svgatextmode/FAQ.gz" 850)
# (find-fline "/etc/TextConfig")
# (eeman "SVGATextMode")

egrep -v '^[ 	]*(#|$)' /etc/TextConfig
SVGATextMode -s | egrep '^[0-9]' | sort | l

# This is to make a local TextConfig file:
# (find-fline "~/replace/TextConfig.angg")

(cat <<'---'
# (find-es "console" "svgatextmode")
ChipSet "S3"
ClockChip "S3Virge"
DefaultMode "80x50x9"
---
grep '^"' /etc/TextConfig) \
  > ~/replace/TextConfig.angg

# Testing it:

SVGATextMode -t ~/replace/TextConfig.angg

# To call it on "kbrequest"s:
# (find-fline "/home/root/bin/kbrequest")
# (find-fline "/etc/inittab" "kbrequest")

# svgatextmode is a big package, but we need very little from it; only
# /sbin/SVGATextMode, if we don't care about grabmode, /etc/TextConfig
# or docs.
#
strace -f -o ~/s \
  SVGATextMode -t ~/replace/TextConfig.angg
getstrings < ~/s

# (find-fline "~/replace/TextConfig.angg")
SVGATextMode -t ~/replace/TextConfig.angg 132x50x8
SVGATextMode -t ~/replace/TextConfig.angg 160x60
SVGATextMode -t ~/replace/TextConfig.angg 160x60x9

# 160 cols: dangerous?











#####
#
# What process gets the kbrequest?
#
#####

# «kbrequest_who»  (to ".kbrequest_who")
# (find-fline "/etc/inittab" "kbrequest")
# (find-fline "/home/root/bin/kbrequest")
# (find-man "5 inittab" "kbrequest")

# (find-vldifile "sysvinit.list")
# (find-fline "/usr/doc/sysvinit/")

pdsc /big/slinks1/dists/slink/main/source/base/sysvinit_2.76-3.dsc
cd /usr/src/sysvinit-2.76/

# (find-fline "/usr/src/sysvinit-2.76/src/init.c" "kbrequest")
# (find-fline "/usr/src/sysvinit-2.76/src/init.c" "Tell kbrequest")
# (find-fline "/usr/src/sysvinit-2.76/src/init.c" "!= KBREQUEST")

SVGATextMode 80x50x8

pdsc /big/slinks1/dists/slink/main/source/base/kbd_0.96a-14.dsc
cd /usr/src/kbd-0.96a/
agrep -i spawn $(find *)




#####
#
# kbrequest - how it works
# 2005oct17
#
#####

# «kbrequest-innards»  (to ".kbrequest-innards")
# (find-fline "/etc/inittab" ":ctrlaltdel:")
# (find-fline "/etc/inittab" "kbrequest")
# (find-man "5 inittab" "ctrlaltdel")
# (find-man "5 inittab" "kbrequest")

# (eek "M-h M-d sysvinit")
# http://www.piterpunk.hpg.ig.com.br/dicas.html#23
# http://lists.debian.org/debian-user/1998/09/msg02246.html
# http://ftp.debian.org/debian/pool/main/s/sysvinit/sysvinit_2.86.ds1-4.dsc
# http://ftp.debian.org/debian/pool/main/s/sysvinit/sysvinit_2.86.ds1-4.diff.gz
# http://ftp.debian.org/debian/pool/main/s/sysvinit/sysvinit_2.86.ds1.orig.tar.gz
#*
rm -Rv ~/usrc/sysvinit-2.86.ds1/
mkdir  ~/usrc/sysvinit-2.86.ds1/
cd     ~/usrc/
dpkg-source -x \
  $S/http/ftp.debian.org/debian/pool/main/s/sysvinit/sysvinit_2.86.ds1-4.dsc
rm -v sysvinit_2.86.ds1.orig.tar.gz
cd     ~/usrc/sysvinit-2.86.ds1/

#*
# (code-c-d "sysvinit" "~/usrc/sysvinit-2.86.ds1/")
# (find-sysvinitfile "")
# (find-sysvinitsh   "grep -i kbrequest $(find *)")
# (find-sysvinitfile "src/init.c" "kbrequest")
# (find-sysvinitfile "src/init.h" "#define KBREQUEST")

# (find-sh "dumpkeys" "Boot")
# (find-sh "dumpkeys" "KP_Period" "Boot")
# (find-sh "dumpkeys" "Remove"    "Boot")
# (find-sh "dumpkeys" "KeyboardSignal")

# (find-sysvinitfile "src/init.c" "We got signaled.")
# (find-sysvinitfile "src/init.c" "got SIGINT"   "ctrlaltdel entry")
# (find-sysvinitfile "src/init.c" "got SIGWINCH" "kbrequest entry")

# (find-fline "/usr/include/linux/keyboard.h")
# (find-fline "/usr/include/linux/keyboard.h" "#define K_BOOT")

# (find-k26file "drivers/char/keyboard.c")
# (find-k26file "drivers/char/keyboard.c" "ctrl_alt_del()")
# (find-k26file "drivers/char/keyboard.c" "fn_boot_it,")
# (find-k26file "drivers/char/console_macros.h")





#####
#
# kbd repeat rate and delay: measuring
# 2000apr10
#
#####

# «kbdrate_measuring»  (to ".kbdrate_measuring")
# (find-es "expect" "expect_bugs_potato")

expect -c '
  while 1 {
    set usecs [lindex [time {expect -re .}] 0]
    set msecs [expr $usecs/1000.0]
    send_user "$msecs "
  }
'




#####
#
# kbd repeat rate and delay: setting (low level)
# 2000apr09
#
#####

# «kbdrate_setting»  (to ".kbdrate_setting")

pdsc $SDEBIAN/dists/potato/main/source/base/util-linux_2.10f-3.dsc
cd /usr/src/util-linux-2.10f/
debian/rules binary	|& tee odrb

# (code-c-d "ul" "/usr/src/util-linux-2.10f/")
# (find-ulfile "")
# (find-ulfile "debian/rules")
# (find-ulfile "odrb")
# (find-ulfile "odrb" "kbdrate")
# (find-ulfile "Makefile")
# (find-ulfile "kbd/")
# (find-ulfile "kbd/kbdrate.c")


pdsc $SDEBIAN/dists/potato/main/source/base/util-linux_2.10f-3.dsc
cd /usr/src/util-linux-2.10f/
./configure	|& tee oc
cd /usr/src/util-linux-2.10f/kbd/
cc -c -pipe -m486 -fomit-frame-pointer -I. -I../lib -Wall \
  -DNCH=1   -DSBINDIR=\"/sbin\" -DUSRSBINDIR=\"/usr/sbin\" \
  -DLOGDIR=\"/var/log\" -DVARPATH=\"/var\" \
  -DLOCALEDIR=\"/usr/share/locale\" \
  -g kbdrate.c -o kbdrate.o
cc kbdrate.o   -o kbdrate

# gdb jumps source lines with -O2, let's try without optimization
# Urgh, the "print"s are showing wrong values. Bug
# (gdb "gdb /usr/src/util-linux-2.10f/kbd/kbdrate")
#*
br main
set args -r 30.0 -d 250
run
#*


# (find-fline "~/MTA/vtutilsh.c" "_setkbdrepeat")
# Why the "sleep(1)"?
# Maybe because it's harder to program sub-second delays.
# I changed it to 100ms, that seems more than enough.
# (find-fline "~/MTA/vtutilsh.c" "Tcl_Sleep")
# (find-fline "~/.zshrc" "setkbdrepeat")

cd ~/MTA/
make
./vtutil setkbdrepeat 0 100

cd ~/MTA/
./vtutil setkbdrepeat 128 1000

cd ~/MTA/
./vtutil setkbdrepeat 127 1000

kbdrate -r 30.0 -d 250

# (find-es "forth" "pforth-custom0")

# (find-k22file "arch/i386/boot/setup.S" "keyboard repeat rate")
# (find-fline "/usr/src/util-linux-2.10f/kbd/kbdrate.c" "valid_rates[]")
# (find-k22file "drivers/char/keyboard.c")
# (find-k22file "drivers/char/pc_keyb.c")





#####
#
# Reducing my keymaps by using includes
# 2001feb01
#
#####

# «reduce_my_keymap»  (to ".reduce_my_keymap")
# (find-fline "/usr/share/keymaps/i386/qwerty/")
#*
rm -Rv /tmp/keymaps/
mkdir  /tmp/keymaps/
cp -v /usr/share/keymaps/i386/qwerty/defkeymap* /tmp/keymaps/
cd /tmp/keymaps/
gzip -dv *

#*
cd /tmp/keymaps/
# tkdiff -b defkeymap.kmap ~/MTA/defkeymap850b.map
diff -b defkeymap.kmap ~/MTA/defkeymap850b.map \
  | grep -v 'compose' | grep '^>' \
  | tee ~/o

#	shift	alt	keycode  12 = Meta_underscore
#	shift	alt	keycode  13 = Meta_plus
#	shift	alt	keycode  39 = Meta_colon
#	control keycode  51 = Control_q
#	shift control alt keycode 59 = Console_13
#	shift alt keycode 59 = Console_13
#	shift control alt keycode 60 = Console_14
#	shift alt keycode 60 = Console_14
#	alt	keycode 103 = Spawn_Console

#*
cd /tmp/keymaps/
cat defkeymap.kmap | grep ^keycode | grep -v '= *$'

#*





#####
#
# libggi
# 2000jul24
#
#####

# (find-fline "/usr/doc/svgatextmode/No_more_display_corruption")

grep-status -P ggi | tee ~/o
# (find-fline "~/o")

xserver-ggi
libggi-samples
libggi-target-aa
libggi-target-fbdev
libggi-target-svgalib
libggi-target-vcsa
libggi-target-x
libggi2
libggidemos
libgii0





#####
#
# Avoiding a terminal reset on vtutil's "open /dev/tty"
# 00jan28
#
#####

# «avoiding_tty_reset»  (to ".avoiding_tty_reset")
# (find-fline "~/MTA/vtutil" "file0")

# loadkeys and setfont issue ioctls to the terminal:

dmissing loadkeys
dmissing setfont

# (find-vldifile "kbd.list")
# (find-fline "/usr/doc/kbd/")
# (find-vldifile "console-tools.list")
# (find-fline "/usr/doc/console-tools/")
# (find-vldifile "kbd-compat.list")
# (find-fline "/usr/doc/kbd-compat/")

slinksgrep kbd
slinksgrep console-tools
slinksgrep kbd-compat

pdsc /big/slinks1/dists/slink/main/source/base/kbd_0.96a-14.dsc

# (code-c-d "kbd" "/usr/src/kbd-0.96a/")
# (find-kbdfile "")
# (find-kbdfile "src/")


# (find-kbdfile "consolefonts/" "cp850")

# (find-fline "/big/slinks1/dists/slink/main/source/base/kbd_0.96a-14.diff.gz")





#####
#
# framebuffer
# 2000may07
#
#####

# «framebuffer»  (to ".framebuffer")

# Note: I gave up using framebuffers very soon and I haven't even
# learned how to choose vts of fbs at boot time (much less after
# booting).

cd /big/potato/
find * | grep fb

Pgrepp m/libggi/ |& l
apti xserver-fbdev fbset

# (find-vldifile "xserver-fbdev.list")
# (find-fline "/usr/share/doc/xserver-fbdev/")
# (find-fline "/usr/share/doc/xserver-fbdev/README.Debian")
# (eeman "1 openvt")
# (eeman "8 fbset")

# (find-vldifile "fbset.list")
# (find-fline "/usr/doc/fbset/")
# (eeman "5 fb.modes")
# (eeman "8 modeline2fb")
# (eeman "8 fbset")
# (eeman "8 con2fbmap")

# (find-vldifile "lg-issue36.list")
# (find-fline "/usr/doc/lg-issue36/")
# (find-fline "/usr/share/doc/lg/issue36/ayers.html")

lynx /usr/share/doc/lg/issue36/ayers.html

# (find-k22file "drivers/video/")
# (find-k22file "Documentation/fb/")
# (find-k22file "Documentation/fb/vesafb.txt")
# (find-k22file "Documentation/fb/vesafb.txt" "hex values")
# (find-k22file "Documentation/Configure.help" "CONFIG_FB\n")

# It seems that that CONFIG_FB is only offered at the kernel config
# when we ask for the alpha drivers...

# (find-k22file ".config" "CONFIG_FB")
# (find-vldifile "lilo.list")
# (find-fline "/usr/doc/lilo/")

# But the prompts given by "vga=ask" aren't giving me any choices of
# graphic modes. What am I doing wrong?

# (find-k22file "arch/i386/boot/video.S" "Scan for video modes")


# (find-htetfile "Framebuffer-HOWTO.txt.gz")
# (find-htetfile "Framebuffer-HOWTO.txt.gz" "  4.1.")
# (find-htetfile "Framebuffer-HOWTO.txt.gz" "s.\n\n  17.")
# (find-htetfile "Framebuffer-HOWTO.txt.gz" "S3 Virge")
# (find-fline "$S/ftp/ccssu.crimea.ua/pub/linux/kernel/v2.2/unofficial/s3new.diff.gz")

lynx http://www.tahallah.demon.co.uk/programming/prog.html


# (find-vldifile "libggi-target-fbdev.list")
# (find-fline "/usr/doc/libggi-target-fbdev/")



#####
#
# fbset
# 2023mar04
#
#####

# «fbset»  (to ".fbset")
# (find-status   "fbset")
# (find-vldifile "fbset.list")
# (find-udfile   "fbset/")
# (find-fline "~/LOGS/2023mar04.emacs" "fbset -i")
# (find-fline "~/eev-videos/")

cd ~/eev-videos/
mpv --vo=fb 2021projeto-de-ensino.mp4

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
sudo dpkg-reconfigure console-setup

[vo] Video output fb note found!




#####
#
# Toggling the effect of "meta"
# 2000oct22
#
#####

# «toggle_meta»  (to ".toggle_meta")
#*
cd /usr/src/linux-2.2/drivers/char/
agrep -i meta *.[ch]
#*

# (find-k22file "drivers/char/console.c")
# (find-k22file "drivers/char/console_macros.h")
# (find-k22file "drivers/char/keyboard.c")
# (find-k22file "drivers/char/keyboard.c" "if (vc_kbd_mode(kbd, VC_META))")
# (find-k22file "drivers/char/vt.c" "case KDSKBMETA:")
# (eeman "4 console_ioctl" "KDGKBMETA")

# (eeman "xterm" "eightBitInput")
# (eeman "xvt" "-8")
# (eeman "rxvt" "meta")





#####
#
# understanding the ABNT2 keymap
# 2000nov08
#
#####

# «abnt2-keymap»  (to ".abnt2-keymap")
# (eeman "1 loadkeys")
# (eeman "5 keymaps")
# (eeman "5 keymaps" "strings as usual")
# (eeman "5 keymaps" "compose as usual for")
#*
dumpkeys --long-info | tee ~/o
#*
# (find-fline "~/o")
# (find-fline "~/o" "dead_tilde")

# (find-fline "/usr/share/keymaps/i386/")
# (find-fline "/usr/share/keymaps/i386/qwerty/br-abnt2.kmap.gz")
# (find-fline "/usr/share/keymaps/i386/include/")
# (find-fline "/usr/share/keymaps/i386/include/qwerty-layout.inc.gz")
# (find-fline "/usr/share/keymaps/i386/include/linux-with-alt-and-altgr.inc.gz")








#####
#
# console (512 chars fonts)
#
#####

# «console512»  (to ".console512")
apti console-tools console-tools-libs

# (find-status   "console-tools")
# (find-vldifile "console-tools.list")
# (find-udfile   "console-tools/")

# (find-status "console-tools-libs")
# (find-vldifile "console-tools-libs.list")
# (find-fline "/usr/doc/console-tools-libs/")

# (find-fline "/usr/doc/console-tools-libs/file-formats/")
# (find-fline "/usr/doc/console-tools-libs/examples/unicode/")

cd /usr/doc/console-tools-libs/examples/unicode/
unicode_start
zcat utflist.cp437.gz | l -r
unicode_stop



# (find-vldifile "kbd-data.list")
# (find-fline "/usr/doc/kbd-data/")
# (find-fline "/usr/share/consolefonts/")

cd /tmp/
cp -v /usr/share/consolefonts/{cp,def}* .
gzip -dv *.gz
consolechars -f cp850-8x8
# can't


/usr/share/consolefonts/


apti kbd kbd-data
# (find-fline "/usr/doc/kbd/")
# (find-fline "/usr/doc/kbd-data/")
# (find-fline "/usr/doc/kbd-data/console.docs.gz")
# (find-vldifile "kbd.list")
# (find-vldifile "kbd-data.list")


cd /usr/doc/console-tools-libs/examples/unicode/
setfont
setfont -u def.uni
echo -e '\033%8'
ls -N
echo -e '\033%@'




strace-to ~/s consolechars -H 8 -f ~/replace/ega1.8
strace-to ~/s consolechars -H 8 -f cp850-8x8

strace-to ~/s consolechars -H 8 -f ~/replace/ega1.8
strace-to ~/s consolechars -H 8 -f cp850-8x8


apti console-tools console-tools-libs

cd /tmp/
cp -v /usr/share/consolefonts/Goha* .
gzip -dv *.gz
consolechars -f Goha-16
showcfont

consolechars -f Goha-12
showcfont

i=50; while [[ $i -ge 1 ]]; do echo $i; i=$[$i-1]; done

apti kbd




#####
#
# How do I generate chars on the range 256..511?
#
#####

# «chars256to511»  (to ".chars256to511")

# showcfont only works right if the output is a terminal, so we use
# expect to capture the output from it.
expect -c '
  spawn showcfont
  match_max 6000
  expect -n eof
  set channel [open "~/o512" w]
  puts -nonewline $channel $expect_out(buffer)
  close $channel
'
l -fr ~/o512
# (find-fline "~/o512")
# (hexl-find-file "~/o512")


# Trick: ef 80..87 80..bf
proc vtchar {n} {
  format "%c%c%c" 239 [expr "(($n & (511 & -63)) / 64) + 128"] \
    [expr "($n & 63) + 128"]
}
puts "\033%G[vtchar 64]\033%@"

/usr/share/consolefonts/Goha-14.psf.gz
/usr/share/consolefonts/Goha-16.psf.gz
/usr/share/consolefonts/GohaClassic-12.psf.gz
/usr/share/consolefonts/GohaClassic-14.psf.gz
/usr/share/consolefonts/GohaClassic-16.psf.gz

# (find-slink "console-tools")
# (find-slink "console-tools-data")
# (find-slink "kbd")

man chvt
man deallocvt
man fgconsole
man kbd_mode
man psfaddtable
man psfgettable
man setleds
man setmetamode
man showkey
man unicode_start
man unicode_stop
man vt-is-UTF8
man showcfont
man charset
man codepage
man fix_bs_and_del
man mk_modmap
man screendump
man dumpkeys
man loadkeys
man psfstriptable

cd /tmp/
psfgettable Goha-12*





#####
#
# Changing the VGA font via "outb"s
# 2000oct22
#
#####

# «vgafont_via_outbs»  (to ".vgafont_via_outbs")
#*
cd /usr/src/linux-2.2/drivers/char/
agrep -i font *.[ch]	|& l -S
#*
cd /usr/src/linux-2.2/drivers/video/
agrep -i font *.[ch]	|& l -S
#*

# (find-k22file "drivers/video/vgacon.c")
# (find-k22file "drivers/video/vgacon.c" " * PIO_FONT support.")
# (find-k22file "drivers/video/Makefile" "vgacon")
# (find-k22file "Documentation/Configure.help" "CONFIG_VGA_CONSOLE")
# (find-fline "~/k22conf" "CONFIG_VGA_CONSOLE")

# (find-k22file "drivers/char/console.c" "con_font_op")




#####
#
# 512 char fonts in emacs
#
#####

# «glyphs512»  (to ".glyphs512")

; (find-man "4 console_codes" "ESC % @")
; (find-man "4 console_codes" "ESC % G")
; (find-man "7 charsets" "1110xxxx")

; Nome errado; é utf8, não unichar (acho).
; Aliás, eu roubei essa encodificação do showcfont.

(defun unicharhi (n)
  (format "\e%%G\xef%c%c\e%%@"
	  (+ 128 (logand (lsh n -6) 7))
          (+ 128 (logand n 63))))
(defun setglyph (charn color fontpos)
  (let ((s (cond ((>= fontpos 255) (unicharhi fontpos))
		 ((< fontpos 32) (unicharhi fontpos))
		 (t (format "%c" fontpos)))))
    (if color (setq s (format "\e[%sm%s\e[m" color s)))
    (aset standard-display-table charn
	  (vector (create-glyph s)))))
(defun setglyphs (a b c &rest r)
  (setglyph a b c)
  (if r (apply 'setglyph r)))

% partial, "I; nabla, ??.
% (setglyphs ?Ï nil 277  ?¿ nil 278)

(setglyph 5 "1;44" 13)

(setglyph ?Ï nil 277)			; partial; "I
(setglyph ?¿ nil 278)			; nabla; ??

(ascstr 128 255)

# (find-fline "~/MTA/newtest.tcl" "set hchars")
# (find-es "console" "chars256to511")
# (find-node "(elisp)Bitwise Operations")
# (find-node "(elisp)Conditionals")

# (logand 511 -63)
# (logand (lsh n -4)

# Truque: ef 80..87 80..bf
proc vtchar {n} {
  format "%c%c%c" 239 [expr "(($n & (511 & -63)) / 64) + 128"] \
    [expr "($n & 63) + 128"]
}
puts "\033%G[vtchar 64]\033%@"

# (find-man "4 console")
# (find-man "4 console_ioctl")
# (find-man "4 console_ioctls")
# (find-man "4 console_codes")
# (find-man "4 console_codes" "ECMA-48 Set Graphics Rendition")

; Um problema: quando a gente vai pro X e volta a gente sempre perde a
; informação de que os vcs estavam em modo de 512 chars.

(ascstr 0 32)







#####
#
# ncurses source
# 2001may23
#
#####

# «ncurses-src»  (to ".ncurses-src")
dmissingp libncurses5-dbg
#*
pdsc $SDEBIAN/dists/potato/main/source/libs/ncurses_5.0-6.dsc
cd /usr/src/ncurses-5.0/
debian/rules binary	|& tee odrb
# (code-c-d "ncurs" "/usr/src/ncurses-5.0/")
# (code-c-d "ncursdoc" "/usr/doc/libncurses5-dev/")
# (find-ncursfile "")
# (find-ncursfile "odrb")
# (find-ncursfile "debian/libncurses5-dbg/usr/lib/")
# (find-ncursfile "README" "_g.a")
# (find-ncursfile "lib/")

#*






#####
#
# ncurses: running the demos
# 2000dec06
#
#####

# «ncurses_demos»  (to ".ncurses_demos")
grep-status -P curses | awk '/Package/ { print $2 }' | sort

# (find-status "libncurses5-dev")
# (find-vldifile "libncurses5-dev.list")
# (find-fline "/usr/doc/libncurses5-dev/")

#*
rm -Rv /tmp/curs5/
mkdir  /tmp/curs5/
cd /usr/share/doc/libncurses5-dev/
cp -diPpvR * /tmp/curs5/
cd /tmp/curs5/
mv examples/* .
rmdir examples
gzip -dv *.gz

# *
cd /tmp/curs5/
sh configure	|& tee oc
sed 's/@ \?echo [^;]\+; //' < Makefile > Makefile-v
make -f Makefile-v	|& tee om

for i in *.c; do gcc -I. -DHAVE_CONFIG_H -E $i > $(basename $i .c).E; done

find * -perm +111
# (find-fline "/tmp/curs5/")
# (find-fline "/tmp/curs5/Makefile")
# (find-fline "/tmp/curs5/Makefile-v")
# (find-fline "/tmp/curs5/om")
# (find-fline "/tmp/curs5/rain.c")
# (find-fline "/tmp/curs5/rain.E" "(wmove(")
#*

cd /tmp/curs5/
./blue
./bs
./cardfile
./ditto
./dots
./filter
./firework
./firstlast
./gdc
./hanoi
./hashtest
./keynames
./knight
./lrtest
./ncurses
./newdemo
./rain
./tclock
./testaddch
./testcurs
./testscanw
./view	view.c
./worm
./xmas

#*
# (gdbk-gdb t "/tmp/curs5/" "dots" t)
show env TERM
set env TERM linux
# tbr main
tbr dots.c:107
run
#*

# (find-status "libncurses5")
# (find-vldifile "libncurses5.list")
# (find-fline "/usr/doc/libncurses5/")

# (find-status "ncurses-base")
# (find-status "ncurses-bin")
# (find-status "ncurses-term")
# (find-vldifile "ncurses-base.list")
# (find-vldifile "ncurses-bin.list")
# (find-vldifile "ncurses-term.list")




#####
#
# ncurses: first programs
# 2000dec07
#
#####

# «ncurses_1»  (to ".ncurses_1")
# (find-htetfile "NCURSES-Programming-HOWTO.gz")
# (eeman "3ncurses waddch")
# (eeman "3ncurses waddnstr")
# (eeman "3ncurses wmove")
# (eeman "3ncurses refresh")

# (find-fline "/tmp/curs5/blue.c")
# (find-fline "/tmp/curs5/blue.c" "    PC_COLORS")
# (find-fline "/usr/include/ncurses.h" "#define A_ALTCHARSET")

# (find-ncursdocfile "ncurses-intro.doc.gz")
# (find-ncursdocfile "ncurses-intro.doc.gz" "   initscr()")
# (find-ncursdocfile "ncurses-intro.doc.gz" "  Tuning for Speed")
# (find-ncursdocfile "ncurses-intro.doc.gz" "ACS_")
# (find-fline "/usr/include/curses.h")
# (find-fline "/usr/include/ncurses.h")
#*
cd /tmp/curs5/
l +/refresh $(agrep -l refresh *.c)

#*
# (eev-bounded)
cd /tmp/
cat > test.c <<'---'
#include <curses.h>
#include <stdio.h>
main(int argc, char **argv) {
  int i, j, c, color;
  initscr();
  for(i=0; i<16; ++i) {
    for(j=0; j<16; ++j) {
      c=i*16+j;
      mvaddch(i+2, j+8, c | A_ALTCHARSET );
    }
  }
  if (argv[1][0]&1) refresh();
  if (argv[1][0]&2) fflush(stdout);
  endwin();
}
---
gcc -lcurses -g -o test test.c
# strace -o ~/s ./test 0
read; ./test 0
read; ./test 1
read; ./test 2
read; ./test 3
#*




# (find-status   "libncurses5-dev")
# (find-vldifile "libncurses5-dev.list")
# (find-udfile   "libncurses5-dev/")
#*
links /usr/share/doc/libncurses5-dev/html/index.html
#*



#####
#
# keys as char sequences
# 2001may26
#
#####

# «key_charseq»  (to ".key_charseq")
# (find-fline "/etc/")
# (code-c-d "termcap" "" "/usr/src/bash-2.04/lib/termcap/grot/termcap")
# (find-termcapnode "")
# (find-man "5 terminfo" "These are the string capabilities:")
# (find-man "5 terminfo" "key_")
# (find-termcapnode "Interrogate" "`tgetstr'")
# (find-termcapnode "Capabilities" "keypad")
# (find-termcapnode "Keypad")
# (find-ncursdocfile "")
# (find-ncursdocfile "ncurses-intro.doc.gz")

How do I get the sequence of characters corresponding to a key in a
given terminal? For example, in "man 5 terminfo" there's a line in a
table saying "key_down kcud1 kd   down-arrow key", but 

# (eeman "5 terminfo" "key_")
# (eeman "1 tput")

tput kcud1 | hexdump -c
ltrace tput kcud1

# (to "ncurses_demos")
# (find-fline "/tmp/curs5/")
# (find-fline "/tmp/curs5/om" "keynames")

#*
rm -Rv /tmp/keynames/
mkdir  /tmp/keynames/
cd /usr/doc/libncurses5-dev/examples/
cp -v test.priv.h keynames.c /tmp/keynames/
cd /tmp/keynames/
gcc -o keynames -I. -lcurses -g keynames.c
# (find-fline "/tmp/keynames/")

#*
cd /tmp/keynames/
# (eeman "tgetstr")

cat > tgetstr.c <<'---'
#include <curses.h>
#include <term.h>
int main(int argc, char **argv) {
  char buffer[100], *p=buffer;
  printf("%s -> %s\n", argv[1], tgetstr(argv[1], &p));
  return 0;
}
---
gcc -o tgetstr -lncurses tgetstr.c
# gcc -o tgetstr -L/usr/src/ncurses-5.0/lib -lncurses_g -g tgetstr.c

./tgetstr kcud1
./tgetstr kd
./tgetstr key_down

#*
cd /tmp/keynames/
# Oops, impossible to link this against ncurses_g... it uses curses!
# (find-node "(gcc)Link Options" "`-L'")
# vfwstrace-to ~/s \
gcc -o keynames_g -I. -L/usr/src/ncurses-5.0/lib -lncurses_g -g keynames.c

#*
# (find-ncursfile "lib/")
# (find-fline "/usr/doc/libncurses5-dev/examples/")
# (find-fline "/tmp/curs5/")
# (find-fline "/tmp/curs5/om")




#####
#
# living with consolechar's bug in RedHat 6.1
# 2001feb06
#
#####

# «RH_consolechar_bug»  (to ".RH_consolechar_bug")

# The problem is that on the RH6.1's of my university "consolechars"
# (version 1999.03.02, kernel 2.2.12-20) does not adjust the number of
# lines of characters in the screen to compensate for fonts with
# smaller of taller chars; by stracing it I discovered that its main
# ioctl calls were:
#
# 2250  ioctl(4, KDGKBTYPE, 0xbfffdc17)   = 0
# 2250  ioctl(4, 0x4b72, 0xbfffdae0)      = 0
#
# Where 0x4B72 is KDFONTOP, which according to the changelog in
# console-tools is the "new way" of doing things; it is not mentioned
# in the console_ioctl{,s} manpages, though. Ugh.
#
# (find-fline "/usr/include/linux/")
# (find-fline "/usr/include/linux/kd.h" "KDFONTOP	0x4B72")
# (find-fline "/usr/doc/console-tools/changelog.gz")
# (eeman "console_ioctl")
# (eeman "console_ioctls")
#
# (find-k22file "drivers/char/vt.c" "case KDFONTOP:")
# (find-k22file "drivers/char/console.c" "\nint con_font_op")
# (find-k22file "include/linux/kd.h" "struct console_font_op {")
#
# What is even stranger is that on my Potato box consolechars works by
# using the same ioctls (maybe with different parameters), and it
# changes the number of screen lines correctly.
#
# I know that things used to work when I used PIO_FONTX, so I'll write
# a quick C program to use as a workaround...

# The program became an independent C file:
# (find-angg "MTA/pio_fontx.c")

# (find-angg "MTA/vtutilsh.c" "setfont")
# (find-node "(gcc)Macro Varargs")
# (find-node "(libc)Error Messages")
# (find-fline "/usr/doc/console-tools/file-formats/psf" "psf_header =")
# (find-fline "/usr/include/")

#*
cd ~/MTA/
rm -v pio_fontx pio_fontx.o
make pio_fontx psfs
#*
# (find-angg "TH/Files.tcl" "do_not_translate")
# (find-angg "MTA/Makefile" "psfs")
cd ~/MTA/
./pio_fontx ega1.16.psf
read
./pio_fontx math1.8.psf
#*




#####
#
# default hardware fonts
# 2004sep30
#
#####

# «hardware-fonts»  (to ".hardware-fonts")
# (find-angg "vtutil4/")
# (find-angg "vtutil4/piofontx.c")
# (find-man "4 console_ioctl" "  PIO_FONTRESET")
# (find-man "8 consolechars")

# Where's the code that deals with the "vga=1" in the kernel command line?
# Where's the vesa call?
# Are there hardware fonts in several sizes?





####
#
# vt palette
# 2004apr18
#
####

# «vt-palette»  (to ".vt-palette")
# (find-man "4 console_codes" "ESC ] P nrrggbb: set palette")
# (find-k24file "drivers/char/console.c" "palette escape sequence")
# (find-k24file "drivers/char/console.c" "reset palette")
# (find-k24file "drivers/char/console.c" "default_red")
# (find-vtutil4file "vtfontlib.lua" "vcsa_colors =")
# (find-man "4 console_codes" "set red foreground")

#*
function vtsetred       () { echo -ne '\033]P1'$1 }
function vtsetblue      () { echo -ne '\033]P4'$1 }
function vtresetpalette () { echo -ne '\033]R' }
function vtshowcolors   () {
echo -ne '
\033[0;30m black   \033[1;30m Black  
\033[0;31m red     \033[1;31m Red    
\033[0;32m green   \033[1;32m Green  
\033[0;33m brown   \033[1;33m Brown  
\033[0;34m blue    \033[1;34m Blue   
\033[0;35m magenta \033[1;35m Magenta    
\033[0;36m cyan    \033[1;36m Cyan  
\033[0;37m white   \033[1;37m White  
\033[0m'
}

#*
clear
vtshowcolors
# (find-k24file "drivers/char/console.c" "default_red")
# Try new intensities for red (VT color 1 - default aa0000)
read; echo -ne '\033]P1ff0000'
read; echo -ne '\033]P1ee0000'
read; echo -ne '\033]P1dd0000'
read; echo -ne '\033]P1cc0000'
read; echo -ne '\033]P1bb0000'
read; echo -ne '\033]R'


#*
clear
# (find-k24file "drivers/char/console.c" "default_blue")
# Try new intensities for blue (VT color 4 - default 0000aa)
vtshowcolors
read; echo -ne '\033]P40000ff'
read; echo -ne '\033]P41111ff'
read; echo -ne '\033]P42222ff'
read; echo -ne '\033]P40000ee'
read; echo -ne '\033]P40000dd'
read; echo -ne '\033]P40000cc'
read; echo -ne '\033]P40000bb'
read; echo -ne '\033]R'

#*
clear
vtshowcolors
read; echo -ne '\033]R';        # reset the palette
read; echo -ne '\033]P1ff0000'; # fix the red
read; echo -ne '\033]P42222ff'; # fix the blue
read; echo -ne '\033]Pc7777ff'; # fix the bright blue

#*




#####
#
# ttyname
# 2004oct02
#
#####

# «ttyname»  (to ".ttyname")
# (find-angg "bin/ttyname.c")
# (find-man "3 ttyname")
# (find-node "(libc)Is It a Terminal" "char * ttyname")
#*
eegcc <<<'int main() { printf("%s\n", ttyname(0)); return 0; }'
       eec
echo | eec
#*




#####
#
# Recent Debian VTs start in UTF-8 mode by default
# 2008apr06
#
#####

# «non-utf-8»  (to ".non-utf-8")
# (find-man "4 console_codes" "UTF-8 mode")
# (find-man "4 console_codes" "ESC % @" "Select default")
# (find-man "4 console_codes" "ESC % G" "Select UTF-8")
# (find-luamanualw3m "#2.1" "\\ddd")
#*
# Compare the two modes:
lua51 -e '
  pc = function (...)
      for i=1,#arg do
        if type(arg[i]) == "string" then printf("%s", arg[i]) end
        if type(arg[i]) == "number" then printf("%c", arg[i]) end
        if type(arg[i]) == "table"  then
	  for j=arg[i][1],arg[i][2] do pc(j) end
        end
      end
    end
  pc("Hello! ", 64, " foo", 10)
  pc("Default: ", 27, "%@", {160,254}, "\n")
  pc("UTF-8:   ", 27, "%G", {160,254}, "\n")
  -- for i=160,254 do pc(i) end
  pc("\nFoo!\n")
'
#*




####
#
# the default keymap in debian systems
# 2004apr15
#
####

# «default-keymap»  (to ".default-keymap")
# (find-progoutput "dpkg -l")

# (find-status "console-common")
# (find-vldifile "console-common.list")
# (find-vldifile "console-common.config")
# (find-fline "/usr/doc/console-common/")

dpkg-reconfigure console-common

# (find-vldifile "" "console-common.list")

# (find-fline "/usr/sbin/install-keymap")
# (find-man "8 install-keymap")
# (find-fline "/usr/share/console/getkmapchoice.pl")
# (find-fline "/usr/share/console/ps2-to-riscpc")
# (find-fline "/usr/share/console/lists/keymaps")
# (find-fline "/usr/share/doc/console-common/TODO")
# (find-fline "/usr/share/doc/console-common/copyright")
# (find-fline "/usr/share/doc/console-common/changelog.gz")
# (find-fline "/etc/console/")
# (find-fline "/etc/init.d/keymap.sh")

# (find-status "console-data")
# (find-vldifile "console-data.list")
# (find-fline "/usr/doc/console-data/")
# (find-status "console-tools")
# (find-vldifile "console-tools.list")
# (find-fline "/usr/doc/console-tools/")
console-tools-




#####
#
# vtutil4
# 2008nov04
#
#####

# «vtutil4»  (to ".vtutil4")
# (find-vtutil4 "")
# (find-vtutil4     "Makefile")
# (find-vtutil4file "Makefile" "ega1.8.pctoiso.modify.8")
# (find-vtutil4file "Makefile" "%.8.pctoiso.modify.8:")
# (find-vtutil4     "vtutil51.lua")
# (find-vtutil4     "vtfontlib.lua")
# (find-vtutil4file "vtfontlib.lua" "Modifyfont =")
# (find-vtutil4     "mathchars.lua")

# (find-tkdiff "~/vtutil4/ega1.8.pctoiso.modify.8.grid" "~/vtutil4/ega1.8.pctoiso.8.grid")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd ~/vtutil4/ && lua51 -e 'dofile "vtutil51.lua"' -i
= MIMAGES
PP(keys(MIMAGES))
PP(MIMAGES)
PP(mathcharstuff# (find-vtutil4     "mathchars.lua")



+--------+--------+--------+--------+--------+--------+
|o     o | oooooo |        |        |        |        |
|o     o |      o |  ooo   | o   o  |  ooo   |        |
| o   o  |      o | o      | o   o  | o   o  |   oo   |
| ooooo  |   oooo | oooo   | o   o  | o   o  |  o  o  |
|  o o   |      o | o      | o   o  | o   o  |  o  o  |
|  o o   |      o |  ooo   |  ooo   | o   o  |   oo   |
|   o    | oooooo |        |        |        |        |
|        |        |        |        |        |        |
+--------+--------+--------+--------+--------+--------+


# (find-vtutil4file "vtutil51.lua")




#####
#
# terminfo
# 2012feb11
#
#####

# «terminfo»  (to ".terminfo")
# (find-esgrep "grep -niH -e  terminfo *.e")
# (find-man "5 terminfo" "These are the string capabilities:")
# (find-man "5 terminfo" "cursor_invisible")
# (find-man "5 terminfo" "key_")
# (find-man "1 tic")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# (find-sh "infocmp xterm" "civis=")

# (find-fline "/lib/terminfo/x/xterm")


# (find-man "stty")




#####
#
# Tput
# 2012oct27
#
#####

# «tput» (to ".tput")
# (find-es "x" "xterm-colors")
# (find-angg "eev/video1.sh")
# http://en.wikipedia.org/wiki/Tput
# (find-man "1 tput")
# (find-man "5 terminfo")
# (find-man "5 terminfo" "setaf")
# (find-man "5 terminfo" "setab")
# (find-man "5 terminfo" "COLOR_BLACK")
# (find-man "5 terminfo" "bold")
# (find-man "xterm")

* (eepitch-ansiterm)
* (eepitch-kill)
* (eepitch-ansiterm)

RED=$(tput setaf 1)
BLACK=$(tput setaf 0)
echo "a $RED bc $BLACK de"
echo "a${RED}bc${BLACK}de"

# Normal and standout colors
NC=$(tput setaf 0; tput setab 7)
SC=$(tput setaf 3; tput setab 1)
echo "Hello ${SC}world${NC}!"
"

echo $(tput setaf 3; tput setab 1)Hello$(tput reset)
echo $(tput setaf 1)Hello$(tput setaf 0)


#####
#
# ansi.lua
# 2014mar06
#
#####

# «ansi.lua» (to ".ansi.lua")
# (find-man "1 less")
# (find-man "1 less" "-R or --RAW-CONTROL-CHARS" "ANSI")
# (find-man "4 console_codes" "ESC % @")
# (find-man "4 console_codes" "ECMA-48 Set Graphics Rendition")
# (find-man "4 console_codes" "ECMA-48 Set Graphics Rendition" "31")

#*
# (eev-bounded)
cat > /tmp/a.lua <<'%%%'
inp = io.read()
e = function (s) return "\27["..s.."m" end
A = {[""]=e"0", r=e"31"}
f = function (a)
    local b = a:sub(2,-2)
    local c = assert(A[b], "not found: "..a)
    return c
    -- return "\27["..c.."m"
  end
out = inp:gsub("({[!-~]-})", f)
print(out)
%%%

cat > /tmp/a.txt <<'%%%'
foo{r}bar{}poo
%%%

lua51 /tmp/a.lua < /tmp/a.txt |& l -R

#*
* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# (find-man "xterm")
xterm -bg black -fg white





#####
#
# TERM
# 2020may09
#
#####

# «TERM» (to ".TERM")
# https://github.com/mintty/mintty/issues/881
# https://www.facebook.com/notes/daniel-colascione/term-is-terminally-broken/10154219967001102/
# https://iterm2.com/misc/TerminalFeaturesCandidates1.pdf
# https://lists.gnu.org/archive/html/emacs-devel/2020-05/msg00958.html



#####
#
# XON/XOFF, i.e., C-s and C-q, and other C-keys
# 2024mar29
#
#####

# «xon-xoff»  (to ".xon-xoff")
# (find-man "1 xterm")
# (find-man "1 xterm" "\nSEE ALSO")
# (find-man "1 xterm" "control/D (used as an end of file in many shells)")
# (find-man "1 xterm" "XON / XOFF keys (control/S and" "control/Q)")
# (find-enode "Shell Mode" "C-c C-c"  "comint-interrupt-subjob")
# (find-enode "Shell Mode" "C-c C-\\" "comint-quit-subjob")

# (find-man "sh")
# (find-man "dash")
# (find-man "expect")



#####
#
# ansi-color-apply
# 2024apr13
#
#####

# «ansi-color-apply»  (to ".ansi-color-apply")
# (find-man "4 console_codes" "ECMA-48 Set Graphics Rendition")
# (find-efunctiondescr 'ansi-color-apply)
# (find-efunction      'ansi-color-apply)
# (find-estring (ansi-color-apply "a \e[31m b \e[0m c"))








# https://unix.stackexchange.com/questions/49779/can-i-change-the-font-of-the-text-mode-console
# (find-fline "/etc/default/console-setup")
# (find-man "5 console-setup")
# (find-man "1 setupcon")
# (find-fline "/etc/default/console-setup")
/etc/default/console-setup

# (find-fline "/usr/share/consolefonts/" "Lat15-Fixed16")
setfont -C /dev/tty5 /usr/share/consolefonts/Lat15-Fixed16

setfont -C /dev/tty5 /usr/share/consolefonts/Lat15-Terminus12x6.psf.gz

setupcon -h
setupcon -f
setupcon -f --print-commands-only
# (find-fline "/usr/share/consolefonts/")
# (find-fline "/usr/share/consolefonts/Lat15-Fixed16.psf.gz")

file /usr/share/consolefonts/Lat15-Fixed16.psf.gz
zcat /usr/share/consolefonts/Lat15-Fixed16.psf.gz > /tmp/foo.psf
# (find-fline "/tmp/foo.psf")

# (find-status   "console-setup-linux")
# (find-vldifile "console-setup-linux.list")
# (find-udfile   "console-setup-linux/")
# (find-apt-get-source-links "console-setup-linux")
# (find-fline "/tmp/d/")
# (code-c-d "consolesetup" "/tmp/d/console-setup-1.205/")
# (find-consolesetupfile "")
# (find-consolesetupsh "find * | sort")
# (find-consolesetupsh "find * | sort | grep raw")
# (find-consolesetupfile "Fonts/")
# (find-consolesetupfile "Fonts/" "Lat15-VGA8.raw")
# (find-consolesetupfile "Fonts/Lat15-VGA8.raw")
# (find-fline "/tmp/d/osourceb")

# (find-man "1 bdf2psf")
# (find-status   "bdf2psf")
# (find-vldifile "bdf2psf.list")
# (find-udfile   "bdf2psf/")







http://www.xs4all.nl/~hanb/configs/dot-screenrc

https://github.com/8l/fbui

https://www.ethanheilman.com/x/28/index.html The Terminal Escape Sequences Ocean is Deep and Dark: Debugging a Virtual Terminal

https://github.com/susam/pcface PC Face is a collection of programmer-friendly resources that allow drawing CP437 characters on a graphical canvas
https://bert.org/2023/02/27/recreating-ansi-art-from-a-screenshot/
https://owengage.com/writing/2023-04-08-getting-the-ctrl-d/
https://news.ycombinator.com/item?id=35502925 Getting the ^D (owengage.com)




#  Local Variables:
#  coding:               utf-8-unix
#  End: