Warning: this is a htmlized version!
The original is across this link. |
####### # # 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. # # 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/a/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/a/.emacs[.html]>, # <http://angg.twu.net/a/.zshrc[.html]>, # <http://angg.twu.net/escripts.html>, # and <http://angg.twu.net/>. # ####### ##### # # console (512 chars fonts) # ##### apti console-tools console-tools-libs # (find-vldifile "console-tools.list") # (find-vldifile "console-tools-libs.list") # (find-fline "/usr/doc/console-tools/") # (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» # 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* ####### # # console-tools source (for 512-chars fonts) # ####### 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 ####### # # screen # ####### apti screen # (find-node "(screen)Top") # (find-node "(screen)Getting Started" "C-a ?") # (find-node "(screen)Screen Command") # (find-node "(screen)Default Key Bindings") # (find-vldifile "screen.list") # (find-fline "/usr/doc/screen/") # Obfuscated tetris: # (find-fline "/usr/doc/screen/terminfo/") cd /tmp/ gzip -cd < /usr/doc/screen/terminfo/tetris.c.gz > tetris.c gcc -o tetris tetris.c ###### # # svgatextmode (and kbrequest) # 99aug31 # ###### # «svgatextmode» # (eeman "inittab" "kbrequest") apti svgatextmode cd /etc/rc2.d/ mv -v S40svgatextmode _S40svgatextmode cd /etc/rc3.d/ mv -v S40svgatextmode _S40svgatextmode # (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? # ###### # (find-fline "/etc/inittab" "kbrequest") # (find-fline "/home/root/bin/kbrequest") # (eeman "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 *) ##### # # 512 char fonts in emacs # ##### # «glyphs512» ; (eeman "console_codes" "ESC % @") ; (eeman "console_codes" "ESC % G") ; 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%@" # (eeman "console") # (eeman "console_ioctl") # (eeman "console_ioctls") # (eeman "console_codes") # (eeman "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) ##### # # Avoiding a terminal reset on vtutil's "open /dev/tty" # 00jan28 # ##### # «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")