From 56b4a2fa96ef823c0127976937ca06734834be4d Mon Sep 17 00:00:00 2001 From: peter Date: Fri, 1 Jan 1999 08:32:05 +0000 Subject: Part 4 of pcvt/voxware revival: pcvt userland Reviewed by: core --- usr.sbin/pcvt/Misc/Doc/Acknowledgements | 111 ++ usr.sbin/pcvt/Misc/Doc/Bibliography | 189 +++ usr.sbin/pcvt/Misc/Doc/BugList | 62 + usr.sbin/pcvt/Misc/Doc/ChangeLog | 899 ++++++++++++++ usr.sbin/pcvt/Misc/Doc/CharGen | 149 +++ usr.sbin/pcvt/Misc/Doc/Charsets | 99 ++ usr.sbin/pcvt/Misc/Doc/EscapeSequences | 268 ++++ usr.sbin/pcvt/Misc/Doc/Keyboard.HP | 286 +++++ usr.sbin/pcvt/Misc/Doc/Keyboard.VT | 231 ++++ usr.sbin/pcvt/Misc/Doc/Makefile | 15 + usr.sbin/pcvt/Misc/Doc/Manifest | 162 +++ usr.sbin/pcvt/Misc/Doc/NotesAndHints | 321 +++++ usr.sbin/pcvt/Misc/Doc/TestedHardware | 79 ++ usr.sbin/pcvt/Misc/Doc/ToDo | 13 + usr.sbin/pcvt/Misc/Etc/Makefile | 13 + usr.sbin/pcvt/Misc/Etc/Termcap | 284 +++++ usr.sbin/pcvt/Misc/Etc/Terminfo | 41 + usr.sbin/pcvt/Misc/Etc/pcvt.el | 19 + usr.sbin/pcvt/Misc/Etc/rc.local | 264 ++++ usr.sbin/pcvt/Misc/Etc/uemacs.tar.Z.uu | 594 +++++++++ usr.sbin/pcvt/Misc/Etc/xmodmap-german | 117 ++ usr.sbin/pcvt/Misc/Makefile | 15 + usr.sbin/pcvt/Misc/Makefile.inc | 3 + usr.sbin/pcvt/Misc/README.FIRST | 291 +++++ usr.sbin/pcvt/cursor/Makefile | 3 + usr.sbin/pcvt/cursor/cursor.1 | 76 ++ usr.sbin/pcvt/cursor/cursor.c | 157 +++ usr.sbin/pcvt/demo/Makefile | 54 + usr.sbin/pcvt/demo/README | 20 + usr.sbin/pcvt/demo/chardemo.vt.gz.uu | 53 + usr.sbin/pcvt/demo/colors.vt.gz.uu | 15 + usr.sbin/pcvt/demo/cowscene.vt.gz.uu | 90 ++ usr.sbin/pcvt/demo/outerlimit.vt.gz.uu | 193 +++ usr.sbin/pcvt/demo/playvt.c | 111 ++ usr.sbin/pcvt/demo/sgr.vt.gz.uu | 11 + usr.sbin/pcvt/demo/twzone.vt.gz.uu | 350 ++++++ usr.sbin/pcvt/demo/xmas.vt.gz.uu | 110 ++ usr.sbin/pcvt/fed/Makefile | 29 + usr.sbin/pcvt/fed/edit.c | 340 ++++++ usr.sbin/pcvt/fed/fed.c | 168 +++ usr.sbin/pcvt/fed/fed.h | 127 ++ usr.sbin/pcvt/fed/misc.c | 353 ++++++ usr.sbin/pcvt/fed/select.c | 334 +++++ usr.sbin/pcvt/fontedit/Makefile | 3 + usr.sbin/pcvt/fontedit/README | 36 + usr.sbin/pcvt/fontedit/fontedit.1 | 58 + usr.sbin/pcvt/fontedit/fontedit.c | 925 ++++++++++++++ usr.sbin/pcvt/fonts/COPYRIGHT | 38 + usr.sbin/pcvt/fonts/Makefile | 19 + usr.sbin/pcvt/fonts/vt100pc.814.uu | 83 ++ usr.sbin/pcvt/fonts/vt100sg.814.uu | 83 ++ usr.sbin/pcvt/fonts/vt220h.808.uu | 49 + usr.sbin/pcvt/fonts/vt220h.810.uu | 60 + usr.sbin/pcvt/fonts/vt220h.814.uu | 83 ++ usr.sbin/pcvt/fonts/vt220h.816.uu | 95 ++ usr.sbin/pcvt/fonts/vt220l.808.uu | 49 + usr.sbin/pcvt/fonts/vt220l.810.uu | 60 + usr.sbin/pcvt/fonts/vt220l.814.uu | 83 ++ usr.sbin/pcvt/fonts/vt220l.816.uu | 95 ++ usr.sbin/pcvt/ispcvt/Makefile | 4 + usr.sbin/pcvt/ispcvt/ispcvt.8 | 91 ++ usr.sbin/pcvt/ispcvt/ispcvt.c | 308 +++++ usr.sbin/pcvt/kbdio/Makefile | 36 + usr.sbin/pcvt/kbdio/kbdio.y | 338 ++++++ usr.sbin/pcvt/kbdio/lex.l | 107 ++ usr.sbin/pcvt/kcon/Makefile | 14 + usr.sbin/pcvt/kcon/kcon.1 | 122 ++ usr.sbin/pcvt/kcon/kcon.c | 753 ++++++++++++ usr.sbin/pcvt/keycap/Makefile | 32 + usr.sbin/pcvt/keycap/keycap.3 | 124 ++ usr.sbin/pcvt/keycap/keycap.c | 377 ++++++ usr.sbin/pcvt/keycap/keycap.h | 49 + usr.sbin/pcvt/keycap/keycap.src | 630 ++++++++++ usr.sbin/pcvt/keycap/man5/keycap.5 | 130 ++ usr.sbin/pcvt/loadfont/Makefile | 3 + usr.sbin/pcvt/loadfont/loadfont.1 | 90 ++ usr.sbin/pcvt/loadfont/loadfont.c | 345 ++++++ usr.sbin/pcvt/mcon/Makefile | 3 + usr.sbin/pcvt/mcon/mcon.1 | 166 +++ usr.sbin/pcvt/mcon/mcon.c | 193 +++ usr.sbin/pcvt/scon/Makefile | 3 + usr.sbin/pcvt/scon/scon.1 | 214 ++++ usr.sbin/pcvt/scon/scon.c | 856 +++++++++++++ usr.sbin/pcvt/set2061/CAUTION | 28 + usr.sbin/pcvt/set2061/ICD2061Aalt.c | 297 +++++ usr.sbin/pcvt/set2061/Makefile | 13 + usr.sbin/pcvt/set2061/README | 22 + usr.sbin/pcvt/set2061/compiler.h | 341 ++++++ usr.sbin/pcvt/set2061/main.c | 112 ++ usr.sbin/pcvt/userkeys/Makefile | 3 + usr.sbin/pcvt/userkeys/vt220keys.1 | 131 ++ usr.sbin/pcvt/userkeys/vt220keys.c | 297 +++++ usr.sbin/pcvt/vgaio/CAUTION | 28 + usr.sbin/pcvt/vgaio/Makefile | 38 + usr.sbin/pcvt/vgaio/lex.l | 86 ++ usr.sbin/pcvt/vgaio/vgaio.8 | 143 +++ usr.sbin/pcvt/vgaio/vgaio.h | 63 + usr.sbin/pcvt/vgaio/vgaio.y | 255 ++++ usr.sbin/pcvt/vttest/Makefile | 6 + usr.sbin/pcvt/vttest/README | 57 + usr.sbin/pcvt/vttest/esc.c | 398 ++++++ usr.sbin/pcvt/vttest/header.h | 43 + usr.sbin/pcvt/vttest/main.c | 2016 +++++++++++++++++++++++++++++++ usr.sbin/pcvt/vttest/vttest.1 | 13 + 104 files changed, 18316 insertions(+) create mode 100644 usr.sbin/pcvt/Misc/Doc/Acknowledgements create mode 100644 usr.sbin/pcvt/Misc/Doc/Bibliography create mode 100644 usr.sbin/pcvt/Misc/Doc/BugList create mode 100644 usr.sbin/pcvt/Misc/Doc/ChangeLog create mode 100644 usr.sbin/pcvt/Misc/Doc/CharGen create mode 100644 usr.sbin/pcvt/Misc/Doc/Charsets create mode 100644 usr.sbin/pcvt/Misc/Doc/EscapeSequences create mode 100644 usr.sbin/pcvt/Misc/Doc/Keyboard.HP create mode 100644 usr.sbin/pcvt/Misc/Doc/Keyboard.VT create mode 100644 usr.sbin/pcvt/Misc/Doc/Makefile create mode 100644 usr.sbin/pcvt/Misc/Doc/Manifest create mode 100644 usr.sbin/pcvt/Misc/Doc/NotesAndHints create mode 100644 usr.sbin/pcvt/Misc/Doc/TestedHardware create mode 100644 usr.sbin/pcvt/Misc/Doc/ToDo create mode 100644 usr.sbin/pcvt/Misc/Etc/Makefile create mode 100644 usr.sbin/pcvt/Misc/Etc/Termcap create mode 100644 usr.sbin/pcvt/Misc/Etc/Terminfo create mode 100644 usr.sbin/pcvt/Misc/Etc/pcvt.el create mode 100644 usr.sbin/pcvt/Misc/Etc/rc.local create mode 100644 usr.sbin/pcvt/Misc/Etc/uemacs.tar.Z.uu create mode 100644 usr.sbin/pcvt/Misc/Etc/xmodmap-german create mode 100644 usr.sbin/pcvt/Misc/Makefile create mode 100644 usr.sbin/pcvt/Misc/Makefile.inc create mode 100644 usr.sbin/pcvt/Misc/README.FIRST create mode 100644 usr.sbin/pcvt/cursor/Makefile create mode 100644 usr.sbin/pcvt/cursor/cursor.1 create mode 100644 usr.sbin/pcvt/cursor/cursor.c create mode 100644 usr.sbin/pcvt/demo/Makefile create mode 100644 usr.sbin/pcvt/demo/README create mode 100644 usr.sbin/pcvt/demo/chardemo.vt.gz.uu create mode 100644 usr.sbin/pcvt/demo/colors.vt.gz.uu create mode 100644 usr.sbin/pcvt/demo/cowscene.vt.gz.uu create mode 100644 usr.sbin/pcvt/demo/outerlimit.vt.gz.uu create mode 100644 usr.sbin/pcvt/demo/playvt.c create mode 100644 usr.sbin/pcvt/demo/sgr.vt.gz.uu create mode 100644 usr.sbin/pcvt/demo/twzone.vt.gz.uu create mode 100644 usr.sbin/pcvt/demo/xmas.vt.gz.uu create mode 100644 usr.sbin/pcvt/fed/Makefile create mode 100644 usr.sbin/pcvt/fed/edit.c create mode 100644 usr.sbin/pcvt/fed/fed.c create mode 100644 usr.sbin/pcvt/fed/fed.h create mode 100644 usr.sbin/pcvt/fed/misc.c create mode 100644 usr.sbin/pcvt/fed/select.c create mode 100644 usr.sbin/pcvt/fontedit/Makefile create mode 100644 usr.sbin/pcvt/fontedit/README create mode 100644 usr.sbin/pcvt/fontedit/fontedit.1 create mode 100644 usr.sbin/pcvt/fontedit/fontedit.c create mode 100644 usr.sbin/pcvt/fonts/COPYRIGHT create mode 100644 usr.sbin/pcvt/fonts/Makefile create mode 100644 usr.sbin/pcvt/fonts/vt100pc.814.uu create mode 100644 usr.sbin/pcvt/fonts/vt100sg.814.uu create mode 100644 usr.sbin/pcvt/fonts/vt220h.808.uu create mode 100644 usr.sbin/pcvt/fonts/vt220h.810.uu create mode 100644 usr.sbin/pcvt/fonts/vt220h.814.uu create mode 100644 usr.sbin/pcvt/fonts/vt220h.816.uu create mode 100644 usr.sbin/pcvt/fonts/vt220l.808.uu create mode 100644 usr.sbin/pcvt/fonts/vt220l.810.uu create mode 100644 usr.sbin/pcvt/fonts/vt220l.814.uu create mode 100644 usr.sbin/pcvt/fonts/vt220l.816.uu create mode 100644 usr.sbin/pcvt/ispcvt/Makefile create mode 100644 usr.sbin/pcvt/ispcvt/ispcvt.8 create mode 100644 usr.sbin/pcvt/ispcvt/ispcvt.c create mode 100644 usr.sbin/pcvt/kbdio/Makefile create mode 100644 usr.sbin/pcvt/kbdio/kbdio.y create mode 100644 usr.sbin/pcvt/kbdio/lex.l create mode 100644 usr.sbin/pcvt/kcon/Makefile create mode 100644 usr.sbin/pcvt/kcon/kcon.1 create mode 100644 usr.sbin/pcvt/kcon/kcon.c create mode 100644 usr.sbin/pcvt/keycap/Makefile create mode 100644 usr.sbin/pcvt/keycap/keycap.3 create mode 100644 usr.sbin/pcvt/keycap/keycap.c create mode 100644 usr.sbin/pcvt/keycap/keycap.h create mode 100644 usr.sbin/pcvt/keycap/keycap.src create mode 100644 usr.sbin/pcvt/keycap/man5/keycap.5 create mode 100644 usr.sbin/pcvt/loadfont/Makefile create mode 100644 usr.sbin/pcvt/loadfont/loadfont.1 create mode 100644 usr.sbin/pcvt/loadfont/loadfont.c create mode 100644 usr.sbin/pcvt/mcon/Makefile create mode 100644 usr.sbin/pcvt/mcon/mcon.1 create mode 100644 usr.sbin/pcvt/mcon/mcon.c create mode 100644 usr.sbin/pcvt/scon/Makefile create mode 100644 usr.sbin/pcvt/scon/scon.1 create mode 100644 usr.sbin/pcvt/scon/scon.c create mode 100644 usr.sbin/pcvt/set2061/CAUTION create mode 100644 usr.sbin/pcvt/set2061/ICD2061Aalt.c create mode 100644 usr.sbin/pcvt/set2061/Makefile create mode 100644 usr.sbin/pcvt/set2061/README create mode 100644 usr.sbin/pcvt/set2061/compiler.h create mode 100644 usr.sbin/pcvt/set2061/main.c create mode 100644 usr.sbin/pcvt/userkeys/Makefile create mode 100644 usr.sbin/pcvt/userkeys/vt220keys.1 create mode 100644 usr.sbin/pcvt/userkeys/vt220keys.c create mode 100644 usr.sbin/pcvt/vgaio/CAUTION create mode 100644 usr.sbin/pcvt/vgaio/Makefile create mode 100644 usr.sbin/pcvt/vgaio/lex.l create mode 100644 usr.sbin/pcvt/vgaio/vgaio.8 create mode 100644 usr.sbin/pcvt/vgaio/vgaio.h create mode 100644 usr.sbin/pcvt/vgaio/vgaio.y create mode 100644 usr.sbin/pcvt/vttest/Makefile create mode 100644 usr.sbin/pcvt/vttest/README create mode 100644 usr.sbin/pcvt/vttest/esc.c create mode 100644 usr.sbin/pcvt/vttest/header.h create mode 100644 usr.sbin/pcvt/vttest/main.c create mode 100644 usr.sbin/pcvt/vttest/vttest.1 diff --git a/usr.sbin/pcvt/Misc/Doc/Acknowledgements b/usr.sbin/pcvt/Misc/Doc/Acknowledgements new file mode 100644 index 0000000..327f23d --- /dev/null +++ b/usr.sbin/pcvt/Misc/Doc/Acknowledgements @@ -0,0 +1,111 @@ +Thank You, (in the order of appearance) + + + Lynne and Bill Jolitz + + for your work on 386BSD and making all this possible ! + + + Holger Veit (veit@du9ds3.uni-duisburg.de) + + for the permission to use a modified version of his keyboard + driver and utilities for keyboard remapping / multinational + keyboard support. + + + Per Lindberg + + for the extremely helpful vt100 terminal testprogram found + in the directory vttest. + + + John Birchfield + + for the ncsa telnet package, which contains a vt100 emulation + and which was very helpful in studying some concepts. + + + Ralf Friedl (friedl@informatik.uni-kl.de) + + for making his implementation of multi-sceens for the net-2 + distribution available. i looked at this and took some ideas + and lines from his code. + + + Bruce Evans (bde@runx.oz.au) + + for contributing some bugfixes and a complete termcap entry + + + Brian H. Dunford-Shore (brian@morpheus.wustl.edu) + + for contributing most of the EGA/VGA screen switching code + and being a fast, reliable and responsive co-author. This + driver would not be what it is without Brian, Thank You ! + + + Frank da Cruz (fdc@columbia.edu) + + for my famous datacomm program and for giving the permission + to redistribute files from the msdos kermit distribution + located in the directory support/demo. + + + Joerg Wunsch (joerg_wunsch@uriah.sax.de) + + for contributing precise bugreports and -fixes, the 8x10 + EGA/VGA fonts and the color palette ioctls and for being + a very responsive contributor of various ideas. + Joerg wrote pcvt's interface to XFree86 1.2 and 1.3 and + the SYSV/syscons - like interface to XFree86 2.0. + There would be no support for X without Joerg's work! + Thank you very much Joerg, i enjoy it !!! :-) + + + Scott Turner (scotty@gagetalker.com) + + for contributing code to change the winsize structure, many + discussions on the keyboard code and fine-tuning the driver + + + Gordon L. Burditt (gordon@sneaky.lonestar.org) + + for the nicest and most complete bugreports i ever got + + + Theo Deraadt (deraadt@fsa.ca) + + for pushing me forward. There would be no 3.00 release + if Theo didn't asked for features ... ;-) + + + Onno van der Linden (c/o frank@fwi.uva.nl) + + for writing the 132 column support for the Cirrus + chipsets although he had no time to do it ... :-) + + + Wolfram Solfrank, Ingo Koenig + + for putting some data onto tape (and handling and shipping + in the case of Wolfgang) to provide me with some latest + sources because i still have no ip-connectivity .... + + + Michael Havemester (tik@abqhh.hanse.de) + + for giving me a chance to stay up to date with NetBSD- + current, for programming the initial version of the fast + scrolling code and for the keyboard fifo code! + + + Charles Hannum (mycroft@gnu.ai.mit.edu) + + for getting bored by a slow-scrolling video driver and + for leaving me some bugs to fix ;-) + + + The NetBSD and FreeBSD teams + + for giving me something to play, work and learn with ! + There would be nothing to write a driver for without you !!! diff --git a/usr.sbin/pcvt/Misc/Doc/Bibliography b/usr.sbin/pcvt/Misc/Doc/Bibliography new file mode 100644 index 0000000..2cce039 --- /dev/null +++ b/usr.sbin/pcvt/Misc/Doc/Bibliography @@ -0,0 +1,189 @@ + +VGA BOOKS +--------- + + Richard Wilton, "Programmers Guide to PC & PS/2 Video Systems", + Microsoft Press 1987 + + + Richard F. Ferraro, "Programmers Guide to the EGA and VGA Cards", + Second Edition, Addison-Wesley 1990 + + + Richard F. Ferraro, "Programmers Guide to the EGA and VGA Cards", + Third Edition, Addison-Wesley 1994 + + + Matthias Uphoff, "Die Programmierung der EGA/VGA Grafikkarte", + Addison Wesley 1992 + + + Bradley Dyck Kliewer, "EGA/VGA A Programmers Reference Guide", + McGraw Hill, 2nd Edition 1990 + + +UNIX AND UNIX DEVICE DRIVERS +---------------------------- + + Bell Telephone Laboratories, Inc. "UNIX Programmer's Manual, Seventh + Edition, Volume 2". Revised and Expanded Version. + Holt, Rinehart and Winston 1983 + + + George Pajari, "Writing Unix Device Drivers" + Addison Wesley 1992 + + + Janet I. Egan and Thomas J. Teixeira, "Writing a UNIX Device Driver" + John Wiley & Sons 1988 + + + Janet I. Egan and Thomas J. Teixeira, "Writing a UNIX Device Driver" + Second Edition. John Wiley & Sons 1992 + + + Leffler, McKusick, Karels, Quarterman, "The Design and Implementation + of the 4.3BSD UNIX Operating System" + Addison Wesley 1988, corrected Reprint 1989 + + + Leffler, McKusick, "The Design and Implementation of the 4.3BSD UNIX + Operating System, Answer Book" + Addison Wesley 1991 + + + Maurice J. Bach, "The Design of the UNIX Operating System" + Prentice-Hall 1986 + + + Sun Microsystems Inc., "Writing Device Drivers" + Part No. 800-3851-10, Revision A of 27 March 1990 + + + Hewlett-Packard Company, "HP-UX Driver Development Guide", + Part No. 98577-90013, First Edition 07/91 + + + W. Richard Stevens, "Advanced Programming in the UNIX Environment", + Addison Wesley 1992 + + + Phillip M. Adams, Clovis L. Tondo, "Writing Unix Device Drivers in C", + Prentice Hall 1993 + + + Berny Goodheart, James Cox, "The Magic Garden Explained", + Prentice Hall 1994 + + + Peter Kettle, Steve Statler, "Writing Device Drivers for SCO Unix" + Addison Wesley 1993 + + +TERMINAL MANUALS +---------------- + + Digital Equipment, VT100 Users Manual, 2nd ed. 1979 + Digital Equipment, VT132 Users Manual + Digital Equipment, VT220 Programmers Reference Manual, 2nd ed. 1984 + Digital Equipment Corporation + + + Hewlett Packard, 700/92 Technical Reference Manual (ANSI Operation) + Hewlett Packard, 2392a Users Manual (ANSI Operation) + Hewlett-Packard Company + + + Walker Richer & Quinn, Inc., "Reflection 2 and Reflection 4 Technical + Reference Manual", Version 4.2 + Walker, Richer & Quinn, Seattle, August 1992 + + +IBM PC HARDWARE/FIRMWARE +------------------------ + + Frank van Gilluwe, "The Undocumented PC", + Addison Wesley, First Edition May 1994 + + + IBM Corporation, "Technical Reference Personal Computer AT", + Part No. 6280070, Form No. S229-9611-00, First Edition 1985 + + + Phoenix Technologies Ltd., "System BIOS for IBM PC/XT/AT Computers + and Compatibles", Addison Wesley, Fourth Printing June 1990 + + + Phoenix Technologies Ltd., "System BIOS for IBM PCs, Compatibles, + and EISA Computers", Second Edition + Addison Wesley, First Printing May 1991 + + + American Megatrends, Inc., "Hi-Flex ISA and EISA AMIBIOS Technical + Reference", American Megatrends, Inc. 1992 (9/25/92) + + + Thom Hogan, "The Programmers PC Sourcebook", 2nd Edition + Microsoft Press, 1991 + + +TERMCAP/TERMINFO +---------------- + + John Strang, Linda Mui and Tim O'Reilly, "Termcap and Terminfo", + O'Reilly & Associates, Inc. , April 1991 + + + Richard M. Stallman, "Termcap - The Termcap Library and Data Base", + Free Software Foundation, Second Edition November 1988 + + + +DATABOOKS/DATASHEETS +-------------------- + + Intel Corporation, "Microsystem Components Handbook Volume II", + Intel Corporation, 1984 + + + Intel Corporation, "Peripheral Design Handbook", + Intel Corporation, 1980 + + + Tseng Labs, Inc. "ET4000 Graphics Controller Data Book", 1990 + + + Western Digital Corporation, "WD90C11, WD90C11A (PVGA1C) Enhanced + VGA Controller", Western Digital 9/18/91 + + + Western Digital Corporation, "WD90C00 Enhanced VGA Controller", + Western Digital 1/14/91 + + + Western Digital Corporation, "WD90C00 Interface Guide", + Western Digital 1/10/91 + + + Western Digital Corporation, "VGA Register Based Programmers Manual", + Western Digital 1/30/91 + + + Western Digital Corporation, "VGA BIOS Programmers Manual", + Western Digital 1/10/91 + + + Cirrus Logic, "True Color VGA Family - CL-GD542X", Technical Ref. + Manual, Cirrus Logic, Inc. April 1993 + + + S3 Inc, "86C801/86C805 GUI Accelerators" + S3 Incorporated, September 1992 + + + S3 Inc, "86C928 GUI Accelerator" + S3 Incorporated, July 1993 + + + Trident Microsystems Inc., "TVGA9000i Technical Reference Manual", + Trident Microsystems, Inc. (c) 1992, March 1993, Rev 1 diff --git a/usr.sbin/pcvt/Misc/Doc/BugList b/usr.sbin/pcvt/Misc/Doc/BugList new file mode 100644 index 0000000..9c8feef --- /dev/null +++ b/usr.sbin/pcvt/Misc/Doc/BugList @@ -0,0 +1,62 @@ + +List of known Bugs Last Edit-Date: [Sun Mar 5 13:03:51 1995] +================================================================================ + + +Description: Fixed/done by/date +------------------------------------------- -------------------------------- +Util/keycap/man5/keycap.5 does STILL not +build correctly when doing a make obj. +Will there ever be a solution ... :-) +------------------------------------------- -------------------------------- +NetBSD PR #404: Meta-Control-Space broken +with PCVT_META_ESC and PCVT_NULLCHARS set +Meta-Control-Space should (theoretically) +send ESC NUL if PCVT_NULLCHARS and +PCVT_META_ESC are defined; in reality, it +just sends ESC. Because of the grody +encoding hack used by sgets() to implement +PCVT_NULLCHARS (if the first character is +a null, send it), there isn't a trivial +one-line fix. +How-To-Repeat: in a kernel with +PCVT_NULLCHARS and PCVT_META_ESC, type a +M-C-SPC to emacs. +------------------------------------------- -------------------------------- +when auto switching to vt0 is enabled by +PCVT_SW0CNOUTP and the screen is switched +from an X-vt to screen 0, the video mem +is irrecoverably destroyed - no data loss +------------------------------------------- -------------------------------- +Altgr+Shift+key is not separately They way the keyboard mapping +mappable. is done is subject to a sub- + stantial rewrite in a future + release +------------------------------------------- -------------------------------- +132 column mode not working with #9 GXE +(S3-based) (sorry, i don't have one -hm) +(see discussion of 132 column mode in the + NotesAndHints file!) +------------------------------------------- -------------------------------- +WD90Cxx chip detection fails to detect +chips other than C00,C10 and C11. C30 +chips are detected as C11s .... +------------------------------------------- -------------------------------- +Xfree86 2.0 locks the console when started +under NetBSD 0.9. SuperProbe and X both +show process status "DE+" in ps. Work- +around is to disable PCVT_USL_VT_COMPAT. +------------------------------------------- -------------------------------- +On one keyboard, if a "Lock" key is pressed +the leds do not get updated and the key- +board hangs. +------------------------------------------- -------------------------------- +HP function key labels code needs to set +the user defined fkey string somehow! +------------------------------------------- -------------------------------- +Video 7 1024i not fully supported yet, has +sometimes problems with some chars to displ +------------------------------------------- -------------------------------- +The HP-Escape sequences need to be FULLY 28.12.93, -hm did a bit to supp- +implemented port elm. Needs MORE work ! +------------------------------------------- -------------------------------- diff --git a/usr.sbin/pcvt/Misc/Doc/ChangeLog b/usr.sbin/pcvt/Misc/Doc/ChangeLog new file mode 100644 index 0000000..2e8547e --- /dev/null +++ b/usr.sbin/pcvt/Misc/Doc/ChangeLog @@ -0,0 +1,899 @@ +ChangeLog last edit-date: [Thu Apr 6 10:52:50 1995] +================================================================================ + +Changes 3.10 -> 3.20 April 1995 +-------------------------------------------------------------------------------- + +- bugfix from Thomas Eberhardt: the force 24 lines enable function key + label was not updated when changing force 24 lines mode with + 'scon -f on|off', this is now fixed. + +- bugfix from John Kohl fixing divide by zero problem in pcvt_ext.c when + ringing the bell and pitch is 0: this avoids an integer divide + trap in supervisor mode. + +- changed the default behaviour of keyboard controller delay from using + delay()/DELAY() to using dummy reads to port 0x84 because i got + keyboard hangs in X. + +- bugfix: in pcvt_ext.c, MDA state restore when leaving X was lost, should + function now again. + +- renamed PCVT_XSERVER to XSERVER in ispcvt.c + +- bugfix in pcvt_vtf.c: renamed PCVT_USL_COMPAT to PCVT_USL_VT_COMPAT + +- added '-d ' option to ispcvt and loadfont + +- removed PCVT_NEEDPG + +- almost completely removed support for 386BSD 0.1 with patchkit 0.2.4 + +- applied a patch from Joerg providing missing FreeBSD 2.1 functionality and + a some minor bugfixes and checks. + +- provide a single place PCVT_KBD_DELAY in pcvt_hdr.h. made it configurable + via PCVT_PORTIO_DELAY to use either 6 dummy reads from port 0x84 + or the delay/DELAY function of the operating system. Changed ispcvt + to report status of compile time switch. + +- release beta 23 -------------------------------------------------------------- + +- removed some files for 386BSD as there is virtually noone outside + using it anymore + +- make pcvt_ioctl.h accept "KERNEL" or "_KERNEL" for NetBSD-current + +- configuration fix: patch from Rafal Boni for pcvt_vtf.c, he writes: + This patch lets one compile pcvt on a system that is lacking XSERVER + and UCONSOLE [or either?] in the config file. I found this while + trying to build a minimal floppy-based test kernel. The problem is + that roll_up and roll_down assume that PCVT_USL_COMPAT is + unconditionally set, and hence muck with parts of the video structure + that are only there if PCVT_USL_COMPAT is set. + (generalized the patch a bit so that fastscroll functionality is + not lost in case of PCVT_USL_COMPAT not being defined. -hm) + +- bugfix: pcvt_ext.c switch_screen() - when switching to a 25 line charset + pure VT emulation screen which has force 24 lines set, then we have + to clear the last line on screen (bugreport from Joerg). + +- added define PCVT_NONRESP_KEYB_TRY for how many times to try to detect + a non-connected keyboard. This was previously set to 100 and + Joerg reports a 5+ minutes delay for a 386 booting without keyboard. + Set to 25 now in the definition. Also made shure the messages in + the corresponding loop display only once. [doreset() in pcvt_kbd.c] + +- updated kbdio utility to include the 7 us delay and added a 'what' command + detect type of MCA motherboard keyboard controller according to + Frank van Gilluwe, "The Undocumented PC", Addison Wesley, pp 273 + +- "Gateway 2000" problem: after some discussion on the NetBSD port-i386 + mailing list about hanging keyboards, Martin Husemann sent in a + patch where each inb(CONTROLLER_DATA) is now preceeded by a + delay(6). This fixed his keyboard problem, the same was reported + from Roland McGrath for his Gateway 2000 keyboard/machine. + +- patch from John Kohl for usl_vt_ioctl() in file pcvt_ext.c, he writes: + This is probably a long standing bug. tsleep() returns ERESTART + if it's interrupted. ERESTART is -1, which means that the + VT_WAITACTIVE call returns from usl_vt_ioctl() with -1, + meaning "not one of my ioctl's". + +- patch from Matthieu Herrb for NetBSD-current (post 1.0) support + +- patch from Joerg for FreeBSD pre-2.1 support + +- added file ToDo in directory Doc + +- fix for Util/Makefile.inc.NetBSD-c from Onno + +- removing unnecessary Trident support code from pcvt_out.c + +- fix from Onno for IST_EDGE in NetBSD-current + +- patch from Thomas Eberhardt to fix the bell frequency and duration setting + for NetBSD + +- some fixes from Onno van der Linden for NetBSD + +- added patch for NetBSD-current from Rafal Boni and Lon Willett + +- added another mega patch from Lon Willett fixing several bugs: + + 1 -- Misc porting changes to deal with NetBSD-current, including + a new Util/Makefile.inc.NetBSD-current. + + 2 -- The Control_R scancodes were being mapped to the Control_L + pcvt keynum. + + 3 -- FASTSCROLL/graphics-mode problem: there was a problem where + switching from a graphics screen to a text screen would corrupt + the text screen's content if it had been scrolling using the + FASTSCROLL code. (The problem is the bcopy() from kernel to + video memory was using the vs[i].Memory pointer as the source, + instead of the vs[i].Crtat pointer). This is fixed in the beta + 21 release by just disabling the fast scroll code for screens + which aren't active. + + The patch I'm sending you re-enables the fast scroll code on + inactive (i.e. in kernel memory) screens, saving a few cpu + cycles. + + 4 -- This is a big one: running multiple X servers was not + really working. The USL handshaking code was a mess (not very + well designed to begin with, but there's not much that can be + done about that). I did manage to get it fairly functional, but + there's a lot of changes. + +- changing example rc.local to take care of good old EGA's + +- fixing support for EGA boards in vt_coldinit() + +- removing vt100 font files from Util/fonts, updated Manifest + +- fixing an obviously longstanding bug in roll_up() / roll_down() which was + triggered by Joergs "Crtat" cleanup mega patch. + +- removing PCVT_FAKE_SYSCONS10 + +- removing duplicate names in termcap entries + +- fixing vt_coldinit: setting variable "color" for mda/hercules and cga + initializing cursor position + +- fixing roll_up() and roll_down() for mda/hercules: mda's have ALWAYS + just one page of memory, original hercules boards too so they + can NEVER use the fastscroll option. SOME hercules are somehow + enhanced in that they support 2 pages. pcvt now just supports + one page hercules/mda! + +- made cleanups to 8x14 high and 8x8 high fonts: adjust the 5 scanline + characters to adjust with the corner characters from the low fonts + +- applying patch from Joerg which fixes some bugs: + + writing to a tty containing an X server resulted in some stange + behaviour depending on the opsys and opsys version used + + the init code preserving the screen contents and cursor shape + can only be done on boards allowing the reading of + several crtc registers + +- removed bcopyb declaration from pcvt_hdr.h for FreeBSD 2.1 + +- another patch from Lon Willett (willett@math.utah.edu), he writes: + + 1 -- Very minor: One of my previous changes didn't get merged + into "pcvt_out.c"; the caclulation of ws_row doesn't account for + "force24" at one spot. It's easier to just set it from + screen_rows anyway, unless there's something that I didn't + understand happening here. + + 2 -- Debugging stuff: I don't know if you care to add it, but I + found it useful, so I left it in. I rearranged the + PCVT_SHOWKEYS code a little, and added a few lines to show + keyboard commands and responses, with special delimiters. + [file: pcvt_kbd.c] + + 3 -- "kcon" utility enhancement: I added a "-R" switch to kcon + to do a KBDRESET ioctl. [file: Util/kcon/kcon.c] + + 4 -- KBDRESET-ioctl bug: the code was trying to read kbd + responses without an spltty(), so naturally it would fail, since + pcrint() was grabbing the ACKs. [file: pcvt_kbd.c] + + 5 -- update_led() makes kbd hang: the problem here is that + update_led() makes the keyboard generate two KEYB_R_ACK + responses, and one of the interrupts sometimes gets lost when + there is a lot of other I/O happening. See the comment in the + code. My fix seems to work for me, but you may want to handle + it some other way. It would probably be quite reasonable to + check for lost interrupts periodically anyway, whether + update_led() has been called or not. [file: pcvt_kbd.c] + + (NOTE: item 5 has been disabled because it causes older + FreeBSD's to panic because of the timer queue not being + initialized at the time called. -hm) + +- partly rewrote doreset() in pcvt_kbd.c to enable boot procedure to proceed + if no (PC) keyboard is found. The current behaviour and implementation + is subject to change. + +- patch from Thomas Gellekum to Util/keycap/keycap.src + +- minor modification to main.c in Util/set2061 + +- patch from Onno and John Kohl to make pcvt beta 16 work on NetBSD current: + 1. pcvt_conf.h + _real_ 1.0 ===> NetBSD1_0 == 1 + current 1.0 (1.0A) ===> NetBSD1_0 == 2 + 2. pcvt_hdr.h + Put pcvt_conf.h before _all_ the #ifdef PCVT_*. This way + the #ifdef NetBSDx_y stuff can do its work. + +- size of PCVT_BURST was still reported as 1 for FreeBSD 2.0, fixed + +- made some adjustments for FreeBSD 2.0 in Util/vgaio + +- Another patch from Joerg for FreeBSD 2.0 + +- included vgaio, kbdio and set2061 into the outer Makefile, this programs + are build and cleaned but don't install anything. + All program's in the Util dir should now cleanly make ... + +- enable 132 column support for Trident TVGA8900CL, some NetBSDisms + +- addend patch from Joerg for pcvt-320b7 to fix FreeBSD 2.0's ttymalloc's + encapsulation into #if's. Also new keycap.src entry. + +- fixed keyboard status/LED not updated on soft reset emulator + +- on 23rd of December i had some spare time, so i added some demos to the + Util/demo directory as well a a time-killer program (playvt) to view + some of the VT animations and a christmas animation i got from Joerg. + +- added a new utility set2061 to program the clock generator on my S3 based + ELSA Winner VGA board. This eventually lets me use 132 columns on this + board, because i'm now able to program the clock to generate 40MHz + on clock output #2. + +- debugged winsize patch on FreeBSD 1.1, line discipline open init's the + queues, winsize initialization must happen after line disc. open! + +- got a bunch of NetBSD PR's from J.T. Conklin: + + PR #214: PCVT treats ctrl-shift exactly like shift for most characters. + (fixed by Lon Willet's Mega Patch described below -hm) + + PR #399: If you define PCVT_META_ESC when builting PCVT, Meta-Return + sends 0x8d instead of ESC RET. + (fixed by applying the patch from Bill Sommerfeld. -hm) + + PR #400: pcvt sometimes gets confused about window size + (fixed by applying the patch from Bill Sommerfeld. -hm) + + PR #404: Meta-Control-Space broken with PCVT_META_ESC and PCVT_NULLCHARS + (put into "BugList" file, no solution yet .. -hm) + + PR #488: pcvt can loose keyboard control if you start an xserver from + an xterm + (already fixed by a patch from John Kohl, see below -hm) + + PR #580: NetBSD i386/pcvt bugs/enhancements; fixes included + (already integrated the patch from Lon Willet, see below -hm) + +- on coldinit, if FAT_CURSOR is defined, the old large blockcursor is used + +- enhanced the vgaio output in an attempt to make 132 column mode work + for my S3 board .... + +- applied patch from Thomas Gellekum: install instructions for FreeBSD 2.0, + patch to fontedit to compile under FreeBSD 2.0, an addition to + keycap.src and a fix for kbdio + +- changed installation instructions to reflect recent changes, removed + instructions for FreeBSD 1.0 and added instructions for FreeBSD 2.0 + +- upgraded all utilities version strings to 3.20 + +- new example of rc.local + +- changing timeout()/untimeout() function parameter type to TIMEOUT_FUNC_T + definition in pcvt_hdr.h + +- changed install instructions to reference Etc dir instead of Doc dir for + several files which were moved from Doc to Etc. + +- new parameter -d for the cursor utility, updated cursor manpage + +- applying a patch from Lon Willett, willett@math.utah.edu which fixes + several bugs and provides some enhancements. Lon writes: + + 1 -- The displayed cursor is not updated during kernel I/O, + because async_update() doesn't get called. This is merely ugly + while the system startup messages are being displayed, but it is + positively annoying when using the kernel debugger. + + 2 -- CONTROL-SHIFT- is taken to be the same as SHIFT-. + It should be interpretted as CONTROL-, or even have its own + binding. One of the lines below fixes it in the former way. + This is especially bad (i.e. clearly buggy) when I type + CONTROL-SHIFT-<6/^> to get a "Control-^", and instead get a "^". + + 3 -- The "special" region at the bottom of the screen, i.e. the + function-key-labels/status-line in HPVT mode, and the blank line + in FORCE24LINES mode, do not get properly cleared/updated. + + 4 -- When switching screen sizes/modes, the FORCE24LINES setting + is not always handled. + + 5 -- The PCVT_VT220KEYB functions are missing some features. + The control key settings are bug fixes; they apply only if + system function key labels are on, and match the labels. The + shift key definitions are enhancements. + + The new keys (previously undefined) are: + + Control-F1 -- toggle 80/132 columns + Control-F2 -- soft reset emulator + Control-F3 -- toggle force 24 lines mode + Control-F4 -- toggle keyboard debugging + + Shift-F1 -- select screen 4 + Shift-F2 -- select screen 5 + Shift-F3 -- select screen 6 + Shift-F4 -- select screen 7 + Shift-F5 -- select (current screen - 1) + + 6 -- [Enhancement] The initial startup screen is cleared, and + the screen gets cleared when changing modes/sizes. I don't like + this. I want a chance to see bootstrap loader messages, and I + also want the command "scon -d/dev/ttyv0 -H -s28" in my + rc.local, but then I lose various messages from daemons, etc + (which aren't always logged to syslog). So I have fixed the + code so that it tries to preserve the contents of the screen + when starting up, and when changing modes/sizes. + + 7 -- [Enhancement?] I added code to preserve the initial cursor + shape at startup. This isn't really necessary, since the + "cursor" command can be used to set it to your preference; but + it seems like this is the preferable policy to use for the + default. + +- applying patches from Onno van der Linden and Martin Husemann: adding + support for post 1.0 NetBSD-current and adding PCVT_NO_LED_UPDATE + +- patch from Joerg Wunsch: support for FreeBSD 2.0 and better support + for serial console coexistence + +- bugreport from Michael Havemester regarding PCVT_NOFASTSCROLL: it was + not enabled in pcvt_vtf.c, fixed. + +- renamed pcvt_disable_intr and pcvt_enable_intr to PCVT_DISABLE_INTR and + PCVT_ENABLE_INTR (Joerg) + +- attempt to automatically compile time configure in pcvt_conf.h, how + does FreeBSD do this ? should work for NetBSD (from Onno v.d. Linden) + +- split off pcvt_kbd.h from pcvt_kbd.c, file > 100k + +- split off pcvt_config.h from pcvt_hdr.h. All compile time configurations + should be put into pcvt_config.h now. + +- moved version definitions to begin of file in pcvt_ioctl.h and pcvt_hdr.h + +- fixing NetBSD #ifdef in pcvt_drv.c + +- fixed bug in scon. when doing "scon -c " the destination screen was + cleared, this is fixed now by properly setting "force_24lines" + +- added kbdio utility from Joerg into Util directory + +- changed font dir from /usr/share/misc/vgafonts to /usr/share/misc/pcvtfonts + +- Fix for Gateway 2000 keyboard problems from Brian Moore + +- Starting to implement more keymoard mapping layers in pcvt_kbd.c. This + section is a building site, enclosed in NOT_YET_DEF ifdef's + +- VT_SETMODE ioctl patch from John Kohl , see text + from John in the source file pcvt_ext.c + +- patch from Joerg for kbd_emulate_pc(), intro of timeout + +- fixed bug in soft/hard reset and real system fkey labels + +- added patch from Joerg for FreeBSD 1.1.5.1R + +- fixed both SR and SF entries in termcap database file + +- removed SR entry in termcap database file (bugreport from John Perry) + +- bugfix in cirrus 132 column switching got from Onno/Charles + +- french keycap database entry from Matthieu Herrb + +- cleanup patch from Joerg for Util/demo/Makefile und Util/fonts/Makefile + + +Changes 3.00 -> 3.10 June 1994 +-------------------------------------------------------------------------------- + +- patch from Joerg correcting my assumed timeout/untimeout FreeBSD casts + +- adjusted some #if's while validating NetBSD 0.9 and NetBSD-current + +- rolled in Joerg's changes for a pre-1.1.5 (?) FreeBSD-current + +- Util/fonts: install only the necessary fontfiles, vt100 not used anymore + +- updated and commented Etc/rc.local and updated to more recent /etc/ttys files + +- updated all installation instructions and changed their names + +- documenting more PCVT_ options in pcvt_hdr.h + +- adding CONF_ options to driver config ioctl and upgrading ispcvt + +- commenting the source, housekeeping, step up to 3.10 beta 2 + +- casting timeout()/untimeout() for FreeBSD 1.1R :-( + +- unprotecting vgapage() routine with #if !PCVT_KBD_FIFO + +- adding Michael Havemester's keyboard fifo diffs to source tree + +- pcvt_drv.c: made declaration of Crtat global for this file for NetBSD + +- changing Util/fonts/Makefile and Util/demo/Makefile to run in all + supported environments + +- moving inline from pcvt_vtf.h into pcvt_hdr.h, i still feel that this is + not the best solution, but i got annoyed by the 10 line pcvt_vtf.h + +- bugfix, in hpmode, clear last 4 lines when 28 column mode and force + 24 lines are true + +- applying patch from Thomas Gellekum : + - discard escape sequences ESC space F and ESC space G + - discard escape sequences DECELR = enable locator report + and DECSLE = select type of locator event + - disable scrolling when writing outside the scrolling region + at an absolute position. + + [ pcvt now seems to be "VAX resistant" :-) ] + +- optional switch to screen 0 can be done on kernel/console output + +- fixed kernel output cursor positioning + +- removed PCVT_FORCE8BIT + +- pcvt_ext.c, changed screen switching bcopyb's to bcopy's + +- new patch from Onno to support all BIOS versions of the Cirrus chipset. + +- pcvt_x_hook() has to care about fkey labels now + +- updated Doc/NotesAndHints and Doc/BugList + +- applied patch from Onno van der Linden for updated Cirrus chipset support + +- updated Doc/Bibliography + +- removed paranoid delay()/DELAY() from vga_test() + +- added prototype ttrstrt() into pcvt_drv.c for NetBSD 0.9 + +- made INSTALLATION.NetBSD and INSTALLATION.NetBSD.bundled from mycrofts base + +- Charles Hannum took Michael Havemesters speedup modifications, made some + further enhancements and after adding support for pcvt, put it into + the NetBSD-current tree. THANK YOU, Charles ! + The NetBSD version of May 20th '94 was taken as the base for 3.10. + + +Changes 2.20 -> 3.00 March 1994 +-------------------------------------------------------------------------------- + +- Release 3.00 + +- last minute patch from Joerg (pcvt_hdr.h, BugList, NotesAndHints) + +- included speedup patch from Michael Havemester as Etc/LAST-MINUTE + +- updated Doc/pcvt.4 + +- removed bug in Util/ispcvt/Makefile which caused ispcvt to be installed + into /usr/sbin and /usr/local/bin + +- split ioctl VGAPCVTID into two: intro of ioctl VGAPCVTINFO for compile + time options only. + VGAPCVTID is now frozen for identification purposes (XFree86 3.0) + updated Util/ispcvt for the above mentioned changes + +- issued patch to upgrade beta14 to beta16 + +- bugfix: when scrolling up (bcopy) is interrupted by a keystroke requesting + a change of the current screen, the "new" screen is scrolled up. Fixed + in pcvt_kbd.c and pcvt_out.c (check_scroll) + +- fixed bug "Jumping through vt's with ALT-F12 does jump over vt0" + +- PCVT_PCBURST intro, update of ioctl and Util/ispcvt + +- NetBSD speedup patch from Michael Havemester (factor 6-10) + +- issued patch to upgrade beta14 to beta15 (never officially announced) + +- added patch for ttioctl parameters NetBSD-current 12 Feb 94 from Michael + Havemester in pcvt_drv.c + +- INSTALLATION.xxx(x)BSD upgraded to reflect changes in Util and NetBSD-current + +- struct pcvtid changed to hold the value of PCVT_xxx(x)BSD, ispcvt upgraded + +- applied patch from Szabolcs Szigeti for 132 column operation for Trident + TVGA 8900B and TVGA8900C based boards + +- PCVT_NETBSD can/must now be 1 or 09 for Release 0.9 and > 09 for current + +- applied patches from John Brezak and Szabolcs Szigeti for recent + NetBSD-current changes (syscframe -> trapframe) + +- in Util, removed Makefile.inc. Make Makefile.inc.FreeBSD and + Makefile.inc.NetBSD and added a check to the toplevel and every + other Makefile in this part of the tree. sigh ... + +- patch from Joerg for pcvt.4 Makefile and Debugger in FreeBSD + +- issued pcvt-beta14, code freeze for 3.00 release, just bugfixes now + +- INSTALLATION.FreeBSD and a small cleanup patch from Joerg + +- large patch from Joerg to get pcvt FreeBSD-current compliant + +- permission/owner cleanup, files:664, dirs:775, user:root, group:wheel + +- got rid of the verbose error message when installing in Util/fonts + +- new make-method in Util/kcon to workaround make portability problems + +- NetBSD-current detection workaroundaroundaround for NEW_AVERRUNNABLE in + pcvt_header.h + +- MONO_BUF and COLOR_BUF now ifndef'ed + +- fixed typo in pcvt_kbd.h in cfkey11() and cfkey12() + +- machine/pio.h must be included in pcvt_hdr.h for recent NetBSD-current + +- protected every tsleep call with an "if(curproc)" otherwise there is + chance to panic the system (Joerg has an idea why ...) + +- more fixes from Joerg: keyboard scansets fixed, X server is now aware + of redefined keys (ioctl implemented) + +- patch from Heiko Rupp, configuration with XSERVER not defined didn't compile + +- new version of vgaio from Joerg installed + +- large keyboard cleanup patch from Joerg merged in + +- bugfixes from Joerg: fix crash on not-open vt, remove pcxint, add option + PCVT_INHIBIT_NUMLOCK (for notebook owners :-), support for EGA/VGA + fonts with up to 32 scanlines. + +- included vgaio, a program to read/write vga register values from Joerg. + +- included mcon, the keyboard mouse emulator control program from Joerg. + +- applied averrunnable patch to satisfy the most recent NetBSD-current. + +- fixing cursor not updated bug if usl/vt server is running on vt0 + +- polished some chars in Util/fonts/vt220l.810, fixed all permissions in + the uuencoded fontfiles. + +- debugged the EGA/VGA curses based font editor 'fed' in Util/fed. It seems + it's working ok now now. + +- updated copyright header files + +- synchronize asynchronous cursor position update with having a valid + (new) cursor (row) position from sputc(). (Otherwise a cursor + would appear temporarily in the first position of the first + function key label in the HP mode) + +- updated screeninfo ioctl and scon to report the monitor type + +- added file Doc/Notes for random notes and hints for pcvt-users. + +- enhanced the pcvtid-ioctl and the ispcvt(8) utility to print out the + values of all "PCVT_XXXXXX" compile time options. + +- included work from Joerg to convert all ifdef's to if's, to be able + to compile various configurations of pcvt without changing + options in the header file. + +- included (currently untested !) patch for a keyboard mouse emulator + from Joerg. (he got problems after he bought a notebook with + just one serial port, which he wanted to use for slip ...) + +- screensaver reset is now also done asynchronously to get more speed. the + function average() was renamed to async_update(). + +- cursor position update and cursor position display in HP mode is now done + asynchronously in function average() in pcvt_sup.c. the function + update_cursor does no longer exist. this gave about 10..30% increase + in speed depending on the data cat'ed (termcap, kernel, 1Mb nulls) + +- HP function key emulation processing debugged, this has to be rewritten + to use a stack and a new parser. elm -K now works a bit more, the + display is not garbled anymore, but fkey strings do not work. + +- pcvt_vtf.c split off from pcvt_out.c, file got > 100k. Checked all + forward declarations in header and source files + +- 132 column support for Cirrus Logic CL-GD542X chipsets written by + Onno van der Linden, c/o vdlinden@fwi.uva.nl + +- keyboard scancode display (#define PCVT_SHOWKEYS) + +- printscreen keycode fix form Onno van der Linden + +- Util/Makefile.inc added .depend dependency for make depend + +- pcvt_ioctl.h is now installed into /usr/include/machine. + +- keyboard scancode 1 is now used by default, perhaps it cures some problems + +- support for keyboard scancodes sets 1 and 2 (compile time selectable via + PCVT_SCANSET), patch from Onno van der Linden, c/o vdlinden@fwi.uva.nl + +- Util/fontedit.c updated to "#if defined (__386BSD__) || defined (__NetBSD__)" + (suggested by Mark Weaver, Mark_Weaver@brown.edu) + +- 132 column support for S3 86c928 chipsets + +- split off pcvt_ext.c from pcvt_sup.c, it was more than 100k .... + +- intro of Doc/Manifest and Doc/TestedHardware, removed README.X-PATCH because + it was now really outdated + +- superprobe compatibility patches from Joerg + +- intro of file Doc/BugList + +- another powerpatch from Joerg: + - some vgaioctl's are now available if in X mode (i.e. to scon to + another screen from within an xterm) + - removed bug in keyboardhandling, numlock'ed numkeys did send an + additional null (0x00) char, this has been fixed now. + - SysRq key made functional + +- made force 24 lines (see below) the default configuration to have a well + behaving vt220 emulator at startup. + +- every vt now has a separate caps-lock, num-lock and scroll-lock flag and + a separate handling of these lock-keys. + +- made sleeping in case of scroll lock working from an earlier patch from Joerg. + +- large patch from Joerg: + - Doc/pcvt.4 updated to reflect recent changes + - struct winsize set ok when switching between HP/VT + - struct winsize pixels reflect real values now + - ioctl for switching between 80 and 132 cols + - 132 columns for generic VGA's + - updated scon to provide access to ioctl 80/132 col switching + +- removed pcconcoftc and kbdsoftc structures from header files, removed + pcconsintr variable and introduced kbd polling synchronization + variable kbd_polling. + +- merging Joerg's patch to support 132 columns on Tseng Labs ET3000 + +- moved Util/uemacs/* --> Etc/uemacs.tar.Z.uu + +- added patches from Joerg for new Makefiles in Util + +- added keyboard security define's to the new X server code + +- adding bugfixes from Joerg Wunsch for "old" (= non vt switching) X server + +- Control-Alt-Functionkey(1...12) switches now virtual screens/terminals to + behave consistently with xfree 2.0, also the pages are now checked + against the real no. of terminals available ALL the time ... + +- pcvt_hdr.h: changed "int pcstart();" to "void pcstart();" to avoid warning + message when compiling under NetBSD-current + +- Doc dir split into Doc and Etc, Support renamed to Util + +- adding NetBSD-current support for new X server support (syscframe changed + to trapframe in NetBSD-current as of 11/11/93) + +- adding Joergs changes for XFree86 2.0 multiple X server and/or terminal + session support + +- adding entries from patchkit 0.2.4 codrv keymap to Support/keycap/keycap.src + +- Keyboard security introduced into the XSERVER dependent part in pcvt_drv.c + +- renamed device files from /dev/ttycXX to /dev/ttyvXX + +- added file Doc/pcvt.el from Joerg Wunsch to distribution + +- added HP-mode function key map from Gordon L. Burditt to description + in Doc/Keyboard.HP + +- fixed bug in scon which prevents it from showing the correct status of + 132 column support of chipset + +- 132 column mode for Trident TVGA9000 works now, after 2 1/5 months of + calling everybody i eventually got a tech ref manual from Trident .... + +- it is now possible to "force" pcvt into a 24 line mode when operating + in pure VT mode with 25 lines or in HP mode with 28 lines. This + is sometimes necessary when running software which assumes it runs + on a "real" VT220 which has just 24 lines. + +- updated scon to support the 24 lines force mode (scon -f [ on | off ]) + +- soft reset fkey now positions cursor into left upper corner, update_cursor() + made global function + +- updated scon (-l) to print out additional info about the vga chipset, + family and 132 column support if VGA detected. + +- added additional fields to screeninfo structure in pcvt_ioctl.h to be + able to return information about current vga chipset. + +- moved VGA type/family definitions from pcvt_hdr.h to pcvt_ioctl.h + +- Terminfo and Termcap updated to support 132 columns + +- fixed bug in kcon which outputs garbage for remapped keys in kcon -l. + (reported by Gordon L. Burditt, gordon@sneaky.lonestar.org) + +- modified Makefile for Support/ispcvt to copy it for installation instead + of moving it .. + +- renamed /usr/share/misc/keycap -> /usr/share/misc/keycap.pcvt to + avoid nameclash with same file for codrv (Gordon Burditt) + +- security bit no longer ignored when initializing keyboard (see #define + PCVT_USEKBDSEC in pcvt_hdr.h, suggested by Terry Lambert) + +- cpufunc.h include made only for NetBSD (Gordon Burditt) + +- switch statement in pcvt_drv.c removed for 386BSD (Gordon Burditt) + +- Trident cursor size bug removed + +- keyboard initialization for ddb + +- added support for cursor on/of switching, screensaver and DECTCEM + +- removed explicit Hercules support, MDA = Hercules in this context now + +- patchkit from Joerg Wunsch (kbd-overlay malloc, scroll_sleep, clip fix) + +- ispcvt now installed into /usr/sbin + +- removed PCVT_NETBSD08 and PCVT_NETBSDCU, intro of PCVT_NETBSD + +- implemented 132 column operation for wd90c11 chipsets + +- PCVT_PREPATCH022 renamed to PCVT_NEEDPG + +- INSTALLATION.NetBSD written + +- DEVICE in kcon makefile changed from /dev/console to /dev/ttyc0 + +- new keyboard code in pcvt_kbd.c from NetBSD current + +- new /etc/rc.local script in INSTALLATION + +- implemented 132 column operation for et4000 chipsets + +- detection of super vga chipsets as a prerequisite for 132 col mode + +- switched to memory mapped virtual screen operation, configurable no. of + virtual screens, virtual screens now also on MDA and Hercules boards + + +Changes 2.10 -> 2.20 June 1993 +-------------------------------------------------------------------------------- + +- added new option -a to scon to get the video adaptor in scripts + +- support for NetBSD-current, define PCVT_NETBSDCU to enable it + +- Support for NetBSD 0.8, define PCVT_NETBSD08 in pcvt_hdr.h to enable it. + +- Change Support/Makefile to use instead of + +- Font editor for the EGA/VGA font-files added to support the design of new + fonts. One will need Zeyd M. Ben-Halim's ncurses library to compile it, see + file README.FIRST for information where to get it + +- Doc/INSTALLATION upgraded + +- Terminfo entry added to support Zeyd M. Ben-Halim's ncurses port + +- ispcvt is now installed in /sbin to have it at boottime if /usr is not + yet mounted. + +- applied a patch which prevents CAPS LOCK, SHIFT LOCK, and SCROLL LOCK + from being repeated (causing i.e a flashing CAPS LOCK led while + holding CAPS LOCK key down). + (diff from Gordon L. Burditt, gordon@sneaky.lonestar.org) + +- merging patches to support the pccons-model of X11 server support + (diff from Joerg Wunsch, joerg_wunsch@uriah.sax.de) + +- file pcvt_drv.c routine pg() enclosed in "#ifdef PCVT_PREPATCH022" to solve + multiple defined symbols beginning with patchkit 0.2.2 + (reported by Marko Karppinen, dreamer@purkki.apu.fi) + +- added british keycap entry into keycap source file + (from Andy Duplain, duplain@rtf.bt.co.uk) + + +Changes 2.00 -> 2.10 March 1993 +-------------------------------------------------------------------------------- + +- detecting the presence of video boards has been changed to ask the + BIOS "equipment byte" in the RTC-CMOS ram what's installed. this caused + many discussions but solved also many problems .... + +- driver name changed from "pc" to "vt" for multiple driver coexistence + (diff from Joerg Wunsch, joerg_wunsch@uriah.sax.de) + +- new devicenames recommended for showup in utils like "ps" + (many people suggested that ..) + +- new location for manual pcvt.0 + (diff from Joerg Wunsch, joerg_wunsch@uriah.sax.de) + +- new demo file "sgr.vt" to show available graphic renditions + +- intro of Doc/ChangeLog (this file) + +- fixed bug in Support/keycap/Makefile + (diff from Gordon L. Burditt, gordon@sneaky.lonestar.org) + +- make vttest (main.c) compile after applying patchkit-beta2 + +- screensaver fixed by Joerg Wunsch + +- screensaver now compiled in by default + +- made recognition of CONTROL-ALT-DELETE an optional #ifdef'ed feature + +- added sgr-conversion table for MDA adaptors + +- fixed sgr-conversion table for VGA monochrome environments + +- added support for using the kernel debugger + (diff from Bruce Evans, bde@runx.oz.au) + +- fixed several bugs regarding monochrome environments in pcvt_sup.c + +- fixed bug in scon preventing one from piping output though more + (reported by Gordon L. Burditt, gordon@sneaky.lonestar.org) + +- display current screen number in HP-mode in the bottom right of screen + +- changed names of all #define-able compile time options to start with + "PCVT_" for easy identification and installation into the kernel config file + +- applied another pcvt_kbd.c patchkit from Bruce Evans, bde@runx.oz.au. he + writes: + + These fixes are mainly related to ddb. sgetc has a weird interface that + has caused some bugs, and it was too easy for ddb to reenter itself. + + 1. Don't use char for keypad2num, char might be unsigned. Space is not + important since the array is small. + + 2. Don't use u_short for n. + + 3. Change some 0's to NULLs. + + 4. sgetc must not return NULL for the !noblock case. Only callers with + noblock set check for the null pointer. When the kernel follows a + null pointer, I think page 0 is sometimes mapped in so nothing bad + happens. The kernel panics if the page is not mapped in. + + 5. Reentrancy fix. The debugger really ought to check for reentrancy + itself, but the driver still needs to return early after the + debugger returns, so that it doesn't return a junk ESC from + ctrl-alt-ESC. + + 6. xlatkey2ascii may return NULL too. + +-------------------------------------------------------------------------------- diff --git a/usr.sbin/pcvt/Misc/Doc/CharGen b/usr.sbin/pcvt/Misc/Doc/CharGen new file mode 100644 index 0000000..c047bfa --- /dev/null +++ b/usr.sbin/pcvt/Misc/Doc/CharGen @@ -0,0 +1,149 @@ +Character Generator description (before it gets lost ..) +-------------------------------------------------------------------------------- + +The lower character generator is the default IBM character set II. + +The description of the higher character generator follows below. The +character names are taken from the "Postscript Language Reference +Manual", 2nd Edition, Fourth printing July 1991, pp 596. + +NOTE: The hex values here are NOT the values the character is identified + by in the emulator. The "physical" (vt220 character) to "logical" + (this table, character generator) conversion is done in the character + output routine by using the tables from file pcvt_tbl.h. + +The order of the characters is not regular and was largely influenced by +the status of my brain while pixel-placing characters .... + +HEX What +--- ------------------------------------------------- +00 Control code display for +. control characters in the +1f range 0x00 - 0x1f + +20 Control code display for +. control characters in the +3f range 0x80 - 0x9f + +HEX What +--- ------------------------------------------------- +40 rho +41 psi +42 partialdiff +43 lambda +44 iota +45 eta +46 epsilon +47 chi +48 logicaland +49 logicalor +4a union +4b propersuperset +4c propersubset +4d gamma +4e Xi +4f Psi + +HEX What +--- ------------------------------------------------- +50 Pi +51 arrowdblright +52 arrowdblboth +53 Lambda +54 Theta +55 congruent +56 gradient +57 Delta +58 proportional +59 therefore +5a integral +5b fraction +5c (inverted fraction ????) +5d angle +5e (inverted angle ????) +5f braceleftmid + +HEX What +--- ------------------------------------------------- +60 bracerightmid +61 bracelefttp +62 braceleftbt +63 bracerighttp +64 bracerightbt +65 radical +66 omega +67 (Yen ??) +68 xi +69 yacute +6a thorn +6b eth +6c Thorn +6d Yacute +6e multiply +6f Eth + +HEX What +--- ------------------------------------------------- +70 threequarters +71 Cedillasmall +72 Acutesmall +73 emdash +74 registered +75 endash +76 logicalnot +77 dieresis +78 notequal +79 scan 9 +7a scan 7 +7b scan 5 +7c scan 3 +7d scan 1 +7e upsilon +7f emptyset + +HEX What +--- ------------------------------------------------- +80 oe +81 Otilde +82 atilde +83 Ydieresis +84 Ucircumflex +85 Uacute +86 Ugrave +87 Oslash +88 OE +89 Otilde +8a Ocircumflex +8b Oacute +8c Ograve +8d Idieresis +8e Icircumflex +8f Iacute + +HEX What +--- ------------------------------------------------- +90 Igrave +91 Edieresis +92 Ecircumflex +93 Egrave +94 Atilde +95 Acircumflex +96 Aacute +97 Agrave +98 onesuperior +99 (small black rectangle) +9a zeta +9b threesuperior +9c copyright +9d currency +9e kappa +9f (inverted question mark) + +HEX What +--- ------------------------------------------------- +a0 the remaining positions +. are used for the vt220 +ff downloadable characterset + +------------------------------------------------------------------------------- + (phoooo ..) diff --git a/usr.sbin/pcvt/Misc/Doc/Charsets b/usr.sbin/pcvt/Misc/Doc/Charsets new file mode 100644 index 0000000..b30dd8a --- /dev/null +++ b/usr.sbin/pcvt/Misc/Doc/Charsets @@ -0,0 +1,99 @@ + +I. Character Set Selection on VT220 Terminals +================================================== + + +name C0 GL C1 GR + +---+ +-------------------+ +---+ +-------------------+ + |00h| | | |80h| | | +range | | | | 20h .. 7fh | | | | | a0h .. ffh | + |1fh| | | |9fh| | | + +---+ +-------------------+ +---+ +-------------------+ +length 32 96 32 96 + + /\ +SECOND /||\ "lock"- or "single"-shift one set of G0, G1, G2 or +STEP || G3 into one of the "displayable" charactersets GL + || or GR. (escape) sequences are: SI, SO, ESC ~, ESC n, + || ESC }, ESC o, ESC |, ESC N and ESC O. + + +----+ +----+ +----+ +----+ +name | G0 | | G1 | | G2 | | G3 | +length |(96)| |(96)| |(96)| |(96)| + +----+ +----+ +----+ +----+ + + /\ + /||\ designate a hard or a soft character set as + || one of G0, G1, G2 or G3, used escape sequences +FIRST || are, ESC ( X, ESC ) X, ESC * X and ESC + X - where X is +STEP || B for ascii, < for supplemental, 0 for special, A for + || british, 4 for dutch, C and 5 for finnish etc. etc. ... + || + + +-----+ +------------+ +--------+ +-----------+ +------------+ +name |ascii| |supplemental| |special | | national | |downloadable| + | | | graphics | |graphics| |replacement| |characterset| +length | (96)| | (96)| | (96)| | (96)| | (96)| + +-----+ +------------+ +--------+ +-----------+ +------------+ + + \-------\ /----------/ norway/danish + | dutch + together, this is also finnish + referred to as the french + multinational character french canada + set (power on default german + on a dec vt220) italian + spanish + swedish + swiss + + +II. Emulating Character Set Selection +========================================= + +MDA/HCG/CGA: + + just a partial emulation is done, because these boards don't allow + downloadable charactersets. some characters simply don't display + because they are not in the characterset roms on the video board. + + if you want to change the mapping, have a look at the default tables + in pcvt_tbl.h. + +EGA/VGA: + + these cards have provisions for downloadable charactersets and so + many vt220/vt320 charactersets are fully supported: + + - US Ascii + - DEC Supplemental + - DEC Special Graphic + - DEC Technical + - ISO Latin-1 + - Downloadable + + when the emulator is started, it behaves initially similar to + the MDA/CGA/HCG method described above. + + when a second (special) characterset for a given screen resolution + is loaded via the "loadfont" utility, the emulator detects this fact + and uses from then on extended tables to access the second charset + as an upper half 512 characterset in terms of ega/vga speak. + + from this time on, vt220 downloadable fonts are usable. + + the organization of this extended characterset is as follows: + + 0x00 ... 0x1f C0 display function fonts + 0x20 ... 0x3f C1 display function fonts + 0x40 ... 0x9f fonts for DEC Supplemental, DEC Special + Graphic, DEC Technical and ISO Latin-1 + 0xa0 ... 0xff VT220 Downloadable Font + + the mapping between vt220 charactersets and the charactersets inside + the ega/vga is done by tables found in the file pcvt_tbl.h. + + there is a MSDOS fonteditor called "EVAFONT" available on the + SIMTEL-20 archive, which i used to edit the character sets in the + distribution. + diff --git a/usr.sbin/pcvt/Misc/Doc/EscapeSequences b/usr.sbin/pcvt/Misc/Doc/EscapeSequences new file mode 100644 index 0000000..8e0e2c7 --- /dev/null +++ b/usr.sbin/pcvt/Misc/Doc/EscapeSequences @@ -0,0 +1,268 @@ + Control Codes and Escape Sequences supported by pcvt +=============================================================================== + +CONTROL CODES +------------------------------------------------------------------------------- + + NUL (0x00) ignored + SOH (0x01) ignored + STX (0x02) ignored + ETX (0x03) ignored + EOT (0x04) ignored + ENQ (0x05) ignored + ACK (0x06) ignored + + BEL (0x07) beep + + BS (0x08) move one character position to the left + until at left margin + + HT (0x09) move to next tab stop + + LF (0x0a) move to next line, same column + VT (0x0b) move to next line, same column + FF (0x0c) move to next line, same column + + CR (0x0d) move to left margin on current column + + SO (0x0e) invoke character set G1 into GL + SI (0x0f) invoke character set G0 into GL + + DLE (0x10) ignored + DC1 (0x11) ignored + DC2 (0x12) ignored + DC3 (0x13) ignored + DC4 (0x14) ignored + NAK (0x15) ignored + SYN (0x16) ignored + ETB (0x17) ignored + + CAN (0x18) abort current escape sequence + + EM (0x19) ignored + + SUB (0x1a) abort current escape sequence + + ESC (0x1b) start of escape sequence + + FS (0x1c) ignored + GS (0x1d) ignored + RS (0x1e) ignored + US (0x1f) ignored + + VT220 control codes in the range 0x80 .. 0x9f are completely ignored, + but displayed as C1 display controls. + + +ESCAPE SEQUENCES DIGITAL EQUIPMENT +------------------------------------------------------------------------------- + +(ni) = not implemented yet, all hooks available inside emulator! +

= numeric parameter + + ESC space F select 7-bit c1 control transmission (ni) + ESC space G select 8-bit c1 control transmission (ni) + + ESC # 3 double height top half (ni) + ESC # 4 double height bottom half (ni) + ESC # 5 single width single height (ni) + ESC # 6 double width single height (ni) + + ESC # 8 fill screen with 'E's + + ESC 7 save cursor + + ESC 8 restore cursor + + ESC = keypad application mode + + ESC > keypad numeric mode + + ESC D index + + ESC E next line + + ESC H set tab at cur col + + ESC M reverse index + + ESC N single shift G2 + + ESC O single shift G3 + + ESC Z who are you + + ESC d Only available if PCVT_SETCOLOR was defined when + compiling the kernel, allows to set custom color table + for more info, see pcvt_out.c ... + + ESC c power up reset + + ESC n Lock Shift G2 -> GL + + ESC o Lock Shift G3 -> GL + + ESC } Lock Shift G2 -> GR + + ESC | Lock Shift G3 -> GR + + ESC ~ Lock Shift G1 -> GR + + ESC [ ?

h set dec private modes + ESC [ ?

l reset dec private modes + 1 CKM - cursor key mode + 6 OM - origin mode + 7 AWM - auto wrap mode + + ESC [

' z DECELR - Enable Locator Report (ni) + + ESC [

' { DECSLE - Select type of locator events (ni) + + ESC [ ? n Terminal Reports + + ESC [ ? K selective erase in line + + ESC [ ? J selective erase in display + + ESC [

@ insert char(s) + + ESC [

A cursor up + + ESC [

B cursor down + + ESC [

C cursor forward + + ESC [

D cursor backward + + ESC [

H cursor direct cursor addressing + + ESC [

J erase screen + + ESC [

K erase line + + ESC [

L insert line + + ESC [

M delete line + + ESC [

P delete char + + ESC [

S scroll up + + ESC [

T scroll down + + ESC [

X erase character + + ESC [

c device attributes + + ESC [

f direct cursor addressing + + ESC [

g clear tabs + + ESC [

h set mode + ESC [

l reset mode + 4 IRM - insert replacement mode + 20 LNM - line feed / newline mode + + ESC [

i media copy (ni) + + ESC [

m select graphic rendition + 0 reset to normal attributes + 1 bold + 4 underline + 5 blinking + 7 reverse + 22 bold off + 24 underline off + 25 blinking off + 27 reverse off + 30-37 foreground colors (on color display) + 40-47 background colors (on color display) + + ESC [

n device status report + + ESC [

r set scrolling region + + ESC [

x request / report terminal parameters + + ESC [

y invoke selftests (ni) + + + ESC [ x request/report parameters + ESC [ y invoke seftest(s) + + ESC [ " q SCA + ESC [ ! p SCA + + ESC (

designate G0 + ESC )

designate G1 + ESC *

designate G2 + ESC +

designate G3 + ESC -

designate G1 (96) + ESC .

designate G2 (96) + ESC /

designate G3 (96) + A British or ISO-Latin-1 + B USASCII + C Finnish + 5 Finnish + E Norwegian/Danish + 6 Norwegian/Danish + H Swedish + 7 Swedish + K German + Q French Canadien + R French + Y Italian + Z Spanish + 0 special graphics + 1 alternate ROM + 2 alt ROM, spec graphics + 3 HP Roman 8, upper 128 chars*/ + 4 Dutch + < DEC Supplemental + = Swiss + > DEC Technical + + +ESCAPE SEQUENCES HEWLETT-PACKARD +------------------------------------------------------------------------------- + +ESC&fakdL

.X?9WV1-`4OEM>7D/KERA^,K/I!EFJ@,]BTB08_-,44'X7/9\D][L8`FE +M?(+NA)1GZBZ!JT#*WHOFFW&5W3+B'N5"[&R_(.S[DZH8RD+ +MZ(1X(2E%EQD`,\NRT*FP.R28W)<7K5H(.Q^@,;`F2R>B3&@IK!'='//5D%;M +M`#(Q9]R*1OD,),>$BV9H>BO(2&)-6@-)84&T!F@&BUG:JWNI1UY.4@KD-5)6 +M7B*Q\*1Y+BAT^!KY][=ETFMD:X(+K8D`()*WT"T)HC/*_341RTE!-;Y"5G57 +M)DDPKW,01U[DK%"B@Q@T5GJQO"0.`Y!C_XJY*HJ&#V(4Q"AFG:$F:RFE2$1XLOR_K`$P6=%R'"NZTL]RO.*6!ZN@EZ+RIIGEG_# +MBM9[*5=S0E#MC@@O0=$E^":PE=D&F>7R0LZ_/2DW;2&VD?)%'^)Y(K +M4.YV$L*'`K=@=A&F2>N@C.*SD>2]8X8"R3IPHYJCANR_`'>)$@-AAN-^TM7_ +M*B^O!5/C4OE9J,TX`:N +M*/8>A$XLY<8R"[#&(8/NEK%IP*E&-%LDZ1/Y(BB5Y["3B&6EDR7/Q`H/][>&UR>IFR3.>5LXFA[W><9MB?:PB +M/Q:+U90T^\WB#XNK;G'UM\6W?UG\KEY<_4GY_%E?M +MFM%NN;B2N_WBJMY=+ZY6:U9W2T*(OJ?UFJXTBM@MS:NZ8/?++^9.OVQ*KWTI +M7=-6R^B&*@.UL<7?_C`GJ83!8VO:6'`+T+]VK36B?$U5;,M6T6AT[?'FJ2:\Z[=X?#V\/AO?Y3F3^-U.YP^'`X +MO)[;*E18)7.8UU:(\JXZN.OC86/_-__IUQK3?8^ZXJ/^H^V[3\,?7H?NTIVN +M.JV256AE_K`OSVSGT^[/KJ-67?63[18FNMK:R9INOJ^?UM[4IL=,Y0O7,\*6"M.U04B7MMU%P"*NF^ON +MPHY'8\;,4"R07A>UH:BZ<86Z-W2]C6&YM<$*T;58:S.B6!/%$KFVVWR*@BT4 +MG`6;2-`^F*JM=Z@J04U@FVYSF>`V$)=46R0HQCQJOZ'BH,&KK-E)C)*H+ +M1F0E@#$HD15&9(V<&L,18ZR7Q2J#L9C*8$]*(\EQF.-G-HC4!^O5U/B@K.5IZ'$J"TYL`KUT1+C +ML63`*I3'$N.Q1DZMHHA5UJ^3L(0YJP1&;5D#JU#O+##O+%:I50(EK\#(*]K4 +M*M&>\G]NK/2"/)Q<`F.V:%+[!.J>!>:>A0+VH606&)D%B#?$B7BC\?&&CI&3 +MD$]#8S07(.X0J+L6&*<%B#L$RFF!<5J`N$,PU#,ZX\PHTD!)C.8"1!P"==<< +MX[0`$8=`.A!D>YS#$NC#NWE_7A9IIJM +ME]\#<8SA'$0?'/7:'*,S!]$'1^G,,#IS$'WP^HGX-]EWSGOS&$9U!F(/-J!Z +M]:;7#F,U`[$'&["Z.O0`&*L9B#U8DP%(]V/&SK!6LS'17SM,$($P-<8,6HU) +M?7`((`1A`U)7V^V;D!;A&`*(01ADM:Y?V3R+QIGY328)@;$WCF'`(!!A?`3\ +MV@,[F#&QW4Z:@7"$L1',P<&X_3C#Z,U`4,(H!M,GXGS\'P-)BA&?@=B$U:>@ +M7_=4IQC5*8A4Z&H$MXMPAPB'$9^"N(6V([CE`&X6R#M(Y%!L9E`0N]#AS"`C +M53&_3T$,0^%TT+\J$E7=13C,X5,0T5`YA"-5A%LF0]XGB^HX]MB:0$%H0\5( +MY4?71LQB46QUH"#(H1RW/DV*46Q!H"#DH0RW'J;*W(8W67(H-J4H"(`HS8U[ +MLWOL@;#Y0T$<1.L\3C09FS@@&EKE\FV)I318*D)TM%IC4P@$1.U8/;^OQQ)+ +M(*^$2:-I%["EQR,\'O,4-J>4+*KH]A5LJ3#%T*`>!*^8-!H*@5CAJ?2+,"M; +M/Q=6F@4WK#Y= +MAK8)F3BC?S)YKJRV\<&5LMUN=+_NGZ3042+?/E+9I/*Z6Z[GB03)BGP:RD`A +MUS%1;!Z?WFSFGVN)906$W6*XAC!!EN2%R4@Z&G,9[&%Y:89)LZZZW`2C1NE_ +MM>9Y/([A<8/7:R/RT@*3%L`6F9>6F+1,;<&R_FJM\K`*@U7`I"8OW6#2#3"I +M3:3]RADQ6@RC30T[D?)7ZU7$7UR]U#\1?>70W4.\E;/)53"DJWO!N1.T/X%[ +M=>>6O*2T,:65=SK*+-@>(!%/6J>6O^$%(TV-"KXQD.M7)KX@*8R3D9ER`\2Z +MR[1$N6@G(STL=@\S!V7*Q5VQK.KCS?X!]!AF(.)&:ISP5RYP!,@IM,Q`IP*] +MCU#=`.)E@J(R*+V`?;#K#37T`1`I2I-!<0*;3\FPG1ISW(QP% +M3&WR^C2I/KGHK>D&$=0@TZ],"C\+W3X%W0)#-=%?9U#6F'2JAO'NIGTOC+/-;/(#8;<`*O:O'2+2;?`JE5> +M>H5)K[KQ-BMF]95Y")T#E!B599T:(_.LE1AK)4V-D7G62HRUDD5CQDE\98X) +M9/$P'DL.;,F356)DU2^DMN3)*C&R2@GF4!+FR3QQ)49<":(*F2>GQ,@I07PA +M\^24&#EE"R?-(-VNS/F:+"#&5PE""Y4GI\+(J4!DH?+D5!@Y%85#,LJ@*W,> +M*@N),5:!@$+E^:DP?BH01J@\/Q7&3Y4&#^.4N#)'UK*`&&45"!E4GJ8*HZD" +M@8+*TU1A-%4-C&4'66]E#A-F`3'F*A`6J#Q-%493!<*!)D_3!J-I4\-H!\UZ +M*W,$-`N-<;@!84&3IVN#T;4!84&3IVN#T;6!8<$XZZW,:=TL),;A!@0$C819 +M+"_<\[4Q]\8`7UVE2:E06[GHWU2V*_X<9+F5.2,=I**0H:63,3ST\&W,/(5Z +M;GEMS(W/3S4A./(WC;FI/I4SZ^7,>CFS7LZLES/KYSJR7,^OES'HY +MLU[.K/];G%F?7EWU(::XW_4_+-SK^UN'LAW1->PKPU; +MN";XM?0M..A7#^^J!-IAZI>J$2:Y/R*(Q_M$:8>IUP_O<+6*J<:)&8AZ^_W]O7E#O!Z1^_N]`WO7C\[K`+7KB]Z34]7001K"7 +M.?P4;S789T)$C@0MME^HQ3/&,0_SU6.7`WWFB.5T@X2'ND&]44!-I<-KHL?L +MZ&99'+T/'SY$0N1$39:%'`_W^Y17]X>C?L'D)]:T/FI/8E,L6_/Q%?JW+K>Y +MET?SL1;FMZO0=MN#K=%VYI&A3>(\$EO'W+A*C:[TT=9J=*T/MEJC7W58]LY5 +M-!_8\-'AF8]K^.`0E:G@,-VMJRQC91DKRUA9)I5%K"QB91$KBZ0RCY5YK,QC +M99Y49K$RBY59K,R2RC16IK$RC95I4KF.E>M8N8Z5ZU#9[M&7ILS\M@N**[#[ +MZZ5?.EV1W_93D\0RJY"M0H(P,6UX$!TZA*V_K>Q`[&>0.!028"!*A%^ZX-BA +M!`S:[_EW2Y+`DJ77>X`Z!/6QF[/&H#N-`JYF=E0V!0.&!U!35Z7U/#CH(M=( +M8JWOA]";H:/)4-.T,WEH+BJ:Z$7ZL?(8RZ`8Z85[*D.&HDMAUH6;C*YXV +MMN_0H.9#:".Q:17T:U/&^"R#WJ6ER_](=W*"`D8.N +M3`9KU6'D3V?JA<4]BV +M>#S:#[<1)H.ES3N>;6X+DS&Y=]=7S_6@NM.<=ZGBYW$!KD4=3H;.TA'F<5K? +MX)NI;5]H(NQT:SIZM9>^.X3B?Y'#J,,9IUVOA=,D%)_5B\QF#EZ3QOO),!NU +M#GV8OW>%37=!YON*;&;G\32N%=5=;$RS03/CQ5USK`OJF4^(,G[6N2A]Q?ZJN]'V:G8.%Q:FR(5IXL*U=!$T;+I4P43)(&5[;.,$ +M-U&_Z!2F=("VQ=`;&]-FU-/K>!\NY_-[[GGKQESSX=\4SC*T9?H$$$ZKYU5+ +M)N-]JAY)R'<1]7MXAI<-'GM#`-V866_[T*57RZF4[K^]6MS4OS#]Y90*L)&. +M:3?"T9[,?P<]@BT;G*S,KO22F)@:Z/>"P42NH4]2N85;A&>L$:$9S3W? +M?H53F9F,L!NBX]&U9^(Q.&CALP^Y/QVL8)W#X3"-9XP(O0"%_(FDQ&[L5;QUZGE]Y@-S,[-0F^L-O0=7V#?W*O@M +M=:^!WT'W"M"H@'GH8BP/XWW1!3[8X!7QBI6]?)(1HK)5V=J7S/OJO[,S74;8S>Y#.LCD@XG(D_@"3 +M39W8+%#??K@U2(;*?KHD/N=YGH&Z!T$Z@CUU!?L:YSA4=L$-9.WPZC-C$ +MF4U\]5:HQ`KS6:4D,<+=YQS-:3_CDW-D=_`).[(]^.2<33:I_LZU&AQ)<&&P +M"[_,%_GT(=GYA*(Y&&;3A]Y>=^,Z[L(/3*!-11)-+K[$U?BT)O%I3N+3FL2G +M.4EH<4-27]V3P;!R\R6>91[>C^3>1_4-)R_O;F^/#[\UG>_>=_6-Z,O\!P@' +MMEP`KEZ$?MWX->YS/4D8O4T8N,J^N.E[:O,EOB%R(6EX$[G\C%D^[=2<>HJ< +M@_K3TWI:VA82%A(6$A82%A(6$A82%A(6$A82%A(6$OY'DM!]+-E_+;Z1=D^> +M_/'KIV>][@N7,$.XOYZ>OK&UI3L!&DZ"FM.:T_,[-O=(R+IUZ/L'V!D=NEV=Q^6E[B7G: +MP.EG'&C+GZ&U#XW./QVS[9UE+F*FG6$>XKUXIEF7;_!\,PYI[DS3#31VAKG6 +M+?[^E/.:;K*EC7VVLYYP\O7MXVO3=-.O;VR\[)+))Z!N[$PS+2)/.Z52W.GF +M3HIZKA4IOP*>:TG*+W]E32IKTI/+Q*33ZBG'>9Y5Z93OG'!5.MMR4R90F4#D +M\P@]]00J\^2I1?0_<*(LKH[_'BDZ8?#F+U[\[=7;:NH)X.#;;OZ/[6TUZ328 +MGO^3$G]29MM>U`7S%S_<;K_;8P\6N9:+^48?[B +MO^]NWA4?^?7$E(:8F_=O"S$G(*;=[+Z:GI?VJQ7FKQZJ8OCJ_^]_;[0M")SA,53GX5)QN?/_CQ[?2,M%\Z-;^I"CFG +M(F?C0KH7^[>WOZ\F)ZO]+JKYW?[X<%N5MQ,4BOX*_&?C4A,O]O=G8J3];JWY +M[=NJL+.P\U>PNCR? +LK:O,4Y_?D[\>]SORP^WQS>WV]N?PK-K59 0) + { + normal_ch(r,c); + c--; + } + break; + + case K_DOWN: + case KEY_DOWN: + if(r < (ch_height-1)) + { + normal_ch(r,c); + r++; + } + break; + + case K_UP: + case KEY_UP: + if(r > 0) + { + normal_ch(r,c); + r--; + } + break; + + case K_RIGHT: + case KEY_RIGHT: + if(c < (ch_width-1)) + { + normal_ch(r,c); + c++; + } + break; + + case KEY_HOME: + normal_ch(r,c); + c = r = 0; + break; + + case KEY_LL: + normal_ch(r,c); + c = ch_width-1; + r = ch_height-1; + break; + + case 0x0c: + wrefresh(curscr); + break; + + case '\n': + case '\r': + case ' ' : + chg_pt(r,c); + break; + + case 'q': + pen = UP; + normal_ch(r,c); + wrefresh(ch_win); + return(1); + break; + + case 'x': + pen = UP; + normal_ch(r,c); + wrefresh(ch_win); + return(0); + break; + + case 'w': + case 'W': + setchr(WHITE); + break; + + case 'b': + case 'B': + setchr(BLACK); + break; + + case 'i': + case 'I': + invert(); + break; + + case 'r': + setrow(WHITE); + break; + + case 'R': + setrow(BLACK); + break; + + case 'c': + setcol(WHITE); + break; + + case 'C': + setcol(BLACK); + break; + + case 'u': + case 'U': + pen = UP; + break; + + case 'd': + case 'D': + pen = DOWN; + break; + + default: + beep(); + break; + + } + } +} + +/*---------------------------------------------------------------------------* + * + *---------------------------------------------------------------------------*/ +void normal_ch(int r, int c) +{ + char l = ((mvwinch(ch_win,(r+1),(c+1))) & A_CHARTEXT); + wattroff(ch_win,A_REVERSE); + if(pen == DOWN) + mvwprintw(ch_win,(r+1),(c+1),"*"); + else + mvwprintw(ch_win,(r+1),(c+1),"%c",l); + wmove(ch_win,(r+1),(c+1)); +} + +/*---------------------------------------------------------------------------* + * + *---------------------------------------------------------------------------*/ +void chg_pt(int r, int c) +{ + char l; + l = ((mvwinch(ch_win,(r+1),(c+1))) & A_CHARTEXT); + if(l == WHITE) + l = BLACK; + else + l = WHITE; + mvwprintw(ch_win,(r+1),(c+1),"%c",l); + wmove(ch_win,(r+1),(c+1)); +} + +/*---------------------------------------------------------------------------* + * invert current character + *---------------------------------------------------------------------------*/ +void invert(void) +{ + int r,c; + + r = 1; + + while(r <= ch_height) + { + c = 1; + while(c <= ch_width) + { + if(WHITE == mvwinch(ch_win, r, c)) + mvwaddch(ch_win, r, c, BLACK); + else + mvwaddch(ch_win, r, c, WHITE); + c++; + } + r++; + } +} + +/*---------------------------------------------------------------------------* + * fill current character black/white + *---------------------------------------------------------------------------*/ +void setchr(char type) +{ + int r,c; + + r = 1; + + while(r <= ch_height) + { + c = 1; + while(c <= ch_width) + { + mvwaddch(ch_win, r, c, type); + c++; + } + r++; + } +} + +/*---------------------------------------------------------------------------* + * set current row to black/white + *---------------------------------------------------------------------------*/ +void setrow(char type) +{ + int r,c; + + getyx(ch_win,r,c); + + c = 1; + + while(c <= ch_width) + { + mvwaddch(ch_win, r, c, type); + c++; + } +} + +/*---------------------------------------------------------------------------* + * set current column to black/white + *---------------------------------------------------------------------------*/ +void setcol(char type) +{ + int r,c; + + getyx(ch_win,r,c); + + r = 1; + + while(r <= ch_height) + { + mvwaddch(ch_win, r, c, type); + r++; + } +} + +/*---------------------------------- E O F ----------------------------------*/ diff --git a/usr.sbin/pcvt/fed/fed.c b/usr.sbin/pcvt/fed/fed.c new file mode 100644 index 0000000..d2fa4f3 --- /dev/null +++ b/usr.sbin/pcvt/fed/fed.c @@ -0,0 +1,168 @@ +/* + * Copyright (c) 1992, 1993, 1994 by Hellmuth Michaelis + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Hellmuth Michaelis. + * 4. The name of the developer may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * fed.c, 3.00, last edit-date: [Sun Jan 2 20:08:45 1994] + */ + +/*--------------------------------------------------------------------------- + * + * fed.c font editor main file + * ------------------------------------- + * + * written by Hellmuth Michaelis, hm@hcshh.hcs.de + * + * -hm first public release + * -hm activating font save + * + *---------------------------------------------------------------------------*/ + +#define FED + +#include "fed.h" + +void main(int argc, char *argv[]) +{ + int i; + int row, col; + int ret; + + if(argc != 2) + { + fprintf(stderr,"EGA/VGA Fonteditor, Rel 1.00\n"); + fprintf(stderr,"usage: %s \n",argv[0]); + exit(1); + } + + readfont(argv[1]); /* read fontfile into memory */ + + initscr(); + cbreak(); + noecho(); + nonl(); + keypad(stdscr,TRUE); + idlok(stdscr, TRUE); + + move(0,0); + standout(); + addstr(" Interactive EGA/VGA Fonteditor - (c) 1993, 1994 Hellmuth Michaelis "); + standend(); + +/* character horizontal ruler */ + + move(WINROW-1, CHCOL + ((WIDTH16 - ch_width)/2) + 1); + if(ch_width == WIDTH16) + addstr("1234567890123456"); + else + addstr("12345678"); + +/* charcater vertical ruler */ + + for(i=1; i < ch_height+1; i++) + mvprintw((WINROW+i), (CHCOL + ((WIDTH16 - ch_width)/2) - 2), "%2d", i); + + +/* select horizontal ruler */ + + move(WINROW-1,SETCOL+2); + addstr("0 1 2 3 4 5 6 7 8 9 A B C D E F "); + +/* select vertical ruler */ + + for(i=0; i<10; i++) + mvaddch((WINROW+i+1),(SETCOL-1),(i+'0')); + for(i=0; i<6; i++) + mvaddch((WINROW+10+i+1),(SETCOL-1),(i+'A')); + +/* label available commands window */ + + move(WINROW-1,CMDCOL+1); + addstr("Commands"); + + refresh(); + +/* command window */ + + cmd_win = newwin(((WSIZE)+(2*WBORDER)),(CMDSIZE+(2*WBORDER)), + WINROW,CMDCOL); + keypad(cmd_win,TRUE); + idlok(cmd_win, TRUE); + box(cmd_win,'|','-'); + + sel_mode(); + +/* character font window */ + + ch_win = newwin((ch_height+(2*WBORDER)),(ch_width+(2*WBORDER)), + WINROW, CHCOL+((WIDTH16 - ch_width)/2)); + keypad(ch_win,TRUE); + idlok(ch_win, TRUE); + + box(ch_win,'|','-'); + wrefresh(ch_win); + +/* character select window */ + + set_win = newwin((WSIZE+(2*WBORDER)),((WSIZE*2)+(2*WBORDER)), + WINROW,SETCOL); /* whole character set */ + keypad(set_win,TRUE); + idlok(set_win, TRUE); + + box(set_win,'|','-'); + + row = 0; + col = 0; + + for(i=0; i<256; i++) + { + mvwprintw(set_win,row+1,col+1,"%02.2X",i); + if(++row > 15) + { + row = 0; + col += 2; + } + } + wmove(set_win,1,1); + wrefresh(set_win); + +/* start */ + + clr_cmd(); + + curchar = 0; + + if((ret = selectc()) == 1) + { + writefont(); + } + endwin(); +} + +/*---------------------------------- E O F ----------------------------------*/ diff --git a/usr.sbin/pcvt/fed/fed.h b/usr.sbin/pcvt/fed/fed.h new file mode 100644 index 0000000..0911d37 --- /dev/null +++ b/usr.sbin/pcvt/fed/fed.h @@ -0,0 +1,127 @@ +/* + * Copyright (c) 1992, 1993, 1994 by Hellmuth Michaelis + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Hellmuth Michaelis. + * 4. The name of the developer may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * fed.h, 3.00, last edit-date: [Sun Jan 2 20:10:31 1994] + */ + +#include +#include +#include +#include + +#ifdef FED + +int ch_height; +int ch_width; + +int curchar; + +WINDOW *ch_win; +WINDOW *set_win; +WINDOW *cmd_win; + +#else + +extern int ch_height; /* current fontfile character dimensions */ +extern int ch_width; + +extern int curchar; /* character being edited */ + +extern WINDOW *ch_win; /* windows */ +extern WINDOW *set_win; +extern WINDOW *cmd_win; + +#endif + +#define FONTCHARS 256 /* no of chars in a fontfile */ + +#define WHITE ('.') +#define BLACK ('*') + +#define K_UP 0x10 /* ^P */ +#define K_DOWN 0x0e /* ^N */ +#define K_RIGHT 0x06 /* ^F */ +#define K_LEFT 0x02 /* ^B */ + +#define WINROW 3 +#define CMDCOL 3 +#define CHCOL 20 +#define SETCOL 41 +#define WSIZE 16 +#define CMDSIZE 12 +#define WBORDER 1 + +/* fonts */ + +#define WIDTH8 8 /* 8 bits wide font */ +#define WIDTH16 16 /* 16 bits wide font */ + +#define FONT8X8 2048 /* filesize for 8x8 font */ +#define HEIGHT8X8 8 /* 8 scan lines char cell height */ + +#define FONT8X10 2560 /* filesize for 8x10 font */ +#define HEIGHT8X10 10 /* 10 scan lines char cell height */ + +#define FONT8X14 3584 /* filesize for 8x14 font */ +#define HEIGHT8X14 14 /* 14 scan lines char cell height */ +#define WIDTH8X14 8 /* 8 bits wide font */ + +#define FONT8X16 4096 /* filesize for 8x16 font */ +#define HEIGHT8X16 16 /* 16 scan lines char cell height */ + +#define FONT16X16 8192 /* filesize for 16x16 font */ +#define HEIGHT16X16 16 /* 16 scan lines char cell height */ + + +void edit_mode ( void ); +int edit ( void ); +void normal_ch ( int r, int c ); +void chg_pt ( int r, int c ); +void invert ( void ); +void setchr ( char type ); +void setrow ( char type ); +void setcol ( char type ); +void main ( int argc, char *argv[] ); +void readfont ( char *filename ); +void dis_cmd ( char *strg ); +void clr_cmd ( void ); +void save_ch ( void ); +void move_ch ( int src, int dest ); +void xchg_ch ( int src, int dest ); +void display ( int no ); +void sel_mode ( void ); +int selectc ( void ); +void normal_set ( int r, int c ); +int sel_dest ( void ); +void normal_uset ( int r, int c ); +void writefont( void ); + +/* ------------------------------ EOF ----------------------------------- */ diff --git a/usr.sbin/pcvt/fed/misc.c b/usr.sbin/pcvt/fed/misc.c new file mode 100644 index 0000000..c6707ba --- /dev/null +++ b/usr.sbin/pcvt/fed/misc.c @@ -0,0 +1,353 @@ +/* + * Copyright (c) 1992, 1993, 1994 by Hellmuth Michaelis + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Hellmuth Michaelis. + * 4. The name of the developer may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * misc.c, 3.00, last edit-date: [Sun Jan 2 20:09:21 1994] + */ + +/*--------------------------------------------------------------------------- + * + * misc.c font editor misc routines + * ----------------------------------------- + * + * written by Hellmuth Michaelis, hm@hcshh.hcs.de + * + * -hm first public release + * -hm writefont routine + * + *---------------------------------------------------------------------------*/ + +#include "fed.h" + +#include +#include +#include +#include + +static unsigned char *fonttab; /* ptr to font in core memory */ + +static char *bitmask[] = { + "....", /* 0 */ + "...*", /* 1 */ + "..*.", /* 2 */ + "..**", /* 3 */ + ".*..", /* 4 */ + ".*.*", /* 5 */ + ".**.", /* 6 */ + ".***", /* 7 */ + "*...", /* 8 */ + "*..*", /* 9 */ + "*.*.", /* A */ + "*.**", /* B */ + "**..", /* C */ + "**.*", /* D */ + "***.", /* E */ + "****", /* F */ + NULL }; + +static char lfilename[1024]; /* current filename */ +static unsigned int lfilesize; /* current filename's size */ + +/*---------------------------------------------------------------------------* + * read fontfile into memory + *---------------------------------------------------------------------------*/ +void readfont(char *filename) +{ + FILE *in; + struct stat sbuf, *sbp; + int ret; + char buffer[1024]; + + sbp = &sbuf; + + if((in = fopen(filename, "r")) == NULL) + { + sprintf(buffer, "cannot open file %s for reading", filename); + perror(buffer); + exit(1); + } + + if((fstat(fileno(in), sbp)) != 0) + { + sprintf(buffer, "cannot fstat file %s", filename); + perror(buffer); + exit(1); + } + + switch(sbp->st_size) + { + case FONT8X8: + ch_height = HEIGHT8X8; + ch_width = WIDTH8; + break; + + case FONT8X10: + ch_height = HEIGHT8X10; + ch_width = WIDTH8; + break; + + case FONT8X14: + ch_height = HEIGHT8X14; + ch_width = WIDTH8; + break; + + case FONT8X16: + ch_height = HEIGHT8X16; + ch_width = WIDTH8; + break; + + case FONT16X16: + ch_height = HEIGHT16X16; + ch_width = WIDTH16; + break; + + default: + fprintf(stderr,"error, file %s is no valid font file, size=%d\n",filename,sbp->st_size); + exit(1); + } + + if((fonttab = (unsigned char *)malloc((size_t)sbp->st_size)) == NULL) + { + fprintf(stderr,"error, malloc failed\n"); + exit(1); + } + + strcpy(lfilename, filename); /* save for write */ + lfilesize = sbp->st_size; /* save for write */ + + if((ret = fread(fonttab, sizeof(*fonttab), sbp->st_size, in)) != sbp->st_size) + { + sprintf(buffer,"error reading file %s, size = %d, ret = %d\n",filename,sbp->st_size, ret); + perror(buffer); + exit(1); + } +} + +/*---------------------------------------------------------------------------* + * write fontfile to disk + *---------------------------------------------------------------------------*/ +void writefont() +{ + FILE *in, *out; + int ret; + char buffer[1024]; + + if((in = fopen(lfilename, "r")) != NULL) + { + int c; + char wfn[1024]; + + strcpy(wfn, lfilename); + strcat(wfn, ".BAK"); + if((out = fopen(wfn, "w")) == NULL) + { + sprintf(buffer, "cannot open file %s for writing", wfn); + perror(buffer); + exit(1); + } + + while(( c = fgetc(in) ) != EOF ) + fputc(c, out); + + fclose(out); + fclose(in); + } + + if((out = fopen(lfilename, "w")) == NULL) + { + sprintf(buffer, "cannot open file %s for writing", lfilename); + perror(buffer); + exit(1); + } + + if((ret = fwrite(fonttab, sizeof(*fonttab), lfilesize, out)) != lfilesize) + { + sprintf(buffer,"error writing file %s, size=%d, ret=%d\n",lfilename,lfilesize, ret); + perror(buffer); + exit(1); + } +} + +/*---------------------------------------------------------------------------* + * display a string + *---------------------------------------------------------------------------*/ +void dis_cmd(char *strg) +{ + move(22,0); + clrtoeol(); + mvaddstr(22,0,strg); + refresh(); +} + +/*---------------------------------------------------------------------------* + * clear a command string + *---------------------------------------------------------------------------*/ +void clr_cmd(void) +{ + move(22,0); + clrtoeol(); + refresh(); +} + +/*---------------------------------------------------------------------------* + * move char from src to dest + *---------------------------------------------------------------------------*/ +void move_ch(int src, int dst) +{ + unsigned char *s, *d; + int offset = 0; + + if(ch_width == WIDTH16) + offset = 2; + else + offset = 1; + + s = &(fonttab[ch_height * offset * src]); + d = &(fonttab[ch_height * offset * dst]); + + bcopy(s, d, (ch_height*offset)); /* src -> dst */ +} + +/*---------------------------------------------------------------------------* + * exchange char's src and dest + *---------------------------------------------------------------------------*/ +void xchg_ch(int src, int dst) +{ + unsigned char *s, *d; + unsigned char buf[32]; + int offset = 0; + + if(ch_width == WIDTH16) + offset = 2; + else + offset = 1; + + s = &(fonttab[ch_height * offset * src]); + d = &(fonttab[ch_height * offset * dst]); + + bcopy(s, buf, (ch_height*offset)); /* src -> tmp */ + bcopy(d, s, (ch_height*offset)); /* dst -> src */ + bcopy(buf, d, (ch_height*offset)); /* tmp -> dst */ +} + +/*---------------------------------------------------------------------------* + * display the current selected character + *---------------------------------------------------------------------------*/ +void display(int no) +{ + unsigned char *fontchar; + char line[32]; + int ln_no; + unsigned char hibyte; + unsigned char lobyte; + int offset; + int r; + + offset = 0; + r = 1; + lobyte = 0; + + if(ch_width == WIDTH16) + fontchar = &(fonttab[ch_height * 2 * no]); + else + fontchar = &(fonttab[ch_height * no]); + + for (ln_no = 0; ln_no < ch_height; ln_no++) + { + hibyte = *(fontchar + (offset++)); + + if(ch_width == WIDTH16) + { + lobyte = *(fontchar + offset++); + } + + strcpy(line,bitmask[(int)((hibyte >> 4) & 0x0f)]); + strcat(line,bitmask[(int)(hibyte & 0x0f)]); + + if(ch_width == WIDTH16) + { + strcat(line,bitmask[(int)((lobyte >> 4) & 0x0f)]); + strcat(line,bitmask[(int)(lobyte & 0x0f)]); + mvwprintw(ch_win, r, 1, "%16.16s", line); + } + else + { + mvwprintw(ch_win, r, 1, "%8.8s", line); + } + r++; + } + wmove(ch_win, 1, 1); + wrefresh(ch_win); +} + +/*---------------------------------------------------------------------------* + * save character + *---------------------------------------------------------------------------*/ +void save_ch(void) +{ + unsigned char *s; + int offset = 0; + int r, c; + unsigned short byte; + unsigned short shift; + + if(ch_width == WIDTH16) + offset = 2; + else + offset = 1; + + s = &(fonttab[ch_height * offset * curchar]); + + r = 1; + + while(r <= ch_height) + { + c = 1; + byte = 0; + if(offset == 2) + shift = 0x8000; + else + shift = 0x80; + + while(c <= ch_width) + { + if(mvwinch(ch_win, r, c) == BLACK) + byte |= shift; + shift = (shift >> 1); + c++; + } + *s++ = byte; + r++; + } +} + +/*---------------------------------- E O F ----------------------------------*/ + + diff --git a/usr.sbin/pcvt/fed/select.c b/usr.sbin/pcvt/fed/select.c new file mode 100644 index 0000000..b6993bb --- /dev/null +++ b/usr.sbin/pcvt/fed/select.c @@ -0,0 +1,334 @@ +/* + * Copyright (c) 1992, 1993, 1994 by Hellmuth Michaelis + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Hellmuth Michaelis. + * 4. The name of the developer may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * select.c, 3.00, last edit-date: [Sun Jan 2 20:09:36 1994] + */ + +/*--------------------------------------------------------------------------- + * + * select.c font editor select character + * ---------------------------------------------------- + * + * written by Hellmuth Michaelis, hm@hcshh.hcs.de + * + * -hm first public release + * -hm debugging + * + *---------------------------------------------------------------------------*/ + +#include "fed.h" + +int sc, sr, scurchar; + +int edit(); + +void sel_mode(void) +{ + mvwprintw(cmd_win,1,1,"(E)dit "); + mvwprintw(cmd_win,2,1,"(M)ove "); + mvwprintw(cmd_win,3,1,"exchan(G)e "); + mvwprintw(cmd_win,4,1,"(Q)uit/Save "); + mvwprintw(cmd_win,5,1,"e(X)it/Undo "); + mvwprintw(cmd_win,6,1," "); + mvwprintw(cmd_win,7,1," "); + mvwprintw(cmd_win,8,1," "); + + mvwprintw(cmd_win,9 ,1," "); + mvwprintw(cmd_win,10,1," "); + mvwprintw(cmd_win,11,1," "); + mvwprintw(cmd_win,12,1," "); + mvwprintw(cmd_win,13,1,"(^P)rev Line"); + mvwprintw(cmd_win,14,1,"(^N)ext Line"); + mvwprintw(cmd_win,15,1,"(^F)orwd Col"); + mvwprintw(cmd_win,16,1,"(^B)ack Col"); + wrefresh(cmd_win); +} + +int selectc() +{ + int c, r; + int ret; + char h, l; + unsigned int k_ch; + + c = (curchar / 16); + r = (curchar % 16); + + for(;;) + { + dis_cmd(" Select Character"); + + sel_mode(); + + curchar = r + (c*16); + + display(curchar); + + h = ((mvwinch(set_win,(r+1),((c*2)+1))) & A_CHARTEXT); + l = ((mvwinch(set_win,(r+1),((c*2)+2))) & A_CHARTEXT); + wattron(set_win,A_REVERSE); + mvwprintw(set_win,(r+1),((c*2)+1),"%c%c",h,l); + wattroff(set_win,A_REVERSE); + wmove(set_win,(r+1),((c*2)+1)); + wrefresh(set_win); + + k_ch = wgetch(set_win); + + switch(k_ch) + { + case K_LEFT: + case KEY_LEFT: + if(c > 0) + { + normal_set(r,c); + c--; + } + break; + + case K_DOWN: + case KEY_DOWN: + if(r < 15) + { + normal_set(r,c); + r++; + } + break; + + case K_UP: + case KEY_UP: + if(r > 0) + { + normal_set(r,c); + r--; + } + break; + + case K_RIGHT: + case KEY_RIGHT: + if(c < 15) + { + normal_set(r,c); + c++; + } + break; + + case 'e': + case 'E': + edit_mode(); + dis_cmd(" Edit Character"); + display(curchar); + ret = edit(); + if(ret == 1) + save_ch(); + break; + + case 'g': + case 'G': + dis_cmd(" Exchange: select Destination, then press RETURN or any other Key to ABORT"); + sr = r; + sc = c; + scurchar = curchar; + if((curchar = sel_dest()) == -1) + { /* failsafe */ + r = sr; + c = sc; + curchar = scurchar; + } + else + { /* valid return */ + normal_set(r,c); + c = (curchar / 16); + r = (curchar % 16); + xchg_ch(scurchar,curchar); + } + break; + + case 'm': + case 'M': + dis_cmd(" Move: select Destination, then press RETURN or any other Key to ABORT"); + sr = r; + sc = c; + scurchar = curchar; + if((curchar = sel_dest()) == -1) + { /* failsafe */ + r = sr; + c = sc; + curchar = scurchar; + } + else + { /* valid return */ + normal_set(r,c); + c = (curchar / 16); + r = (curchar % 16); + move_ch(scurchar,curchar); + } + break; + + case 'q': + case 'Q': + normal_set(r,c); + wrefresh(set_win); + return(1); + break; + + case 'x': + case 'X': + normal_set(r,c); + wrefresh(set_win); + return(0); + break; + + case 0x0c: + wrefresh(curscr); + break; + + default: + beep(); + break; + + } + } +} + +void normal_set(int r, int c) +{ + char h, l; + + h = ((mvwinch(set_win,(r+1),((c*2)+1))) & A_CHARTEXT); + l = ((mvwinch(set_win,(r+1),((c*2)+2))) & A_CHARTEXT); + wattroff(set_win,A_REVERSE); + mvwprintw(set_win,(r+1),((c*2)+1),"%c%c",h,l); + wmove(set_win,(r+1),((c*2)+1)); +} + +int sel_dest(void) +{ + int c, r; + char h, l; + unsigned int k_ch; + + c = (curchar / 16); + r = (curchar % 16); + + for(;;) + { + + curchar = r + (c*16); + + display(curchar); + + h = ((mvwinch(set_win,(r+1),((c*2)+1))) & A_CHARTEXT); + l = ((mvwinch(set_win,(r+1),((c*2)+2))) & A_CHARTEXT); + wattron(set_win,A_UNDERLINE); + mvwprintw(set_win,(r+1),((c*2)+1),"%c%c",h,l); + wattroff(set_win,A_UNDERLINE); + wmove(set_win,(r+1),((c*2)+1)); + wrefresh(set_win); + + k_ch = wgetch(set_win); + + switch(k_ch) + { + case K_LEFT: + case KEY_LEFT: + if(c > 0) + { + normal_uset(r,c); + c--; + } + break; + + case K_DOWN: + case KEY_DOWN: + if(r < 15) + { + normal_uset(r,c); + r++; + } + break; + + case K_UP: + case KEY_UP: + if(r > 0) + { + normal_uset(r,c); + r--; + } + break; + + case K_RIGHT: + case KEY_RIGHT: + if(c < 15) + { + normal_uset(r,c); + c++; + } + break; + + case '\r': + case '\n': + normal_uset(r,c); + return(r + (c*16)); + + case 0x0c: + wrefresh(curscr); + break; + + default: + normal_uset(r,c); + return(-1); + } + } +} + +void normal_uset(int r, int c) +{ + char h, l; + + h = ((mvwinch(set_win,(r+1),((c*2)+1))) & A_CHARTEXT); + l = ((mvwinch(set_win,(r+1),((c*2)+2))) & A_CHARTEXT); + + wattroff(set_win,A_UNDERLINE); + mvwprintw(set_win,(r+1),((c*2)+1),"%c%c",h,l); + wmove(set_win,(r+1),((c*2)+1)); + + if((r==sr) && (c==sc)) + { + wattron(set_win,A_REVERSE); + mvwprintw(set_win,(r+1),((c*2)+1),"%c%c",h,l); + wattroff(set_win,A_REVERSE); + wmove(set_win,(r+1),((c*2)+1)); + } +} + + + +/*---------------------------------- E O F ----------------------------------*/ diff --git a/usr.sbin/pcvt/fontedit/Makefile b/usr.sbin/pcvt/fontedit/Makefile new file mode 100644 index 0000000..9cbe4e5 --- /dev/null +++ b/usr.sbin/pcvt/fontedit/Makefile @@ -0,0 +1,3 @@ +PROG= fontedit + +.include diff --git a/usr.sbin/pcvt/fontedit/README b/usr.sbin/pcvt/fontedit/README new file mode 100644 index 0000000..1854129 --- /dev/null +++ b/usr.sbin/pcvt/fontedit/README @@ -0,0 +1,36 @@ +When I first saw this posted to rn, I tried to compile this on a machine +running BSD UNIX. Much to my dissapointment, It said "unable to find +/usr/include/termio.h" and thus it sat for a couple months. I was able to +compile it on a 3b5, but I didn't have a vt220 hooked up to it. I was doing +some unrelated work with ioctl calls and finally realized that it would not be +too hard to convert it from System V to BSD. It also looked kind of strange +with the cursor on, so I turned this off. To implement this, compile with +the "-DCURFIX" flag in the Makefile. +I am working on a new version that uses curses and that would enable you to +change the file that your are working on without leaving the program. +I thought I'd post it as it is now, since it has a lot of uses right away. +Imagine changing your favorite game to have objects that look like what they +are instead of the regular characters. Also, I think people should post their +own character sets, if they come up with some neat stuff. + Please send any comments or suggestions to: + + UUCP : ..!harvard!bu-cs!bucsb!eap + ARPANET: eap@bucsb.bu.edu + CSNET : eap%bucsb@bu-cs + + Have fun, + + - Eric Pearce + Boston University + + + + + + + + + + + + diff --git a/usr.sbin/pcvt/fontedit/fontedit.1 b/usr.sbin/pcvt/fontedit/fontedit.1 new file mode 100644 index 0000000..8b55edb --- /dev/null +++ b/usr.sbin/pcvt/fontedit/fontedit.1 @@ -0,0 +1,58 @@ +.TH FONTEDIT 1 LOCAL +.SH NAME +fontedit \- Edit fonts. +.SH SYNOPSIS +.B fontedit file +.SH DESCRIPTION +.I Fontedit +is used to edit the down line reloadable character set (DRCS) of a VT220 +terminal. The editor has two display areas, one for displaying the +entry currently being manipulated, and one for displaying the complete +DRCS. Commands to the editor take the form of function keys. +.PP +.I Fontedit +takes one command line parameter, a file name. This file is +used to save the character set. If the file exists when \fIfontedit\fP +is invoked, it is read in to initialize the DRCS. The file is written +to when \fIfontedit\fP exits. +.PP +Commands to fontedit take the form of function keys. The current +definitions are: +.IP \fBHELP\fP +Display a help screen. +.IP \fBF6\fP +Turn the pixel under the cursor on. +.IP \fBF7\fP +Turn the pixel under the cursor off. +.IP \fBF13\fP +Clear the display area. +.IP \fBFind\fP +Save the current font in the font table. Update the DRCS display. +.IP \fBSelect\fP +Extract the entry selected by the cursor in the DRCS display. +.IP \fBPrev\fP +Move the cursor to the previous entry in the DRCS display. +.IP \fBNext\fP +Move the cursor to the next entry in the DRCS display. +.IP \fBInsert\fP +Insert a blank line at the current cursor position. The bottom row is lost. +.IP \fBRemove\fP +Remove the row at the current cursor position. All rows below the +current one are shifted up. +.IP \fBCursors\fP +Move the cursor in the main display area. +.PP +If the screen gets garbled, press . +.PP +To exit \fIfontedit\fP, press . The DRCS will be saved in +\fIfile\fP. To exit without saving the DRCS, hit interrupt (usually +DEL). +.SH DIAGNOSTICS +.I Fontedit +will issue a warning when the entry being worked on is not saved, and +some potentially destructive command, like \fBSelect\fP is used. To +override the warning message, immediately reissue the command. +.SH AUTHOR +Greg Franks. + + diff --git a/usr.sbin/pcvt/fontedit/fontedit.c b/usr.sbin/pcvt/fontedit/fontedit.c new file mode 100644 index 0000000..d9ed357c --- /dev/null +++ b/usr.sbin/pcvt/fontedit/fontedit.c @@ -0,0 +1,925 @@ +/* + * fontedit + * Fonteditor for VT220 + * + * BUGS: + * o Cursor motion is less than optimal (but who cares at 9600), + * + * COMPILE: + * cc -O fontedit.c -o fontedit + * (use Makefile) + * + * Copyright (c) 1987 by Greg Franks. + * + * Permission is granted to do anything you want with this program + * except claim that you wrote it. + * + * + * REVISION HISTORY: + * + * Nov 21, 1987 - Fixed man page to say "Fontedit" instead of "Top" + * Nov 22, 1987 - Added BSD Compatible ioctl, turned cursor on/off + * - eap@bucsf.bu.edu + */ + +void clear_screen(); +#include +#ifdef SYSV +#include +#endif SYSV +#ifdef BSD +#include +#endif BSD +#if defined (__NetBSD__) || defined (__FreeBSD__) +#include +#include +#endif /* __NetBSD__ || __FreeBSD__ */ +#include + +#ifdef CURFIX +#define CURSORON "\033[?25h" +#define CURSOROFF "\033[?25l" +#endif CURFIX + +#define MAX_ROWS 10 +#define MAX_COLS 8 + +typedef enum { false, true } bool; + +#define KEY_FIND 0x0100 +#define KEY_INSERT 0x0101 +#define KEY_REMOVE 0x0102 +#define KEY_SELECT 0x0103 +#define KEY_PREV 0x0104 +#define KEY_NEXT 0x0105 +#define KEY_F6 0X0106 +#define KEY_F7 0x0107 +#define KEY_F8 0x0108 +#define KEY_F9 0x0109 +#define KEY_F10 0x010a +#define KEY_F11 0x010b +#define KEY_F12 0x010c +#define KEY_F13 0x010d +#define KEY_F14 0x010e +#define KEY_HELP 0x010f +#define KEY_DO 0x0110 +#define KEY_F17 0x0111 +#define KEY_F18 0x0112 +#define KEY_F19 0x0113 +#define KEY_F20 0x0114 +#define KEY_UP 0x0115 +#define KEY_DOWN 0x0116 +#define KEY_RIGHT 0x0117 +#define KEY_LEFT 0x0118 + +/* + * Position of main drawing screen. + */ + +#define ROW_OFFSET 3 +#define COL_OFFSET 10 + +/* + * Position of the DRCS table. + */ + +#define TABLE_ROW 4 +#define TABLE_COL 50 + +/* + * + */ + +#define ERROR_ROW 20 +#define ERROR_COL 40 + +bool display_table[MAX_ROWS][MAX_COLS]; + +#define TOTAL_ENTRIES (128 - 32) +#define SIXELS_PER_CHAR 16 + +char font_table[TOTAL_ENTRIES][SIXELS_PER_CHAR]; +unsigned int current_entry; + +#ifdef SYSV +struct termio old_stty, new_stty; +#endif SYSV +#ifdef BSD +struct sgttyb old_stty, new_stty; +#endif BSD +#if defined (__NetBSD__) || defined (__FreeBSD__) +struct termios old_stty, new_stty; +#endif /* __NetBSD__ || __FreeBSD__ */ +FILE * font_file = (FILE *)0; + + +/* + * Interrupt + * Exit gracefully. + */ + +interrupt() +{ + void clear_screen(); +#ifdef CURFIX + printf("%s\n",CURSORON); +#endif CURFIX +#ifdef SYSV + ioctl( 0, TCSETA, &old_stty ); +#endif SYSV +#ifdef BSD + ioctl( 0, TIOCSETP, &old_stty ); +#endif BSD +#if defined (__NetBSD__) || defined (__FreeBSD__) + ioctl( 0, TIOCSETA, &old_stty ); +#endif /* __NetBSD__ || __FreeBSD__ */ + clear_screen(); + exit( 0 ); +} + + +/* + * Main + * Grab input/output file and call main command processor. + */ + +main( argc, argv ) +int argc; +char *argv[]; +{ + void command(), init_restore(), clear_screen(); + void save_table(), get_table(), extract_entry(); + + if ( argc != 2 ) { + fprintf( stderr, "usage: fontedit filename\n" ); + exit( 1 ); + } + + printf( "Press HELP for help\n" ); + printf( "\033P1;1;2{ @\033\\" ); /* Clear font buffer */ + fflush( stdout ); + sleep( 1 ); /* Let terminal catch up */ + /* otherwise we get frogs */ + + if ( ( font_file = fopen( argv[1], "r" ) ) == (FILE *)0 ) { + if ( ( font_file = fopen( argv[1], "w" ) ) == (FILE *)0 ) { + fprintf( stderr, "Cannot create file %s \n", argv[1] ); + exit( 1 ); + } + } + fclose( font_file ); + + if ( ( font_file = fopen( argv[1], "r" ) ) != (FILE *)0 ) { + get_table( font_file ); + fclose( font_file ); + } + + if ( ( font_file = fopen( argv[1], "r+" ) ) == (FILE *)0 ) { + fprintf( stderr, "Cannot open %s for writing\n", argv[1] ); + exit( 1 ); + } +#ifdef CURFIX + printf("%s\n",CURSOROFF); +#endif CURFIX +#ifdef SYSV + ioctl( 0, TCGETA, &old_stty ); +#endif SYSV +#ifdef BSD + ioctl( 0, TIOCGETP, &old_stty ); +#endif BSD +#if defined (__NetBSD__) || defined (__FreeBSD__) + ioctl( 0, TIOCGETA, &old_stty ); +#endif /* __NetBSD__ || __FreeBSD__ */ + signal( SIGINT, (void *) interrupt ); + new_stty = old_stty; +#ifdef SYSV + new_stty.c_lflag &= ~ICANON; + new_stty.c_cc[VMIN] = 1; + ioctl( 0, TCSETA, &new_stty ); +#endif SYSV +#if defined (__NetBSD__) || defined (__FreeBSD__) + new_stty.c_lflag &= ~ICANON; + new_stty.c_lflag &= ~ECHO; + new_stty.c_cc[VMIN] = 1; + ioctl( 0, TIOCSETA, &new_stty ); +#endif /* __NetBSD__ || __FreeBSD__ */ +#ifdef BSD + new_stty.sg_flags |= CBREAK; + new_stty.sg_flags &= ~ECHO; + ioctl( 0, TIOCSETP, &new_stty ); +#endif BSD + current_entry = 1; + extract_entry( current_entry ); + init_restore(); + command(); +#ifdef SYSV + ioctl( 0, TCSETA, &old_stty ); +#endif SYSV +#ifdef BSD + ioctl( 0, TIOCSETP, &old_stty ); +#endif BSD +#if defined (__NetBSD__) || defined (__FreeBSD__) + ioctl( 0, TIOCSETA, &old_stty ); +#endif /* __NetBSD__ || __FreeBSD__ */ + clear_screen(); + + /* Overwrite the old file. */ + + fseek( font_file, 0L, 0 ); + save_table( font_file ); + fclose( font_file ); +#ifdef CURFIX + printf("%s\n",CURSORON); +#endif CURFIX +} + + + +/* + * Command + * Process a function key. + * + * The user cannot fill in slots 0 or 95 (space and del respecitively). + */ + +void +command() +{ + register int c; + register int row, col; + register int i, j; + bool change, error, override; + + void build_entry(), extract_entry(), send_entry(), print_entry(); + void highlight(), draw_current(), init_restore(), help(); + void warning(); + + change = false; + error = false; + override = false; + row = 0; col = 0; + highlight( row, col, true ); + + for ( ;; ) { + c = get_key(); + highlight( row, col, false ); /* turn cursor off */ + + if ( error ) { + move ( ERROR_ROW, ERROR_COL ); + printf( "\033[K" ); /* Clear error message */ + move ( ERROR_ROW+1, ERROR_COL ); + printf( "\033[K" ); /* Clear error message */ + error = false; + } else { + override = false; + } + + switch ( c ) { + + case KEY_FIND: /* update DRCS */ + if ( !change && !override ) { + warning( "No changes to save" ); + override = true; + error = true; + } else { + build_entry( current_entry ); + send_entry( current_entry ); + print_entry( current_entry, true ); + change = false; + } + break; + + case KEY_F6: /* Turn on pixel */ + change = true; + display_table[row][col] = true; + highlight( row, col, false ); + col = ( col + 1 ) % MAX_COLS; + if ( col == 0 ) + row = ( row + 1 ) % MAX_ROWS; + break; + + case KEY_F7: /* Turn off pixel */ + change = true; + display_table[row][col] = false; + highlight( row, col, false ); + col = ( col + 1 ) % MAX_COLS; + if ( col == 0 ) + row = ( row + 1 ) % MAX_ROWS; + break; + + case KEY_INSERT: /* Insert a blank row */ + change = true; + for ( j = 0; j < MAX_COLS; ++j ) { + for ( i = MAX_ROWS - 1; i > row; --i ) { + display_table[i][j] = display_table[i-1][j]; + } + display_table[row][j] = false; + } + draw_current(); + break; + + case KEY_REMOVE: /* Remove a row */ + change = true; + for ( j = 0; j < MAX_COLS; ++j ) { + for ( i = row; i < MAX_ROWS - 1; ++i ) { + display_table[i][j] = display_table[i+1][j]; + } + display_table[MAX_ROWS-1][j] = false; + } + draw_current(); + break; + + case KEY_F13: /* Clear buffer */ + if ( change && !override ) { + warning( "Changes not saved" ); + error = true; + override = true; + } else { + for ( j = 0; j < MAX_COLS; ++j ) { + for ( i = 0; i < MAX_ROWS; ++i ) { + display_table[i][j] = false; + } + } + draw_current(); + } + break; + + case KEY_SELECT: /* Select font from DRCS */ + if ( change && !override ) { + warning( "Changes not saved" ); + error = true; + override = true; + } else { + extract_entry( current_entry ); + draw_current(); + } + break; + + case KEY_PREV: /* Move to prev entry in DRCS */ + if ( change && !override ) { + warning( "Changes not saved" ); + override = true; + error = true; + } else { + print_entry( current_entry, false ); + current_entry = current_entry - 1; + if ( current_entry == 0 ) + current_entry = TOTAL_ENTRIES - 2; + print_entry( current_entry, true ); + } + break; + + case KEY_NEXT: /* Move to next entry in DRCS */ + if ( change && !override ) { + warning( "Changes not saved" ); + override = true; + error = true; + } else { + print_entry( current_entry, false ); + current_entry = current_entry + 1; + if ( current_entry == TOTAL_ENTRIES - 1 ) + current_entry = 1; + print_entry( current_entry, true ); + } + break; + + case KEY_UP: /* UP one row. */ + if ( row == 0 ) + row = MAX_ROWS; + row = row - 1; + break; + + case KEY_DOWN: /* Guess. */ + row = ( row + 1 ) % MAX_ROWS; + break; + + case KEY_RIGHT: + col = ( col + 1 ) % MAX_COLS; + break; + + case KEY_LEFT: + if ( col == 0 ) + col = MAX_COLS; + col = col - 1; + break; + + case KEY_HELP: /* Display helpful info */ + clear_screen(); + help(); + c = getchar(); + init_restore(); + break; + + case '\004': /* All done! */ + return; + + case '\f': /* Redraw display */ + init_restore(); + break; + + default: /* user is a klutzy typist */ + move ( ERROR_ROW, ERROR_COL ); + printf( "Unknown key: " ); + if ( c < 0x20 ) { + printf( "^%c", c ); + } else if ( c < 0x0100 ) { + printf( "%c", c ); + } else { + printf( "0x%04x", c ); + } + fflush( stdout ); + error = true; + } + + highlight( row, col, true ); /* turn cursor on */ + } +} + + + +char *key_table[] = { + "\033[1~", /* Find */ + "\033[2~", /* Insert */ + "\033[3~", /* Remove */ + "\033[4~", /* Select */ + "\033[5~", /* Prev */ + "\033[6~", /* Next */ + "\033[17~", + "\033[18~", + "\033[19~", + "\033[20~", + "\033[21~", + "\033[23~", + "\033[24~", + "\033[25~", + "\033[26~", + "\033[28~", + "\033[29~", + "\033[31~", + "\033[32~", + "\033[33~", + "\033[34~", + "\033[A", + "\033[B", + "\033[C", + "\033[D", + (char *)0 }; + +/* + * get_key + * Convert VT220 escape sequence into something more reasonable. + */ + +int +get_key() +{ + register char *p; + char s[10]; + register int i, j; + + p = s; + for ( i = 0; i < 10; ++i ) { + *p = getchar(); + if ( i == 0 && *p != '\033' ) + return( (int)*p ); /* Not an escape sequence */ + if ( *p != '\033' && *p < 0x0020 ) + return( (int)*p ); /* Control character */ + *++p = '\0'; /* Null terminate */ + for ( j = 0; key_table[j]; ++j ) { + if ( strcmp( s, key_table[j] ) == 0 ) { + return( j | 0x0100 ); + } + } + } + return( -1 ); +} + + + +/* + * pad + * Emit nulls so that the terminal can catch up. + */ + +pad() +{ + int i; + + for ( i = 0; i < 20; ++i ) + putchar( '\000' ); + fflush( stdout ); +} + + + +/* + * init_restore + * refresh the main display table. + */ + +void +init_restore() +{ + register int row, col; + register int i; + + void draw_current(), clear_screen(), print_entry(); + + clear_screen(); + + for ( col = 0; col < MAX_COLS; ++col ) { + move( ROW_OFFSET - 2, col * 3 + COL_OFFSET + 1 ); + printf( "%d", col ); + } + move( ROW_OFFSET - 1, COL_OFFSET ); + printf( "+--+--+--+--+--+--+--+--+" ); + move( ROW_OFFSET + MAX_ROWS * 2, COL_OFFSET ); + printf( "+--+--+--+--+--+--+--+--+" ); + + for ( row = 0; row < MAX_ROWS; ++row ) { + if ( row != 0 && row != 7 ) { + move( row * 2 + ROW_OFFSET, COL_OFFSET - 2 ); + printf( "%d|", row ); + move( row * 2 + ROW_OFFSET + 1, COL_OFFSET - 1 ); + printf( "|" ); + move( row * 2 + ROW_OFFSET, COL_OFFSET + MAX_COLS * 3 ); + printf( "|" ); + move( row * 2 + ROW_OFFSET + 1, COL_OFFSET + MAX_COLS * 3 ); + printf( "|" ); + } else { + move( row * 2 + ROW_OFFSET, COL_OFFSET - 2 ); + printf( "%d*", row ); + move( row * 2 + ROW_OFFSET + 1, COL_OFFSET - 1 ); + printf( "*" ); + move( row * 2 + ROW_OFFSET, COL_OFFSET + MAX_COLS * 3 ); + printf( "*" ); + move( row * 2 + ROW_OFFSET + 1, COL_OFFSET + MAX_COLS * 3 ); + printf( "*" ); + } + } + draw_current(); + + move( TABLE_ROW - 1, TABLE_COL - 1 ); + printf( "+-+-+-+-+-+-+-+-+-+-+-+-+" ); + move( TABLE_ROW + 8 * 2 - 1, TABLE_COL - 1 ); + printf( "+-+-+-+-+-+-+-+-+-+-+-+-+" ); + for ( i = 0; i < 8; ++i ) { + move ( TABLE_ROW + i * 2, TABLE_COL - 1 ); + printf( "|" ); + move ( TABLE_ROW + i * 2 + 1, TABLE_COL - 1 ); + printf( "+" ); + move ( TABLE_ROW + i * 2, TABLE_COL + 12 * 2 - 1); + printf( "|" ); + move ( TABLE_ROW + i * 2 + 1, TABLE_COL +12 * 2 - 1); + printf( "+" ); + } + for ( i = 0; i < TOTAL_ENTRIES; ++i ) + print_entry( i, (i == current_entry) ? true : false ); +} + + + +/* + * draw_current + * Draw the complete current entry. + */ + +void +draw_current() +{ + register int row, col; + + printf( "\033)0" ); /* Special graphics in G1 */ + printf( "\016" ); /* Lock in G1 (SO) */ + + for ( row = 0; row < MAX_ROWS; ++row ) { + for ( col = 0; col < MAX_COLS; ++col ) { + if ( display_table[row][col] ) { + move( row * 2 + ROW_OFFSET, col * 3 + COL_OFFSET ); + printf( "\141\141\141" ); + move( row * 2 + ROW_OFFSET + 1, col * 3 + COL_OFFSET ); + printf( "\141\141\141" ); + } else { + move( row * 2 + ROW_OFFSET, col * 3 + COL_OFFSET ); + printf( " " ); /* erase splat */ + move( row * 2 + ROW_OFFSET + 1, col * 3 + COL_OFFSET ); + printf( " " ); /* erase splat */ + } + } + pad(); + } + printf( "\017" ); /* Lock in G0 (SI) */ + fflush( stdout ); +} + + + +/* + * highlight + * Draw the cursor in the main display area. + */ + +void +highlight( row, col, on ) +unsigned int row, col; +bool on; +{ + + printf( "\033)0" ); /* Special graphics in G1 */ + printf( "\016" ); /* Lock in G1 (SO) */ + if ( on ) { + printf( "\033[7m" ); /* Reverse video cursor */ + } + + if ( display_table[row][col] ) { + move( row * 2 + ROW_OFFSET, col * 3 + COL_OFFSET ); + printf( "\141\141\141" ); + move( row * 2 + ROW_OFFSET + 1, col * 3 + COL_OFFSET ); + printf( "\141\141\141" ); + } else { + move( row * 2 + ROW_OFFSET, col * 3 + COL_OFFSET ); + printf( " " ); /* erase splat */ + move( row * 2 + ROW_OFFSET + 1, col * 3 + COL_OFFSET ); + printf( " " ); /* erase splat */ + } + pad(); + printf( "\017" ); /* Lock in G0 (SI) */ + printf( "\033[0m" ); /* normal video */ + printf( "\b" ); /* Back up one spot */ + fflush( stdout ); +} + + + +/* + * Clear_screen + */ + +void +clear_screen() +{ + printf( "\033[H\033[J" ); /* Clear screen. */ + fflush( stdout ); +} + + + +/* + * move + */ + +move( y, x ) +int y, x; +{ + printf( "\033[%d;%df", y, x ); +} + + + +/* + * Build_entry + * Convert the bit pattern used in the main display area into something + * that the vt220 can digest - namely sixels... + */ + +void +build_entry( entry_no ) +unsigned int entry_no; +{ + register int row, col; + register unsigned int mask; + + for ( col = 0; col < 8; ++col ) { + + /* Top set of sixels */ + + mask = 0; + for ( row = 5; row >= 0; --row ) { + mask = mask << 1; + if ( display_table[row][col] ) + mask |= 1; + } + font_table[entry_no][col] = mask + 077; + + /* Bottom set of sixels */ + + mask = 0; + for ( row = 9; row >= 6; --row ) { + mask = mask << 1; + if ( display_table[row][col] ) + mask |= 1; + } + font_table[entry_no][col+8] = mask + 077; + } + +} + + + +/* + * Extract_engry + * convert sixel representation into an array of bits. + */ + +void +extract_entry( entry_no ) +unsigned int entry_no; +{ + register int row, col; + register unsigned int mask; + + for ( col = 0; col < 8; ++col ) { + + /* Top set of sixels */ + + mask = font_table[entry_no][col]; + if ( mask >= 077 ) + mask -= 077; + else + mask = 0; /* Bogus entry */ + + for ( row = 0; row <= 5; ++row ) { + display_table[row][col] = (bool)(mask & 0x0001); + mask = mask >> 1; + } + + /* Bottom set of sixels */ + + mask = font_table[entry_no][col+8]; + if ( mask >= 077 ) + mask -= 077; + else + mask = 0; + + for ( row = 6; row <= 9; ++row ) { + display_table[row][col] = (bool)(mask & 0x0001); + mask = mask >> 1; + } + } + +} + + + +/* + * Send_entry + * Emit the stuff used by the VT220 to load a character into the + * DRCS. We could, of course, send more than one entry at a time... + */ + +void +send_entry( entry_no ) +int entry_no; +{ + register char *fp = font_table[entry_no]; + + printf( "\033P1;%d;1;0;0;0{ @%c%c%c%c%c%c%c%c/%c%c%c%c%c%c%c%c\033\\", + entry_no, + fp[ 0], fp[ 1], fp[ 2], fp[ 3], fp[ 4], fp[ 5], fp[ 6], fp[ 7], + fp[ 8], fp[ 9], fp[10], fp[11], fp[12], fp[13], fp[14], fp[15] ); +} + + + +/* + * Print_entry + * The terminal normally has G0 in GL. We don't want to change + * this, nor do we want to use GR. Sooooo send out the necessary + * magic for shifting in G2 temporarily for the character that we + * want to display. + */ + +void +print_entry( entry_no, highlight ) +register unsigned int entry_no; +bool highlight; +{ + + register int y, x; + + y = entry_no & 0x07; + x = entry_no >> 3 & 0x1f; + entry_no += 32; /* Map up to G set */ + + move( y * 2 + TABLE_ROW, x * 2 + TABLE_COL ); + + if ( highlight ) + printf( "\033[7m" ); + + printf( "\033* @" ); /* select DRCS into G2 */ + printf( "\033N" ); /* select single shift */ + printf( "%c", entry_no ); /* Draw the character */ + + if ( highlight ) + printf( "\033[0m" ); +} + + + +/* + * Save_table + * Save a font table + */ + +void +save_table( font_file ) +FILE *font_file; +{ + register char *fp; + register int i; + + for ( i = 0; i < TOTAL_ENTRIES; ++i ) { + fp = font_table[i]; + fprintf( font_file, "\033P1;%d;1;0;0;0{ @%c%c%c%c%c%c%c%c/%c%c%c%c%c%c%c%c\033\\\n", + i, + fp[ 0], fp[ 1], fp[ 2], fp[ 3], fp[ 4], fp[ 5], fp[ 6], fp[ 7], + fp[ 8], fp[ 9], fp[10], fp[11], fp[12], fp[13], fp[14], fp[15] ); + } +} + + + +/* + * Get_table + * Extract font table entries from a file + */ + +void +get_table( font_file ) +FILE *font_file; +{ + char s[256]; + register char *p; + char *fp; + int i; + register int j; + + while( fgets( s, 255, font_file ) ) { + if ( strncmp( s, "\033P1;", 4 ) != 0 ) + continue; /* Bogus line */ + p = &s[4]; + if ( sscanf( p, "%d", &i ) != 1 ) + continue; /* Illegal entry number */ + + if ( i <= 0 || TOTAL_ENTRIES <= i ) + continue; /* Bogues entry */ + + fp = font_table[i]; + + while ( *p && *p != '@' ) + ++p; /* Skip to font definition */ + if ( ! *p++ ) + continue; /* Skip @ */ + + for ( j = 0; *p && *p != '\033' && j < 16; ++j, ++p ) { + if ( *p == '/' ) { + j = 8; + ++p; + } + fp[j] = *p; + } + send_entry( i ); + } +} + + + +/* + * Help + * Print out help information. + */ + +void +help() +{ + printf( "Font editor\n\n" ); + printf( "F6 - Pixel on\n" ); + printf( "F7 - Pixel off\n" ); + printf( "F13 - Clear display area\n" ); + printf( "HELP - This screen\n" ); + printf( "FIND - Update font table\n" ); + printf( "INSERT - Insert a blank row\n" ); + printf( "REMOVE - Remove a row\n" ); + printf( "SELECT - Select current font table entry\n" ); + printf( "PREV - Move to previous font table entry\n" ); + printf( "NEXT - Move to next font table entry\n" ); + printf( "^D - Exit\n" ); + printf( "\n\n\n\nPress any key to continue\n" ); +} + + + +/* + * Warning + * Issue a warning to the regarding the current status. + */ + +void +warning( s ) +char *s; +{ + move( ERROR_ROW, ERROR_COL ); + printf( "Warning: %s!\n", s ); + move( ERROR_ROW+1, ERROR_COL ); + printf( " Reissue command to override\n" ); +} diff --git a/usr.sbin/pcvt/fonts/COPYRIGHT b/usr.sbin/pcvt/fonts/COPYRIGHT new file mode 100644 index 0000000..175f7b8 --- /dev/null +++ b/usr.sbin/pcvt/fonts/COPYRIGHT @@ -0,0 +1,38 @@ +The font files: + + vt100pc.814.uu, vt100sg.814.uu, vt220h.808.uu, vt220h.810.uu, + vt220h.814.uu, vt220h.816.uu, vt220l.808.uu, vt220l.810.uu, + vt220l.814.uu and vt220l.816.uu + +in this directory are + + Copyright (c) 1992, 1993, 1994 Hellmuth Michaelis and Joerg Wunsch + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. All advertising materials mentioning features or use of this software + must display the following acknowledgement: + This product includes software developed by + Hellmuth Michaelis and Joerg Wunsch + 4. The name authors may not be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + diff --git a/usr.sbin/pcvt/fonts/Makefile b/usr.sbin/pcvt/fonts/Makefile new file mode 100644 index 0000000..59ed20b --- /dev/null +++ b/usr.sbin/pcvt/fonts/Makefile @@ -0,0 +1,19 @@ +# $Id: Makefile,v 1.7 1997/12/20 00:40:05 bde Exp $ + +.SUFFIXES: .uu +.uu: + rm -f ${.TARGET} + uudecode ${.IMPSRC} + +FONTS= vt220h.808 vt220h.810 vt220h.814 vt220h.816 \ + vt220l.808 vt220l.810 vt220l.814 vt220l.816 +#FONTS+= vt100pc.814 vt100sg.814 +CLEANFILES= ${FONTS} + +all: ${FONTS} + +beforeinstall: + ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ + ${FONTS} ${DESTDIR}${FONTDIR} + +.include diff --git a/usr.sbin/pcvt/fonts/vt100pc.814.uu b/usr.sbin/pcvt/fonts/vt100pc.814.uu new file mode 100644 index 0000000..470f9c9 --- /dev/null +++ b/usr.sbin/pcvt/fonts/vt100pc.814.uu @@ -0,0 +1,83 @@ +begin 644 vt100pc.814 +M`$1D5$Q$`"`@("`^````/$`X!'@`(B(^(B(````\0#@$>``B%`@4(@```'Q` +M>$!\`"(4"!0B````?$!X0'P`/@@("`@```!\0'A`?``<(B(J'`(``#A$?$1$ +M`"0H,"@D````>$1X1'@`("`@(#X```!X1'A$>``>(!P"/````$1$?$1$`#X( +M"`@(````0$!`0'P`/B`\("````!$1$0H$``^"`@("````'Q`>$!``#X@/"`@ +M````/$!`0#P`/"(\)"(````\0#@$>``<(B(B'````#Q`.`1X`!P("`@<```` +M>$1$1'@`("`@(#X```!X1$1$>``$#`0$#@```'A$1$1X`!PB#!`^````>$1$ +M1'@`'`(,`AP```!X1$1$>``$"!(^`@```$1D5$Q$`"(D."0B````/$`X!'@` +M(A0("`@```!\0'A`?``\(CPB/````#Q`0$`\`"(R*B8B````?$!X0'P`(C8J +M(B(````\0#@$>``B(B(B'````'Q`>$!\`!X@("`>````?$!X0$``'B`<`CP` +M```\0$Q$/``>(!P"/````'A$>$A$`!X@'`(\````1$1$1#@`'B`<`CP````` +M```````````````````8/#P\&!@`&!@`````8V-C(@``````````````-C9_ +M-C8V?S8V````#`P^8V%@/@-#8SX,#```````86,&#!@S8P``````'#8V'#MN +M9F8[`````#`P,&````````````````P8,#`P,#`8#```````&`P&!@8&!@P8 +M`````````&8\_SQF```````````8&!C_&!@8````````````````&!@8,``` +M````````_P`````````````````````8&````````0,&#!@P8$`````````^ +M8V=O>W-C8SX```````P```````'C-A8&!O8S,=``````!C8V-C?V-C8V,``````#P8&!@8&!@8/``` +M````#P8&!@8&9F8\``````!S,S8V/#8V,W,``````'@P,#`P,#$Q?P`````` +MP^?_V\/#P\/#``````!C`Q\S,QV +M``````#,S`!X#'S,S'8`````8#`8`'@,?,S,=@`````X;#@`>`Q\S,QV```` +M`````'C,P,QX&`QX````$#AL`'S&_L#&?```````S,P`?,;^P,9\`````&`P +M&`!\QO[`QGP``````,S,`'`P,#`P>``````P>,P`<#`P,#!X`````,!@,`!P +M,#`P,'@`````QL80.&S&QO[&Q@```#AL.``X;,;&_L;&````&#!@`/YB8'Q@ +M8OX`````````;+H2?I"8?@``````/FS,S/[,S,S.`````!`X;`!\QL;&QGP` +M`````,;&`'S&QL;&?`````!@,!@`?,;&QL9\`````#!XS`#,S,S,S'8````` +M8#`8`,S,S,S,=@``````QL8`QL;&QGX&#'@``,;&.&S&QL;&;#@`````QL8` +MQL;&QL;&?``````("'[(R,C(?@@(`````#AL9&#P8&!@YOP``````,9L.!#^ +M$/X0$`````#XS,SXQ,S>S,SF`````!PT,#`P_#`P,#"PX```&#!@`'@,?,S, +M=@`````,&#``.!@8&!@\`````!@P8`!\QL;&QGP`````&#!@`,S,S,S,=@`` +M````=MP`W&9F9F9F````=MP`QN;V_M[.QL8`````/&QL/@!^```````````X +M;&PX`'P````````````P,``P,&#&QGP```````````!_8&!@```````````` +M`'\!`0$``````,#`QLS8,&#,S,S'@P_```````.&S&QO[&QFPX```````X;,;&QFQL +M;.X``````#Q@,!A\S,S,>```````````?-;6?``````````&#'S.UN9\8,`` +M`````#A@P,#XP,!@.````````'S&QL;&QL;&````````_@``_@``_@`````` +M`#`P,/PP,#``_```````8#`8#!@P8`#\```````8,&#`8#`8`/P```````X: +M&A@8&!@8&!@8&!@8&!@8&!@86%AP```````P,```_```,#``````````=MP` +M=MP```````!PV-AP````````````````````&!@`````````````````&``` +M```````>&!@8&!C8V'@X`````-AL;&QL;```````````<-@P8,CX```````` +=```````^/CX^/CX````````````````````````` +` +end diff --git a/usr.sbin/pcvt/fonts/vt100sg.814.uu b/usr.sbin/pcvt/fonts/vt100sg.814.uu new file mode 100644 index 0000000..24ea4c7 --- /dev/null +++ b/usr.sbin/pcvt/fonts/vt100sg.814.uu @@ -0,0 +1,83 @@ +begin 644 vt100sg.814 +M`$1D5$Q$`"`@("`^````/$`X!'@`(B(^(B(````\0#@$>``B%`@4(@```'Q` +M>$!\`"(4"!0B````?$!X0'P`/@@("`@```!\0'A`?``<(B(J'`(``#A$?$1$ +M`"0H,"@D````>$1X1'@`("`@(#X```!X1'A$>``>(!P"/````$1$?$1$`#X( +M"`@(````0$!`0'P`/B`\("````!$1$0H$``^"`@("````'Q`>$!``#X@/"`@ +M````/$!`0#P`/"(\)"(````\0#@$>``<(B(B'````#Q`.`1X`!P("`@<```` +M>$1$1'@`("`@(#X```!X1$1$>``$#`0$#@```'A$1$1X`!PB#!`^````>$1$ +M1'@`'`(,`AP```!X1$1$>``$"!(^`@```$1D5$Q$`"(D."0B````/$`X!'@` +M(A0("`@```!\0'A`?``\(CPB/````#Q`0$`\`"(R*B8B````?$!X0'P`(C8J +M(B(````\0#@$>``B(B(B'````'Q`>$!\`!X@("`>````?$!X0$``'B`<`CP` +M```\0$Q$/``>(!P"/````'A$>$A$`!X@'`(\````1$1$1#@`'B`<`CP````` +M```````````````````8/#P\&!@`&!@`````8V-C(@``````````````-C9_ +M-C8V?S8V````#`P^8V%@/@-#8SX,#```````86,&#!@S8P``````'#8V'#MN +M9F8[`````#`P,&````````````````P8,#`P,#`8#```````&`P&!@8&!@P8 +M`````````&8\_SQF```````````8&!C_&!@8````````````````&!@8,``` +M````````_P`````````````````````8&````````0,&#!@P8$`````````^ +M8V=O>W-C8SX```````P```````'C-A8&!O8S,=``````!C8V-C?V-C8V,``````#P8&!@8&!@8/``` +M````#P8&!@8&9F8\``````!S,S8V/#8V,W,``````'@P,#`P,#$Q?P`````` +MP^?_V\/#P\/#``````!C$!\`#X@ +M."`@````/$!`0#P`/"(\)"(```!`0$!`?``^(#P@(````'#8V'`````````` +M`````#`P,/PP,#``_`````!$9%1,1``@("`@/@```$1$1"@0`#X("`@(```8 +M&!@8&!@8^`````````````````#X&!@8&!@8`````````!\8&!@8&!@8&!@8 +M&!@8'P```````!@8&!@8&!C_&!@8&!@8``#_````````````````````_P`` +M`````````````````/\```````````````````#_```````````````````` +M_P```!@8&!@8&!@?&!@8&!@8&!@8&!@8&/@8&!@8&!@8&!@8&!@8_P`````` +M``````````#_&!@8&!@8&!@8&!@8&!@8&!@8&!@``!@P8,!@,!@`_``````` +M8#`8#!@P8`#\`````````/YL;&QL;&P````````"!'X($'X@0``````X;&1@ +M\&!@8.;\`````````````!@`````````J@"J`*H`J@"J`*H`J@`````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````&!@`&!@\/#P8``````@(?LC(R,A^"`@`````.&QD8/!@8&#F_``` +M``````````````````````#&;#@0$/X0$!````````````````````````!\ +MQF`X;,;&;#@,QGP```"!F3QF9F8\F8$``````'R"FJ*BHIJ"?``````\;&P^ +M`'X``````````````#9LV&PV```````````````````````````````````` +M```````````````````````````````````````````````````\)"0\```` +M````````&!A^&!@`?@```````'S&!@0,&##&_@``````?,8&!CP&!L9\```` +M````````````````````````9F9F9GQ@8,``````?O3T]'04%!04```````` +M```8&```````````````````````````````"!@X&!@8&!A^`````#AL;#@` +M?```````````````V&PV;-@```````#`P,;,V#!FSIH^!@8``,#`QLS8,&#< +MA@P8/@``````-FS8;#8`````````,#``,#!@QL9\````,!@`$#ALQL;^QL8` +M```,&``0.&S&QO[&Q@```!!LQA`X;,;&_L;&````=MP`$#ALQL;^QL8````` +MQL80.&S&QO[&Q@```#AL.``X;,;&_L;&```````^;,S,_LS,S,X``````#QF +MPL#`PF8\#`9\`#`8#`#^8F!\8&+^````&#!@`/YB8'Q@8OX````0;,8`_F)@ +M?&!B_@````#&Q@#^8F!\8&+^````,!@`/!@8&!@8&#P````,&``\&!@8&!@8 +M/````#QF`#P8&!@8&!@\````9F8`/!@8&!@8&#P````````````````````` +M`';<`,;F]O[>SL;&````8#``.&S&QL;&;#@````,&``X;,;&QL9L.````!!L +M@CALQL;&QFPX````=MP`.&S&QL;&;#@`````QL8X;,;&QL9L.```````?LS, +MS,[,S,Q^```````".FS.UM;F;+B```!@,!@`QL;&QL;&?`````8,&`#&QL;& +MQL9\`````';<`,;&QL;&QGP`````QL8`QL;&QL;&?````,;&`,;&;#@0$!`X +M`````````````````````````'S&QMS&QOS`P,````!@,!@`>`Q\S,QV```` +M`!@P8`!X#'S,S'8`````$#AL`'@,?,S,=@``````=MP`>`Q\S,QV``````#, +MS`!X#'S,S'8`````.&PX`'@,?,S,=@````````!LNA)^D)A^`````````'C, +MP,QX&`QX````8#`8`'S&_L#&?``````,&#``?,;^P,9\`````!`X;`!\QO[` +MQGP``````,S,`'S&_L#&?`````#`8#``<#`P,#!X``````P8,``X&!@8&#P` +M````,'C,`'`P,#`P>```````S,P`<#`P,#!X```````````````````````` +M`';<`-QF9F9F9@````!@,!@`?,;&QL9\`````!@P8`!\QL;&QGP`````.&S& +M`'S&QL;&?```````=MP`?,;&QL9\``````#&Q@!\QL;&QGP``````````'R2 +MDIR0?@````````)\SM;6YGR``````&`P&`#,S,S,S'8`````&#!@`,S,S,S, +M=@`````P>,P`S,S,S,QV``````#,S`#,S,S,S'8``````,;&`,;&QL9^!@QX +=```````````````````````````````````````` +` +end diff --git a/usr.sbin/pcvt/fonts/vt220h.808.uu b/usr.sbin/pcvt/fonts/vt220h.808.uu new file mode 100644 index 0000000..c9585dc --- /dev/null +++ b/usr.sbin/pcvt/fonts/vt220h.808.uu @@ -0,0 +1,49 @@ +begin 644 vt220h.808 +M9%1,1"`@(#X\0#@$>"(^(CQ`.`1X-@@V?$!X0'PV"#9\0'A`?#X("'Q`>'P< +M(BH<.$1\1"PP*"1X1'A$>"`@/GA$>$1^$`P\1$1\1#X("`A`0$!\/B`\($1$ +M*!`^"`@(?$!X0#X@/"`\0$`\/"(\)CQ`.`1X'"($1X'"(,$#YX1'@<`@P"''A$1'@,$CX"9%1,(B0X)"(\0#@$ +M>"(<"'Q`>'P\(CP^/$`\(C(J)B)\0'A`?"(V*CQ`.`1X(B((!Y\ +M0'A`'B`>/#Q`3#P>(!X\>$1X3!X@'CQ$1#@>(!P"/'"(<(AP#!(,<(APB'`, +M!`YPB'"(?"0(/'"(<(QB#@(<<(APC'@2/@)PB'">`A\ +M)`@\<(AX#&(.`AQPB'@,>!(^`G"(>!YP'`(<<(AX#G`\(AQPB'@><@0("'"( +M>!QR'"(<<(AX''(.`AQPB'@(?!(>$G"(>!QR'!(<<(AX"'`.$`YPB'@(!YP'!`><(AX'G`<$!```'S&QOS`P````,945'P8`'S&!G[&?```8+`8 +M+$V&`````!@X&!H,````_+8V-@0``'SD<.1\````PJ08*L8``$1$*"@0$``` +M$!`H*$1$``#&QL;&QGP```#\!@8&_````'[`P,!^````PD(D&"08`/Z"*#BJ +M_@``QE14?!@\`````/YL;.X````$_@'^!````"1^@7XD````$!`H1.X`.$2" +MJKJJ1#@``-QV`/X``/Z"Q,1H:#``&"PL1$:&_@`````VS,PV```8&`!F9@`` +M`!PT,#`PL.`!`@0($"!`@(!`(!`(!`(!`0($"!`@0/\``#\0"`0"`1@8,&`P +M&!@8&!@,!@P8&!@```X8&!@8&!@8&!@8&`X```!P&!@8&!@8&!@8&!AP```" +M`@(B$@H&``#NQM;6?```9F8\&'X8`%@D&"0X8`QX`!@`QL9^#'@`P,#XS/C` +MP%`@4`P\9CP`\&!X;'A@\``.`&9F/!@\````1"@0*$0`_&9F]F9F_`#P$'(6 +M_CINP@``````&`QX&#!@````````````_@```'R"NJJRJH)\`````'@````` +M``!X"`@``,;&``````````($?AA^($````````#_````````_P```````/\` +M``````#_````````_P````````#N9F8L&````GS.UN9\@```?-;&+^`#A$ +M_F)X8OX`<`#^8GAB_@#^`#ALQO[&`#AL$&S&_L8`#@`X;,;^Q@!P`#ALQO[& +M```<#!X`````````&!@````('CIB>#P$&'@,.`QX````?(*:HJ*:@GP`P]L\ +M9CS;PP``S%1@4$P``'S&8#``,```?,9@,``P``!\QF`P`#```'S&8#``,``` +M?,9@,``P``!\QF`P`#```'S&8#``,```?,9@,``P``!\QF`P`#```'S&8#`` +M,```?,9@,``P``!\QF`P`#```'S&8#``,```?,9@,``P``!\QF`P`#```'S& +M8#``,```?,9@,``P``!\QF`P`#```'S&8#``,```?,9@,``P``!\QF`P`#`` +M`'S&8#``,```?,9@,``P``!\QF`P`#```'S&8#``,```?,9@,``P``!\QF`P +M`#```'S&8#``,```?,9@,``P``!\QF`P`#```'S&8#``,```?,9@,``P``!\ +MQF`P`#```'S&8#``,```?,9@,``P``!\QF`P`#```'S&8#``,```?,9@,``P +M``!\QF`P`#```'S&8#``,```?,9@,``P``!\QF`P`#```'S&8#``,```?,9@ +M,``P``!\QF`P`#```'S&8#``,```?,9@,``P``!\QF`P`#```'S&8#``,``` +M?,9@,``P``!\QF`P`#```'S&8#``,```?,9@,``P``!\QF`P`#```'S&8#`` +M,```?,9@,``P``!\QF`P`#```'S&8#``,```?,9@,``P``!\QF`P`#```'S& +M8#``,```?,9@,``P``!\QF`P`#```'S&8#``,```?,9@,``P``!\QF`P`#`` +M`'S&8#``,```?,9@,``P``!\QF`P`#```'S&8#``,```?,9@,``P``!\QF`P +M`#```'S&8#``,```?,9@,``P``!\QF`P`#```'S&8#``,```?,9@,``P``!\ +MQF`P`#```'S&8#``,```?,9@,``P``!\QF`P`#```'S&8#``,```?,9@,``P +M``!\QF`P`#```'S&8#``,```?,9@,``P``!\QF`P`#```'S&8#``,```?,9@ +M,``P``!\QF`P`#```'S&8#``,```?,9@,``P``!\QF`P`#```'S&8#``,``` +7?,9@,``P``!\QF`P`#```'S&8#``,`!@ +` +end diff --git a/usr.sbin/pcvt/fonts/vt220h.810.uu b/usr.sbin/pcvt/fonts/vt220h.810.uu new file mode 100644 index 0000000..04689b1 --- /dev/null +++ b/usr.sbin/pcvt/fonts/vt220h.810.uu @@ -0,0 +1,60 @@ +begin 644 vt220h.810 +M1&143$0@("`@/CQ`.`1X(B(^(B(\0#@$>"(4"!0B?$!X0'PB%`@4(GQ`>$!\ +M/@@("`A\0'A`?!PB(BH<.$1\1$0D*#`H)'A$>$1X("`@(#YX1'A$>!X@'`(\ +M1$1\1$0^"`@("$!`0$!\/B`\("!$1$0H$#X("`@(?$!X0$`^(#P@(#Q`0$`\ +M/"(\)"(\0#@$>!PB(B(`0,!`0. +M>$1$1'@<(@P0/GA$1$1X'`(,`AQX1$1$>`0($CX"1&143$0B)#@D(CQ`.`1X +M(A0("`A\0'A`?#PB/"(\/$!`0#PB,BHF(GQ`>$!\(C8J(B(\0#@$>"(B(B(< +M?$!X0'P>("`@'GQ`>$!`'B`<`CP\0$Q$/!X@'`(\>$1X2$0>(!P"/$1$1$0X +M'B`<`CQPB'"(<`P2$A(,<(APB'`$#`0$#G"(<(AP'"(,$#YPB'"(`AP +M!`P$!`YPB'@(`AP!`@2/@)PB'@(`AP/@($"`APB'@(`AP +M#!(>$A)PB'@(`AP'!(2$AQPB'@( +M<(AX"'`>$!P0$```?,;&QOS`P,````#&5%14?!@8`'S&!@9^QL9\``!@L#`8 +M&"Q-A@`````8.!@8&!H,````_+8V-C8&!`````!\Y'#D?`````#"I!@8*L8` +M``""@D1$*"@0$```$!`H*$1$@H(``,;&QL;&QGP`````_`8&!@;\`````'[` +MP,#`?@```,)")!@8)!@```#^@B@X*(+^``#&5%14?#@0.````/YL;&QL;.X` +M````!/X!_@0``````"1^@7XD`````!`0*"A$1.X``#A$@JJZJH)$.````-QV +M`/X``````/Z"Q,1H:#```!@8+"Q$1H;^```````V2$@V`````!@8``!F9@`` +M`!PT,#`P,+#@```!`@0($"!`@```@$`@$`@$`@$```$"!`@0($#_`````#\0 +M"`0"`0`8&!@P8#`8&!@8&!@8#`8,&!@8&```#A@8&!@8&!@8&!@8&!@8&`X` +M``!P&!@8&!@8&!@8&!@8&!@8<`````("`B(2"@8``````.[&UM9\``!F9CP8 +M&'X8&`!8)!@8)#A@>`1X`!@P`,;&QGX,>`#`P/C,S/C`P```4"!0&`P\9F8\ +M`/!@>&QX8&#P``8,`&9F/!@8/`````!$*!`H1````/QF9O9F9F;\`/`0&!B_@`X;`#^8GA@8OX`,!@`_F)X8&+^`';<`!`X +M;,;^Q@`X;``0.&S&_L8`#!@`$#ALQO[&`&`P`!`X;,;^Q@``#!P,#!X````` +M`````!@8```````('CID8'@\!!@`>`PX#'@``````'R"FJ*BHIJ"?`##VSQF +M9CS;PP``````S%1@4$P``'S&QF`P,``P``!\QL9@,#``,```?,;&8#`P`#`` +M`'S&QF`P,``P``!\QL9@,#``,```?,;&8#`P`#```'S&QF`P,``P``!\QL9@ +M,#``,```?,;&8#`P`#```'S&QF`P,``P``!\QL9@,#``,```?,;&8#`P`#`` +M`'S&QF`P,``P``!\QL9@,#``,```?,;&8#`P`#```'S&QF`P,``P``!\QL9@ +M,#``,```?,;&8#`P`#```'S&QF`P,``P``!\QL9@,#``,```?,;&8#`P`#`` +M`'S&QF`P,``P``!\QL9@,#``,```?,;&8#`P`#```'S&QF`P,``P``!\QL9@ +M,#``,```?,;&8#`P`#```'S&QF`P,``P``!\QL9@,#``,```?,;&8#`P`#`` +M`'S&QF`P,``P``!\QL9@,#``,```?,;&8#`P`#```'S&QF`P,``P``!\QL9@ +M,#``,```?,;&8#`P`#```'S&QF`P,``P``!\QL9@,#``,```?,;&8#`P`#`` +M`'S&QF`P,``P``!\QL9@,#``,```?,;&8#`P`#```'S&QF`P,``P``!\QL9@ +M,#``,```?,;&8#`P`#```'S&QF`P,``P``!\QL9@,#``,```?,;&8#`P`#`` +M`'S&QF`P,``P``!\QL9@,#``,```?,;&8#`P`#```'S&QF`P,``P``!\QL9@ +M,#``,```?,;&8#`P`#```'S&QF`P,``P``!\QL9@,#``,```?,;&8#`P`#`` +M`'S&QF`P,``P``!\QL9@,#``,```?,;&8#`P`#```'S&QF`P,``P``!\QL9@ +M,#``,```?,;&8#`P`#```'S&QF`P,``P``!\QL9@,#``,```?,;&8#`P`#`` +M`'S&QF`P,``P``!\QL9@,#``,```?,;&8#`P`#```'S&QF`P,``P``!\QL9@ +M,#``,```?,;&8#`P`#```'S&QF`P,``P``!\QL9@,#``,```?,;&8#`P`#`` +M`'S&QF`P,``P``!\QL9@,#``,```?,;&8#`P`#```'S&QF`P,``P``!\QL9@ +M,#``,```?,;&8#`P`#```'S&QF`P,``P``!\QL9@,#``,```?,;&8#`P`#`` +M`'S&QF`P,``P``!\QL9@,#``,```?,;&8#`P`#```'S&QF`P,``P``!\QL9@ +M,#``,```?,;&8#`P`#```'S&QF`P,``P``!\QL9@,#``,```?,;&8#`P`#`` +H`'S&QF`P,``P``!\QL9@,#``,```?,;&8#`P`#```'S&QF`P,``P`#`P +` +end diff --git a/usr.sbin/pcvt/fonts/vt220h.814.uu b/usr.sbin/pcvt/fonts/vt220h.814.uu new file mode 100644 index 0000000..9d49552 --- /dev/null +++ b/usr.sbin/pcvt/fonts/vt220h.814.uu @@ -0,0 +1,83 @@ +begin 644 vt220h.814 +M`$1D5$Q$`"`@("`^````/$`X!'@`(B(^(B(````\0#@$>``B%`@4(@```'Q` +M>$!\`"(4"!0B````?$!X0'P`/@@("`@```!\0'A`?``<(B(J'`(``#A$?$1$ +M`"0H,"@D````>$1X1'@`("`@(#X```!X1'A$>``>(!P"/````$1$?$1$`#X( +M"`@(````0$!`0'P`/B`\("````!$1$0H$``^"`@("````'Q`>$!``#X@/"`@ +M````/$!`0#P`/"(\)"(````\0#@$>``<(B(B'````#Q`.`1X`!P("`@<```` +M>$1$1'@`("`@(#X```!X1$1$>``$#`0$#@```'A$1$1X`!PB#!`^````>$1$ +M1'@`'`(,`AP```!X1$1$>``$"!(^`@```$1D5$Q$`"(D."0B````/$`X!'@` +M(A0("`@```!\0'A`?``\(CPB/````#Q`0$`\`"(R*B8B````?$!X0'P`(C8J +M(B(````\0#@$>``B(B(B'````'Q`>$!\`!X@("`>````?$!X0$``'B`<`CP` +M```\0$Q$/``>(!P"/````'A$>$A$`!X@'`(\````1$1$1#@`'B`<`CP```!P +MB'"(<``,$A(2#````'"(<(AP``0,!`0.````<(APB'``'"(,$#X```!PB'"( +M<``<`@P"'````'"(<(AP``0($CX"````<(APB'``'A`<`AP```!PB'"(<``< +M(#PB'````'"(<(AP`#X"!`@(````<(APB'``'"(<(AP```!PB'"(<``<(AX" +M'````'"(<(AP``P2'A(2````<(APB'``'!(<$AP```!PB'"(<``.$!`0#@`` +M`'"(<(AP`!P2$A(<````<(APB'``'A`<$!X```!PB'"(<``>$!P0$````'"( +M>`AP``P2$A(,````<(AX"'``!`P$!`X```!PB'@(<``<(@P0/@```'"(>`AP +M`!P"#`(<````<(AX"'``!`@2/@(```!PB'@(<``>$!P"'````'"(>`AP`!P@ +M'"(<````<(AX"'``/@($"`@```!PB'@(<``<(APB'````'"(>`AP`!PB'@(< +M````<(AX"'``#!(>$A(```!PB'@(<``<$AP2'````'"(>`AP``X0$!`.```` +M<(AX"'``'!(2$AP```!PB'@(<``>$!P0'@```'"(>`AP`!X0'!`0```````` +M`'S&QL;&_,#`P``````8V]O;V]M^&!@8````?,8&!G[&QGP``````,#`8#`8 +M'#9C00`````````P<#`P,#08``````````#<9F9F9F8&!@8``````'S&\,#& +M?`````````#BMAP8.&S&````````@L;&;&PX.!`````````0.#AL;,;&@@`` +M`````,;&QL;&QL9\`````````/P&!@8&_```````````?L#`P,!^```````` +M``#&9CP8/&8\``````#^Q@!L?&P`QOX``````#P8V]O;VWX8/```````_FQL +M;&QL;&SN````````"`S^`_X,"``````````D9G[#?F8D```````````0$"@H +M1$3N```````\9L/G_^?#9CP``````````-QV`/X``````````/[&QLQL:#@P +M````````&#@L;$3&QOX``````````&[8V&X````````````8&```9F8````` +M```<-#`P,#`PL.`````````!`@0($"!`@````````(!`(!`(!`(!```````` +M``$"!`@0('\````````````_$`@$`@$``!@8&!@8,&`P&!@8&!@8&!@8&!@, +M!@P8&!@8&!@```X8&!@8&!@8&!@8&!@8&!@8&!@8&!@.``````!P&!@8&!@8 +M&!@8&!@8&!@8&!@8&!@8<````````@("`B(2"@8"``````````!LQM;6UFP` +M`````,S,>#`P_#`P,```````X'S@P'C`P&`X#'@```P8,`#&QL;&?@8,>``` +M`,#`^,S,^,#`P`````#8<.`P&`P^9F8\``````#P8'AL>&!@8/`````,&`#, +MS,QX,#`P>`````````!$*!`H1`````````#\9F9F]F9F9OP```#P$'`6_!@P +M9LZ:/@8&```````````````8#'@`&#!@``````````````````````#^```` +M````````?(*ZJKJRJH)\````````````>````````````````'@("``````` +M`,;&`````````````````````@9^"!!^8$```````````````````/\````` +M`````````/\``````````````/\``````````````/\``````````````/\` +M``````````````````#N;F9F;#@````````&?,[>]N9\P```````````?-;6 +MW-!^``````!VW`!\QL;&QGP``````';<`'@,?,S,=@```,S,`,S,2'@P,#!X +M````.&S&`,;&QL;&QGP````&#!@`QL;&QL;&?````&`P&`#&QL;&QL9\```` +M```&/FS.UM;F;/C``````'[,S,S.S,S,?@```';<`#ALQL;&QFPX````.&S& +M.&S&QL;&;#@````,&``X;,;&QL9L.````&`P`#ALQL;&QFPX````9F8`/!@8 +M&!@8&#P````\9@`\&!@8&!@8/`````P8`#P8&!@8&!@\````,!@`/!@8&!@8 +M&#P```#&Q@#^9F)X8&)F_@```#ALQ@#^9F!X8&;^````,!@,`/YF8'A@9OX` +M``!VW``0.&S&QO[&Q@```#ALQA`X;,;&_L;&````#!@`$#ALQL;^QL8````P +M&``0.&S&QO[&Q@`````,'`P,'@`````````````````8&````````````.`\ +M8,#`P,!@.`QX```\!AP&/`````````````!\@IJBHJ*:@GP```````##VSQF +M9CS;PP``````````YFQX;&9F``````!\QL9@,#``,#```````'S&QF`P,``P +M,```````?,;&8#`P`#`P``````!\QL9@,#``,#```````'S&QF`P,``P,``` +M````?,;&8#`P`#`P``````!\QL9@,#``,#```````'S&QF`P,``P,``````` +M?,;&8#`P`#`P``````!\QL9@,#``,#```````'S&QF`P,``P,```````?,;& +M8#`P`#`P``````!\QL9@,#``,#```````'S&QF`P,``P,```````?,;&8#`P +M`#`P``````!\QL9@,#``,#```````'S&QF`P,``P,```````?,;&8#`P`#`P +M``````!\QL9@,#``,#```````'S&QF`P,``P,```````?,;&8#`P`#`P```` +M``!\QL9@,#``,#```````'S&QF`P,``P,```````?,;&8#`P`#`P``````!\ +MQL9@,#``,#```````'S&QF`P,``P,```````?,;&8#`P`#`P``````!\QL9@ +M,#``,#```````'S&QF`P,``P,```````?,;&8#`P`#`P``````!\QL9@,#`` +M,#```````'S&QF`P,``P,```````?,;&8#`P`#`P``````!\QL9@,#``,#`` +M`````'S&QF`P,``P,```````?,;&8#`P`#`P``````!\QL9@,#``,#`````` +M`'S&QF`P,``P,```````?,;&8#`P`#`P``````!\QL9@,#``,#```````'S& +MQF`P,``P,```````?,;&8#`P`#`P``````!\QL9@,#``,#```````'S&QF`P +M,``P,```````?,;&8#`P`#`P``````!\QL9@,#``,#```````'S&QF`P,``P +M,```````?,;&8#`P`#`P``````!\QL9@,#``,#```````'S&QF`P,``P,``` +M````?,;&8#`P`#`P``````!\QL9@,#``,#```````'S&QF`P,``P,``````` +M?,;&8#`P`#`P``````!\QL9@,#``,#```````'S&QF`P,``P,```````?,;& +M8#`P`#`P``````!\QL9@,#``,#```````'S&QF`P,``P,```````?,;&8#`P +M`#`P``````!\QL9@,#``,#```````'S&QF`P,``P,```````?,;&8#`P`#`P +M``````!\QL9@,#``,#```````'S&QF`P,``P,```````?,;&8#`P`#`P```` +M``!\QL9@,#``,#```````'S&QF`P,``P,```````?,;&8#`P`#`P``````!\ +MQL9@,#``,#```````'S&QF`P,``P,```````?,;&8#`P`#`P``````!\QL9@ +M,#``,#```````'S&QF`P,``P,```````?,;&8#`P`#`P``````!\QL9@,#`` +M,#```````'S&QF`P,``P,```````?,;&8#`P`#`P``````!\QL9@,#``,#`` +M`````'S&QF`P,``P,```````?,;&8#`P`#`P``````!\QL9@,#``,#`````` +M`'S&QF`P,``P,```````?,;&8#`P`#`P``````!\QL9@,#``,#```````'S& +MQF`P,``P,```````?,;&8#`P`#`P``````!\QL9@,#``,#```````'S&QF`P +M,``P,```````?,;&8#`P`#`P``````!\QL9@,#``,#```````'S&QF`P,``P +M,```````?,;&8#`P`#`P``````!\QL9@,#``,#```````'S&QF`P,``P,``` +=````?,;&8#`P`#`P``````!\QL9@,#``,#`````` +` +end diff --git a/usr.sbin/pcvt/fonts/vt220h.816.uu b/usr.sbin/pcvt/fonts/vt220h.816.uu new file mode 100644 index 0000000..401db37 --- /dev/null +++ b/usr.sbin/pcvt/fonts/vt220h.816.uu @@ -0,0 +1,95 @@ +begin 644 vt220h.816 +M``!$9%1,1``@("`@/@``````/$`X!'@`(B(^(B(``````#Q`.`1X`"(4"!0B +M``````!\0'A`?``B%`@4(@``````?$!X0'P`/@@("`@``````'Q`>$!\`!PB +M(BH<`@`````X1'Q$1``D*#`H)```````>$1X1'@`("`@(#X``````'A$>$1X +M`!X@'`(\``````!$1'Q$1``^"`@("```````0$!`0'P`/B`\("```````$1$ +M1"@0`#X("`@(``````!\0'A`0``^(#P@(```````/$!`0#P`/"(\)"(````` +M`#Q`.`1X`!PB(B(<```````\0#@$>``<"`@('```````>$1$1'@`("`@(#X` +M`````'A$1$1X``0,!`0.``````!X1$1$>``<(@P0/@``````>$1$1'@`'`(, +M`AP``````'A$1$1X``0($CX"``````!$9%1,1``B)#@D(@``````/$`X!'@` +M(A0("`@``````'Q`>$!\`#PB/"(\```````\0$!`/``B,BHF(@``````?$!X +M0'P`(C8J(B(``````#Q`.`1X`"(B(B(<``````!\0'A`?``>("`@'@`````` +M?$!X0$``'B`<`CP``````#Q`3$0\`!X@'`(\``````!X1'A(1``>(!P"/``` +M````1$1$1#@`'B`<`CP`````<(APB'``#!(2$@P``````'"(<(AP``0,!`0. +M``````!PB'"(<``<(@P0/@``````<(APB'``'`(,`AP``````'"(<(AP``0( +M$CX"``````!PB'"(<``>$!P"'```````<(APB'``'"`\(AP``````'"(<(AP +M`#X"!`@(``````!PB'"(<``<(APB'```````<(APB'``'"(>`AP``````'"( +M<(AP``P2'A(2``````!PB'"(<``<$AP2'```````<(APB'``#A`0$`X````` +M`'"(<(AP`!P2$A(<``````!PB'"(<``>$!P0'@``````<(APB'``'A`<$!`` +M`````'"(>`AP``P2$A(,``````!PB'@(<``$#`0$#@``````<(AX"'``'"(, +M$#X``````'"(>`AP`!P"#`(<``````!PB'@(<``$"!(^`@``````<(AX"'`` +M'A`<`AP``````'"(>`AP`!P@/"(<``````!PB'@(<``^`@0("```````<(AX +M"'``'"(<(AP``````'"(>`AP`!PB'@(<``````!PB'@(<``,$AX2$@`````` +M<(AX"'``'!(<$AP``````'"(>`AP``X0$!`.``````!PB'@(<``<$A(2'``` +M````<(AX"'``'A`<$!X``````'"(>`AP`!X0'!`0`````````````#YC8V-C +M?F!@8&```````!C;V]O;VWX8&!@8`````'S&!@9^QL9\`````````,#`8#`8 +M'#9C00```````````#!P,#`P-!@`````````````W&9F9F9F!@8&!@`````` +M``!\Y'#D?````````````.:V'!@X;,8```````````""QD1L*#@0```````` +M````$#@H;$3&@@````````#&QL;&QL;&QGP``````````/P&!@8&_``````` +M``````!^P,#`P'X``````````````,9F/!@\9CP```````#^Q@!L?'QL`,;^ +M```````\&-O;V]O;?A@8/````````/YL;&QL;&QL;.X```````````@,_@/^ +M#`@````````````D9G[#?F8D````````````$!`X*&Q$1.X````````X1(*J +MNKJJ@D0X````````````W'8`_@``````````````_H+$Q&AH,#`````````` +M`!@8+"Q$1H;^````````````=HB(=@``````````````&!@``&9F```````` +M```,'A@8&!@8&'@P```````````!`@0($"!`@```````````@$`@$`@$`@$` +M```````````!`@0($"!_```````````````_$`@$`@$````8&!@8&!@P8#`8 +M&!@8&!@8&!@8&!@8#`8,&!@8&!@8&```#A@8&!@8&!@8&!@8&!@8&!@8&!@8 +M&!@8&`X```````!P&!@8&!@8&!@8&!@8&!@8&!@8&!@8&!@8<``````````" +M`@("(A(*!@(``````````````&S&UM9L````````9F9F/!@8?A@8&``````` +M<#YP8#Q@8#````````````1"@0*$0```````````#\9F9F]F9F9F;\`````.`0```&#!@```````````````````````` +M``#^`````````````'R"NJJJLJJJ@GP``````````````'@````````````` +M`````'@("`````````#&Q@```````````````````````@9^"!!^8$`````` +M````````````````_P````````````````#_`````````````````/\````` +M````````````_P````````````````#_````````````````````````YF9B +M8C08```````````&?,[>]N9\P`````````````!\UM;V-C8?@````!VW``X;,;&QL;&;#@` +M````.&S&.&S&QL;&QFPX``````P8`#ALQL;&QL9L.`````!@,``X;,;&QL;& +M;#@`````9F8`/!@8&!@8&!@\`````!@\9@`\&!@8&!@8/``````&#!@`/!@8 +M&!@8&#P`````8#`8`#P8&!@8&!@\`````,;&`/YB8&!\8&!B_@`````X;,8` +M_F)@?&!@8OX`````8#`8`/YB8'Q@8&+^`````';<`!`X;,;&_L;&Q@`````X +M;,80.&S&QO[&QL8`````&#!@$#ALQL;^QL;&`````#`8#!`X;,;&_L;&Q@`` +M````"!@("!P`````````````````````&!@`````````````X#Q@P,#`8#@, +M>```````.`08!#@```````````````!\@IJBHJ*BFH)\``````````##VSQF +M9CS;PP``````````````YFYX;&8```````!\QL9@,#`P`#`P```````````` +M`````````````````'S&QF`P,#``,#````````!\QL9@,#`P`#`P```````` +M?,;&8#`P,``P,````````'S&QF`P,#``,#````````!\QL9@,#`P`#`P```` +M````?,;&8#`P,``P,````````'S&QF`P,#``,#````````!\QL9@,#`P`#`P +M````````?,;&8#`P,``P,````````'S&QF`P,#``,#````````!\QL9@,#`P +M`#`P````````?,;&8#`P,``P,````````'S&QF`P,#``,#````````!\QL9@ +M,#`P`#`P````````?,;&8#`P,``P,````````'S&QF`P,#``,#````````!\ +MQL9@,#`P`#`P````````?,;&8#`P,``P,````````'S&QF`P,#``,#`````` +M``!\QL9@,#`P`#`P````````?,;&8#`P,``P,````````'S&QF`P,#``,#`` +M``````!\QL9@,#`P`#`P````````?,;&8#`P,``P,````````'S&QF`P,#`` +M,#````````!\QL9@,#`P`#`P````````?,;&8#`P,``P,````````'S&QF`P +M,#``,#````````!\QL9@,#`P`#`P````````?,;&8#`P,``P,````````'S& +MQF`P,#``,#````````!\QL9@,#`P`#`P````````?,;&8#`P,``P,``````` +M`'S&QF`P,#``,#````````!\QL9@,#`P`#`P````````?,;&8#`P,``P,``` +M`````'S&QF`P,#``,#````````!\QL9@,#`P`#`P````````?,;&8#`P,``P +M,````````'S&QF`P,#``,#````````!\QL9@,#`P`#`P````````?,;&8#`P +M,``P,````````'S&QF`P,#``,#````````!\QL9@,#`P`#`P````````?,;& +M8#`P,``P,````````'S&QF`P,#``,#````````!\QL9@,#`P`#`P```````` +M?,;&8#`P,``P,````````'S&QF`P,#``,#````````!\QL9@,#`P`#`P```` +M````?,;&8#`P,``P,````````'S&QF`P,#``,#````````!\QL9@,#`P`#`P +M````````?,;&8#`P,``P,````````'S&QF`P,#``,#````````!\QL9@,#`P +M`#`P````````?,;&8#`P,``P,````````'S&QF`P,#``,#````````!\QL9@ +M,#`P`#`P````````?,;&8#`P,``P,````````'S&QF`P,#``,#````````!\ +MQL9@,#`P`#`P````````?,;&8#`P,``P,````````'S&QF`P,#``,#`````` +M``!\QL9@,#`P`#`P````````?,;&8#`P,``P,````````'S&QF`P,#``,#`` +M``````!\QL9@,#`P`#`P````````?,;&8#`P,``P,````````'S&QF`P,#`` +M,#````````!\QL9@,#`P`#`P````````?,;&8#`P,``P,````````'S&QF`P +M,#``,#````````!\QL9@,#`P`#`P````````?,;&8#`P,``P,````````'S& +MQF`P,#``,#````````!\QL9@,#`P`#`P````````?,;&8#`P,``P,``````` +M`'S&QF`P,#``,#````````!\QL9@,#`P`#`P````````?,;&8#`P,``P,``` +M`````'S&QF`P,#``,#````````!\QL9@,#`P`#`P````````?,;&8#`P,``P +M,````````'S&QF`P,#``,#````````!\QL9@,#`P`#`P````````?,;&8#`P +M,``P,````````'S&QF`P,#``,#````````!\QL9@,#`P`#`P````````?,;& +M8#`P,``P,````````'S&QF`P,#``,#````````!\QL9@,#`P`#`P```````` +M?,;&8#`P,``P,````````'S&QF`P,#``,#`````````````````````````` +!`,;& +` +end diff --git a/usr.sbin/pcvt/fonts/vt220l.808.uu b/usr.sbin/pcvt/fonts/vt220l.808.uu new file mode 100644 index 0000000..02ad944 --- /dev/null +++ b/usr.sbin/pcvt/fonts/vt220l.808.uu @@ -0,0 +1,49 @@ +begin 644 vt220l.808 +M``````````!^@:6!O9F!?G[_V__#Y_]^;/[^_GPX$``0.'S^?#@0`#A\./[^ +MUA`X$#A\_OY\$#@``!@\/!@``/__Y\/#Y___/&;#P\/#9CS_PYF]O9G#_Q\' +M#7G-S,QX/&9F9CP8?A@X/#8R-'#PX']C?V-C9^;`&-L\Y^<\VQB`X/C^^."` +M``(./OX^#@(`&#Q^&!A^/!AF9F9F9@!F`'_;VWL;&QL`?L/\9F8_PWX``'Y^ +M?@```!@\?AA^/!C_&#Q^&!@8&``8&!@8?CP8```8#/X,&````#!@_F`P```` +M`&!@8'X````D9O]F)````!`X?/[^````_OY\.!``````````````&#P\&!@` +M&`!L;&P``````&QL_FS^;&P`,'S`?`;\,```QLP8,&;&`#AL.';]N;&?``P<+`P,##\`'C,##A@ +MP/P`>,P,.`S,>```/S`^`P,S'@`>,S`^,S,>`#\S`P8,#`P`'C, +MS'C,S'@`>,S,?`S,>```,#```#`P```P,```,#!@&#!@P&`P&````'X``'X` +M`#`8#`8,&#``/&8&#!@`&`!\QM[>WL!^`#!XS,S\S,P`_&9F?&9F_``\9L#` +MP&8\`/AL9F9F;/@`_F)H>&AB_@#^8FAX:&#P`#QFP,#.9CX`S,S,_,S,S`!X +M,#`P,#!X`!X,#`S,S'@`YFQX<'ALY@#P8&!@8F;^`,;N_M;&QL8`QN;VWL[& +MQ@`X;,;&QFPX`/QF9GQ@8/``>,S,S-QX'`#\9F9\;&;F`'C,P'@,S'@`_+0P +M,#`P>`#,S,S,S,QX`,S,S,S,>#``QL;&UO[^Q@#&QFPX.&S&`,S,S'@P,'@` +M_,R8,&3,_`!X8&!@8&!X`,!@,!@,!@(`>!@8&!@8>``0.&S&```````````` +M``#_,#`8`````````'@,?,QV`.!@8'QF9OP```!XS,#,>``<#`Q\S,Q^```` +M>,S\P'@`.&Q@^&!@\````';,S'P,^.!@;'9F9N8`,`!P,#`P>``,`!P,#,S, +M>.!@9FQX;.8`<#`P,#`P>````,S^_M;&````^,S,S,P```!XS,S,>````-QF +M9GQ@\```=LS,?`P>``#<=F!@\````'S`?`;\`!`P?#`P-AP```#,S,S,=@`` +M`,;&QGPX````QM;^_FP```#&;#ALQ@```,S,S'P,^```_)@P9/P`'#`PX#`P +M'``8&!@`&!@8`.`P,!PP,.``=MP````````0.&QLQL;^`'C,P,QX&`QX`,P` +MS,S,?@`<`'C,_,!X`'[#/`8^9C\`S`!X#'S,?@#@`'@,?,Q^`#`P>`Q\S'X` +M``!XP,!X##A^PSQF?F`\`,P`>,S\P'@`X`!XS/S`>`#,`'`P,#!X`'S&.!@8 +M&#P`X`!P,#`P>`#&.&S&_L;&`#`P`'C,_,P`'`#\8'A@_````'\,?\Q_`#YL +MS/[,S,X`>,P`>,S,>```S`!XS,QX``#@`'C,S'@`>,P`S,S,?@``X`#,S,Q^ +M``#,`,S,?`SXPQ@\9F8\&`#,`,S,S,QX`!@8?L#`?A@8.&QD\&#F_`#,S'C\ +M,/PP,/C,S/K&S\;'#AL8/!@8V'`<`'@,?,Q^`#@`<#`P,'@``!P`>,S,>``` +M'`#,S,Q^``#X`/C,S,P`_`#,[/S`````#\P,```````/P,#```P\;,WC-FS`_#QLS;-V_/`Q@8`!@8&!@``#-F +MS&8S````S&8S9LP``"*((H@BB"*(5:I5JE6J5:K;=]ONVW?;[A@8&!@8&!@8 +M&!@8&/@8&!@8&/@8^!@8V-C;V-C8V`````/XV-C8``/@8^!@8V]@;V +M-C8V-C8V-C8V-C8``/X&]C8V-C8V]@;^````-C8V-OX````8&/@8^``````` +M``#X&!@8&!@8&!\````8&!@8_P````````#_&!@8&!@8&!\8&!@`````_P`` +M`!@8&!C_&!@8&!@?&!\8&!@V-C8V-S8V-C8V-S`_```````_,#&QL;&P```!P +7&#!@>```````/#P\/``````````````` +` +end diff --git a/usr.sbin/pcvt/fonts/vt220l.810.uu b/usr.sbin/pcvt/fonts/vt220l.810.uu new file mode 100644 index 0000000..7cba2cb --- /dev/null +++ b/usr.sbin/pcvt/fonts/vt220l.810.uu @@ -0,0 +1,60 @@ +begin 644 vt220l.810 +M`````````````'Z!I:6!@;V9@7Y^_]O;___#Y_]^;/[^?'PX.!`0````$#A\ +M_GPX$``X?'PX?/[^?#A\$!`X.'S^_GPX?````!@\/!@```#____GP\/G____ +M```\9D)"9CP``/__PYF]O9G#__\`#PQL;&QL`/&8P;,9L&,QX```````` +M?GY^?@`8&#Q^&!A^/!C_&!@\/'X8&!@8&!@8&!@8?CP\&!@`````&`S^#!@` +M`````#!@_F`P``````#`P,#`_@``````)&;_9B0``!@8/#Q^?O__``#__WY^ +M/#P8&```````````````,'AX>#`P`#`P`&QL;"@```````!L;/YL;&S^;&P` +M&'[8V'PV-OPP`,;,#!@X,&!FQ@`X;&PX,';#`P,#`S,S'@`YF9L;'AL;&;F`/!@8&!@ +M8&)F_@#&[O[^UL;&QL8`QN;F]M[.SL;&`#ALQL;&QL9L.`#\9F9F?&!@8/`` +M?,;&QL;&SGP.`/QF9F9X;&QFY@!\QL!@.`P&QGP`?EH8&!@8&!@\`,;&QL;& +MQL;&?`!F9F9F9F9F/!@`QL;&QL;6_N[&`,;&;#@0.&S&Q@#,S,S,>#`P,'@` +M_L:,&#!@PL;^`!X8&!@8&!@8'@``8&`P,!@8#`P`\#`P,#`P,##P`!`X;,8` +M``````````````````#_,#`8`````````````'@,?,S,=@#@8&!\9F9F9MP` +M````?,;`P,9\`!P,#'S,S,S,=@````!\QO[`P'P`.&Q@\&!@8&#P`````';, +MS'P,S'C@8&!L=F9F9N8`,#``<#`P,#!X``P,``P,#`S,S'C@8&!F;'AX;.8` +M<#`P,#`P,#!X`````,S^_M;6U@````#````W'9F8&#P`````'S&`Q\S,QV``!P`'@,?,S,=@`P,`!X#'S,S'8` +M````?L#`P'X&/#QF`#QF?F!@/`#,``!\QO[`P'P``'``?,;^P,!\``#,`'`P +M,#`P>``X;``X&!@8&#P``.``<#`P,#!X`,8`.&S&_L;&Q@`P,`!XS/S,S,P` +M'`#\8&!X8&#\`````'X;?MC8?P`^;,S,_LS,S,X`.&P`?,;&QL9\``#&`'S& +MQL;&?```<`!\QL;&QGP`>,P`S,S,S,QV``!P`,S,S,S,=@``Q@#&QL9^!@;\ +MQCALQL;&QFPX`,8`QL;&QL;&?``8&'[`P,#`?A@8.&QD8/A@8.;\`,S,>##\ +M,/PP,`#XS,S,^L;/QL<`#AL8&#P8&!C8<``<`'@,?,S,=@``.`!P,#`P,'@` +M`!P`?,;&QL9\```<`,S,S,S,=@!P_AP`W.;&QL8`_@#&YO;^WL[&`#QL;&P^ +M`'X````X;&QL.`!\````,``P,&#`QL9\``````#^P,``````````_@8&```` +MP\;,V#Y[PP8,#\/&S-DS9\T/`P,8&``8&#P\/!@`````,V;,9C,``````,QF +M,V;,```BB"*((H@BB"*(5:I5JE6J5:I5JMMWV^[;=]ONVW<8&!@8&!@8&!@8 +M&!@8&!CX&!@8&!@8&/@8^!@8&!@V-C8V-O8V-C8V``````#^-C8V-@```/@8 +M^!@8&!@V-C;V!O8V-C8V-C8V-C8V-C8V-@```/X&]C8V-C8V-C;V!OX````` +M-C8V-C;^`````!@8&/@8^````````````/@8&!@8&!@8&!@?`````!@8&!@8 +M_P```````````/\8&!@8&!@8&!@?&!@8&```````_P`````8&!@8&/\8&!@8 +M&!@8'Q@?&!@8V-C8V-S8V-C8V-C8W,#\`````````/S`W-C8V-C8V-O<` +M_P````````#_`/`````!F9F9V;&#`````=MP8&!@8`#P8?MO;VWX8/``X;,;&_L;&;#@` +M.&S&QL9L;&SN`!PR,!A\S,S,>`````!VV]O;;@```P9\S]O;\SY@P```'#!@ +M?&`P'````'S&QL;&QL8`````_@#^`/X`````,##\,#``_`!@,!@,&#!@`/X` +M#!@P8#`8#`#^``X;&Q@8&!@8&!@8&!@8&!@8V-AP```P,`#\`#`P`````';< +M`';<```X;&QL.````````````!@8````````````&``````/#`P,[&QL-#P< +H>&QL;&QL`````'#8&'#`^``````````\/#P\`````````````````&QL +` +end diff --git a/usr.sbin/pcvt/fonts/vt220l.814.uu b/usr.sbin/pcvt/fonts/vt220l.814.uu new file mode 100644 index 0000000..7d918bb --- /dev/null +++ b/usr.sbin/pcvt/fonts/vt220l.814.uu @@ -0,0 +1,83 @@ +begin 644 vt220l.814 +M`````````````````````'Z!I8&!O9F!?@``````?O_;___#Y_]^```````` +M;/[^_OY\.!`````````0.'S^?#@0````````&#P\Y^?G&!@\```````8/'[_ +M_WX8&#P``````````!@\/!@``````/______Y\/#Y_______`````#QF0D)F +M/`````#_____PYF]O9G#_____P``'@X:,GC,S,QX```````\9F9F/!A^&!@` +M`````#\S/S`P,'#PX```````?V-_8V-C9^?FP``````8&-L\YSS;&!@````` +M`(#`X/C^^.#`@````````@8./OX^#@8"```````8/'X8&!A^/!@``````&9F +M9F9F9@!F9@``````?]O;VWL;&QL;`````'S&8#ALQL9L.`S&?``````````` +M`/[^_@``````&#Q^&!@8?CP8?@`````8/'X8&!@8&!@``````!@8&!@8&'X\ +M&``````````8#/X,&````````````#!@_F`P`````````````,#`P/X````` +M```````H;/YL*```````````$#@X?'S^_@````````#^_GQ\.#@0```````` +M```````````````````8/#P\&!@`&!@`````9F9F)```````````````;&S^ +M;&QL_FQL````&!A\QL+`?`:&QGP8&```````PL8,&#!FQ@``````.&QL.';< +MS,QV`````#`P,&````````````````P8,#`P,#`8#```````,!@,#`P,#!@P +M`````````&8\_SQF````````````&!A^&!@`````````````````&!@8,``` +M````````_@`````````````````````8&````````@8,&#!@P(````````!\ +MQL[>]N;&QGP``````!@X>!@8&!@8?@``````?,8&#!@P8,;^``````!\Q@8& +M/`8&QGP```````PWMS`?```````$#ALQL;^QL;&``````#\9F9F?&9F9OP``````#QFPL#` +MP,)F/```````^&QF9F9F9FSX``````#^9F)H>&AB9OX``````/YF8FAX:&!@ +M\```````/&;"P,#>QF8Z``````#&QL;&_L;&QL8``````#P8&!@8&!@8/``` +M````'@P,#`P,S,QX``````#F9FQL>&QL9N8``````/!@8&!@8&)F_@`````` +MQN[^_M;&QL;&``````#&YO;^WL[&QL8``````#ALQL;&QL9L.```````_&9F +M9GQ@8&#P``````!\QL;&QM;>?`P.`````/QF9F9\;&9FY@``````?,;&8#@, +MQL9\``````!^?EH8&!@8&#P``````,;&QL;&QL;&?```````QL;&QL;&;#@0 +M``````#&QL;&UM;^?&P``````,;&;#@X.&S&Q@``````9F9F9CP8&!@\```` +M``#^QHP8,&#"QOX``````#PP,#`P,#`P/```````@,#@<#@<#@8"```````\ +M#`P,#`P,##P````0.&S&`````````````````````````````/\`,#`8```` +M`````````````````'@,?,S,=@``````X&!@>&QF9F9\``````````!\QL#` +MQGP``````!P,##QLS,S,=@``````````?,;^P,9\```````X;&1@\&!@8/`` +M`````````';,S,Q\#,QX````X&!@;'9F9F;F```````8&``X&!@8&#P````` +M``8&``X&!@8&9F8\````X&!@9FQX;&;F```````X&!@8&!@8&#P````````` +M`.S^UM;6Q@``````````W&9F9F9F``````````!\QL;&QGP``````````-QF +M9F9\8&#P````````=LS,S'P,#!X```````#<=F9@8/```````````'S&`Q\S,QV +M``````#,S`!X#'S,S'8`````8#`8`'@,?,S,=@`````X;#@`>`Q\S,QV```` +M`````#QF8&8\#`8\````$#AL`'S&_L#&?```````S,P`?,;^P,9\`````&`P +M&`!\QO[`QGP``````&9F`#@8&!@8/``````8/&8`.!@8&!@\`````&`P&``X +M&!@8&#P`````QL80.&S&QO[&Q@```#AL.``X;,;&_L;&````&#!@`/YF8'Q@ +M9OX`````````S'8V?MC8;@``````/FS,S/[,S,S.`````!`X;`!\QL;&QGP` +M`````,;&`'S&QL;&?`````!@,!@`?,;&QL9\`````#!XS`#,S,S,S'8````` +M8#`8`,S,S,S,=@``````QL8`QL;&QGX&#'@`QL8`.&S&QL;&;#@```#&Q@#& +MQL;&QL;&?``````8&#QF8&!F/!@8`````#AL9&#P8&!@YOP``````&9F/!A^ +M&'X8&`````#XS,SXQ,S>S,S&``````X;&!@8?A@8&!C8<```&#!@`'@,?,S, +M=@`````,&#``.!@8&!@\`````!@P8`!\QL;&QGP`````&#!@`,S,S,S,=@`` +M````=MP`W&9F9F9F````=MP`QN;V_M[.QL8`````/&QL/@!^```````````X +M;&PX`'P````````````P,``P,&#&QGP```````````#^P,#````````````` +M`/X&!@8``````,#`QLS8,&#/@8&````&!@`&!@\ +M/#P8`````````#9LV&PV````````````V&PV;-@``````!%$$4011!%$$401 +M1!%$5:I5JE6J5:I5JE6J5:K==]UWW7?==]UWW7?==Q@8&!@8&!@8&!@8&!@8 +M&!@8&!@8&/@8&!@8&!@8&!@8&/@8^!@8&!@8V-C8V-C;V-C8V-C8V```` +M`````/XV-C8V-C8``````/@8^!@8&!@8V-C8V]@;V-C8V-C8V-C8V-C8V +M-C8V-C8V-C8``````/X&]C8V-C8V-C8V-C8V]@;^````````-C8V-C8V-OX` +M```````8&!@8&/@8^`````````````````#X&!@8&!@8&!@8&!@8&!\````` +M```8&!@8&!@8_P````````````````#_&!@8&!@8&!@8&!@8&!\8&!@8&!@` +M````````_P```````!@8&!@8&!C_&!@8&!@8&!@8&!@?&!\8&!@8&!@V-C8V +M-C8V-S8V-C8V-C8V-C8V-S`_```````````````_,#WMS` +M?````````!`X;,;&_L;&QL8```````#\9F9F?&9F9F;\````````/&;"P,#` +MP,)F/````````/AL9F9F9F9F;/@```````#^9F)H>&A@8F;^````````_F9B +M:'AH8&!@\````````#QFPL#`WL;&9CH```````#&QL;&_L;&QL;&```````` +M/!@8&!@8&!@8/````````!X,#`P,#,S,S'@```````#F9F9L>'AL9F;F```` +M````\&!@8&!@8&)F_@```````,;N_O[6QL;&QL8```````#&YO;^WL[&QL;& +M````````?,;&QL;&QL;&?````````/QF9F9\8&!@8/````````!\QL;&QL;& +MUMY\#`X`````_&9F9GQL9F9FY@```````'S&QF`X#`;&QGP```````!^?EH8 +M&!@8&!@\````````QL;&QL;&QL;&?````````,;&QL;&QL9L.!````````#& +MQL;&UM;6_NYL````````QL9L?#@X?&S&Q@```````&9F9F8\&!@8&#P````` +M``#^QH8,&#!@PL;^````````/#`P,#`P,#`P/`````````"`P.!P.!P.!@(` +M```````\#`P,#`P,#`P\`````!`X;,8````````````````````````````` +M````_P``,#`8````````````````````````>`Q\S,S,=@```````.!@8'AL +M9F9F9GP```````````!\QL#`P,9\````````'`P,/&S,S,S,=@`````````` +M`'S&_L#`QGP````````X;&1@\&!@8&#P````````````=LS,S,S,?`S,>``` +M`.!@8&QV9F9F9N8````````8&``X&!@8&!@\````````!@8`#@8&!@8&!F9F +M/````.!@8&9L>'AL9N8````````X&!@8&!@8&!@\````````````[/[6UM;6 +MQ@```````````-QF9F9F9F8```````````!\QL;&QL9\````````````W&9F +M9F9F?&!@\````````';,S,S,S'P,#!X```````#<=F9@8&#P```````````` +M?,9@.`S&?````````!`P,/PP,#`P-AP```````````#,S,S,S,QV```````` +M````QL;&QFPX$````````````,;&UM;6_FP```````````#&;#@X.&S&```` +M````````QL;&QL;&?@8,^````````/[,&#!@QOX````````.&!@8`Q\S,S,=@``````.&PX`'@,?,S,S'8````` +M`````#QF8&!F/`P&/``````0.&P`?,;^P,#&?````````,8``'S&_L#`QGP` +M`````&`P&`!\QO[`P,9\````````9@``.!@8&!@8/```````&#QF`#@8&!@8 +M&#P``````&`P&``X&!@8&!@\``````#&`!`X;,;&_L;&Q@`````X;#@`.&S& +MQO[&QL8`````&#!@`/YF8'Q@8&;^``````````!L_K(R?MC8;@```````#YL +MS,S^S,S,S,X``````!`X;`!\QL;&QL9\````````Q@``?,;&QL;&?``````` +M8#`8`'S&QL;&QGP``````#!XS`#,S,S,S,QV``````!@,!@`S,S,S,S,=@`` +M````QL8``,;&QL;&QGX&#'@`QL8`?,;&QL;&QL9\`````,;&`,;&QL;&QL;& +M?```````&!@\9F!@8&8\&!@``````#AL9&#P8&!@8.;\````````9F8\&'X8 +M?A@8&```````^,S,^,3,WLS,S,8```````X;&!@8?A@8&!@8V'`````8,&`` +M>`Q\S,S,=@``````#!@P`#@8&!@8&#P``````!@P8`!\QL;&QL9\```````8 +M,&``S,S,S,S,=@```````';<`-QF9F9F9F8`````=MP`QN;V_M[.QL;&```` +M```\;&P^`'X`````````````.&QL.`!\```````````````P,``P,&#`QL9\ +M`````````````/[`P,#```````````````#^!@8&!@```````,#`PL;,&#!@ +MW(8,&#X```#`P,+&S!@P9LZ>/@8&`````!@8`!@8&#P\/!@````````````V +M;-AL-@``````````````V&PV;-@````````11!%$$4011!%$$4011!%$5:I5 +MJE6J5:I5JE6J5:I5JMUWW7?==]UWW7?==]UWW7<8&!@8&!@8&!@8&!@8&!@8 +M&!@8&!@8&/@8&!@8&!@8&!@8&!@8^!CX&!@8&!@8&!@V-C8V-C8V]C8V-C8V +M-C8V`````````/XV-C8V-C8V-@``````^!CX&!@8&!@8&!@V-C8V-O8&]C8V +M-C8V-C8V-C8V-C8V-C8V-C8V-C8V-@``````_@;V-C8V-C8V-C8V-C8V-O8& +M_@``````````-C8V-C8V-OX``````````!@8&!@8^!CX```````````````` +M````^!@8&!@8&!@8&!@8&!@8&!\``````````!@8&!@8&!C_```````````` +M````````_Q@8&!@8&!@8&!@8&!@8&!\8&!@8&!@8&`````````#_```````` +M```8&!@8&!@8_Q@8&!@8&!@8&!@8&!@?&!\8&!@8&!@8V-C8V-C8W-C8V +M-C8V-C8V-C8V-C

diff --git a/usr.sbin/pcvt/ispcvt/ispcvt.8 b/usr.sbin/pcvt/ispcvt/ispcvt.8 new file mode 100644 index 0000000..7c9108b --- /dev/null +++ b/usr.sbin/pcvt/ispcvt/ispcvt.8 @@ -0,0 +1,91 @@ +.\" Copyright (c) 1992, 1995 Hellmuth Michaelis +.\" +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by Hellmuth Michaelis +.\" 4. The name authors may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" @(#)ispcvt.1, 3.20, Last Edit-Date: [Tue Apr 4 12:35:54 1995] +.\" +.Dd April 4, 1995 +.Dt ISPCVT 8 +.Sh NAME +.Nm ispcvt +.Nd verify if current video driver is pcvt driver +.Sh SYNOPSIS +.Nm ispcvt +.Op Fl c +.Op Fl d Ar device +.Op Fl v +.Sh DESCRIPTION +The +.Nm ispcvt +utility allows the user to check whether the current video driver compiled +into the kernel is a pcvt driver. The major and minor release numbers of +the driver are also checked. +Furthermore +.Nm ispcvt +is also able to print out the values of all the +.Dq Ar PCVT_XXXXXX +compile time options, the driver in the current running kernel was +compiled with. +.Pp +The options are as follows: +.Bl -tag -width Ds +.It Fl d +Specifies a device for which the check is done. +.It Fl v +Specifies being verbose. On success the name and revision is reported, on +failure which comparison failed. +.It Fl c +This options prints out the values of all +.Dq Ar PCVT_XXXXXX +#defines which were given to the compiler at the time the currently running +kernel was compiled. Specifying +.Fl v +with the +.Fl c +option gives a verbose listing of the compile-time options. +.Sh RETURN VALUE +.Bl -tag -width Ds +.Pp +.It Sy 0 +driver is pcvt and major and minor numbers match +.It Sy 1 +open or ioctl system call failed +.It Sy 2 +driver name mismatch +.It Sy 3 +name matched, release major number mismatch +.It Sy 4 +name & major number matched, release minor number mismatch +.It Sy 5 +usage error +.El +.Pp +.Sh BUGS +No known bugs +.Sh SEE ALSO +.Xr pcvt 4 diff --git a/usr.sbin/pcvt/ispcvt/ispcvt.c b/usr.sbin/pcvt/ispcvt/ispcvt.c new file mode 100644 index 0000000..813e9dd --- /dev/null +++ b/usr.sbin/pcvt/ispcvt/ispcvt.c @@ -0,0 +1,308 @@ +/* + * Copyright (c) 1992, 1995 Hellmuth Michaelis + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Hellmuth Michaelis + * 4. The name authors may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +static char *id = + "@(#)ispcvt.c, 3.20, Last Edit-Date: [Wed Apr 5 17:53:28 1995]"; + +/*---------------------------------------------------------------------------* + * + * history: + * + * -hm upgraded to report pcvt compile time configuration + * -hm PCVT_INHIBIT_NUMLOCK patch from Joerg + * -hm PCVT_META_ESC patch from Joerg + * -hm PCVT_PCBURST + * -hm new ioctl VGAPCVTINFO + * -hm new CONF_ values for 3.10 + * -hm new CONF_ values for 3.20 + * -hm removed PCVT_FAKE_SYSCONS10 + * -hm added PCVT_PORTIO_DELAY + * -hm removed PCVT_386BSD + * -hm add -d option to specify a device + * -hm PCVT_XSERVER -> XSERVER + * + *---------------------------------------------------------------------------*/ + +#include +#include +#include + +#define DEFAULTFD 0 + +main(argc,argv) +int argc; +char *argv[]; +{ + extern int optind; + extern int opterr; + extern char *optarg; + + struct pcvtid pcvtid; + struct pcvtinfo pcvtinfo; + int c; + char *p; + int verbose = 0; + int config = 0; + int dflag = 0; + int fd; + char *device; + + while( (c = getopt(argc, argv, "vcd:")) != -1) + { + switch(c) + { + case 'v': + verbose = 1; + break; + + case 'c': + config = 1; + break; + + case 'd': + device = optarg; + dflag = 1; + break; + + case '?': + default: + usage(); + break; + } + } + + if(dflag) + { + if((fd = open(device, O_RDWR)) == -1) + { + if(verbose) + { + char buffer[80]; + strcpy(buffer,"ERROR opening "); + strcat(buffer,device); + perror(buffer); + } + exit(1); + } + } + else + { + fd = DEFAULTFD; + } + + if(ioctl(fd, VGAPCVTID, &pcvtid) == -1) + { + if(verbose) + perror("ispcvt - ioctl VGAPCVTID failed, error"); + exit(1); + } + + if(!strcmp(pcvtid.name, PCVTIDNAME)) + { + if(pcvtid.rmajor == PCVTIDMAJOR) + { + if(pcvtid.rminor != PCVTIDMINOR) + { + if(verbose) + fprintf(stderr,"ispcvt - minor revision: expected %d, got %d\n", PCVTIDMINOR, pcvtid.rminor); + exit(4); /* minor revision mismatch */ + } + } + else + { + if(verbose) + fprintf(stderr,"ispcvt - major revision: expected %d, got %d\n", PCVTIDMAJOR, pcvtid.rmajor); + exit(3); /* major revision mismatch */ + } + } + else + { + if(verbose) + fprintf(stderr,"ispcvt - name check: expected %s, got %s\n", PCVTIDNAME, pcvtid.name); + exit(2); /* name mismatch */ + } + + if(verbose) + { + fprintf(stderr,"\nispcvt: kernel and utils match, driver name [%s], release [%1.1d.%02.2d]\n\n",pcvtid.name,pcvtid.rmajor,pcvtid.rminor); + } + + if(config == 0) + exit(0); + + if(ioctl(fd, VGAPCVTINFO, &pcvtinfo) == -1) + { + if(verbose) + perror("ispcvt - ioctl VGAPCVTINFO failed, error"); + exit(1); + } + + if(verbose) + { + switch(pcvtinfo.opsys) + { + case CONF_NETBSD: + p = "PCVT_NETBSD"; + break; + + case CONF_FREEBSD: + p = "PCVT_FREEBSD"; + break; + + default: + case CONF_UNKNOWNOPSYS: + p = "UNKNOWN"; + break; + + } + fprintf(stderr,"Operating System = %s\t", p); + fprintf(stderr,"OS Release Id = %u\n", pcvtinfo.opsysrel); + fprintf(stderr,"PCVT_NSCREENS = %u\t\t", pcvtinfo.nscreens); + fprintf(stderr,"PCVT_UPDATEFAST = %u\n", pcvtinfo.updatefast); + fprintf(stderr,"PCVT_UPDATESLOW = %u\t\t", pcvtinfo.updateslow); + fprintf(stderr,"PCVT_SYSBEEPF = %u\n", pcvtinfo.sysbeepf); + fprintf(stderr,"PCVT_PCBURST = %u\t\t", pcvtinfo.pcburst); + fprintf(stderr,"PCVT_KBD_FIFO_SZ = %u\n\n", pcvtinfo.kbd_fifo_sz); + + /* config booleans */ + + fprintf(stderr,"PCVT_132GENERIC = %s", + (pcvtinfo.compile_opts & CONF_132GENERIC) ? "ON" : "OFF"); + next(); + fprintf(stderr,"PCVT_24LINESDEF = %s", + (pcvtinfo.compile_opts & CONF_24LINESDEF) ? "ON" : "OFF"); + next(); + fprintf(stderr,"PCVT_BACKUP_FONTS = %s", + (pcvtinfo.compile_opts & CONF_BACKUP_FONTS) ? "ON" : "OFF"); + next(); + fprintf(stderr,"PCVT_CTRL_ALT_DEL = %s", + (pcvtinfo.compile_opts & CONF_CTRL_ALT_DEL) ? "ON" : "OFF"); + next(); + fprintf(stderr,"PCVT_EMU_MOUSE = %s", + (pcvtinfo.compile_opts & CONF_EMU_MOUSE) ? "ON" : "OFF"); + next(); + fprintf(stderr,"PCVT_INHIBIT_NUMLOCK = %s", + (pcvtinfo.compile_opts & CONF_INHIBIT_NUMLOCK) ? "ON" : "OFF"); + next(); + fprintf(stderr,"PCVT_KEYBDID = %s", + (pcvtinfo.compile_opts & CONF_KEYBDID) ? "ON" : "OFF"); + next(); + fprintf(stderr,"PCVT_KBD_FIFO = %s", + (pcvtinfo.compile_opts & CONF_KBD_FIFO) ? "ON" : "OFF"); + next(); + fprintf(stderr,"PCVT_META_ESC = %s", + (pcvtinfo.compile_opts & CONF_META_ESC) ? "ON" : "OFF"); + next(); + fprintf(stderr,"PCVT_NOFASTSCROLL = %s", + (pcvtinfo.compile_opts & CONF_NOFASTSCROLL) ? "ON" : "OFF"); + next(); + fprintf(stderr,"PCVT_NO_LED_UPDATE = %s", + (pcvtinfo.compile_opts & CONF_NO_LED_UPDATE) ? "ON" : "OFF"); + next(); + fprintf(stderr,"PCVT_NULLCHARS = %s", + (pcvtinfo.compile_opts & CONF_NULLCHARS) ? "ON" : "OFF"); + next(); + fprintf(stderr,"PCVT_PALFLICKER = %s", + (pcvtinfo.compile_opts & CONF_PALFLICKER) ? "ON" : "OFF"); + next(); + fprintf(stderr,"PCVT_PORTIO_DELAY = %s", + (pcvtinfo.compile_opts & CONF_PORTIO_DELAY) ? "ON" : "OFF"); + next(); + fprintf(stderr,"PCVT_PRETTYSCRNS = %s", + (pcvtinfo.compile_opts & CONF_PRETTYSCRNS) ? "ON" : "OFF"); + next(); + fprintf(stderr,"PCVT_SCREENSAVER = %s", + (pcvtinfo.compile_opts & CONF_SCREENSAVER) ? "ON" : "OFF"); + next(); + fprintf(stderr,"PCVT_SETCOLOR = %s", + (pcvtinfo.compile_opts & CONF_SETCOLOR) ? "ON" : "OFF"); + next(); + fprintf(stderr,"PCVT_SHOWKEYS = %s", + (pcvtinfo.compile_opts & CONF_SHOWKEYS) ? "ON" : "OFF"); + next(); + fprintf(stderr,"PCVT_SIGWINCH = %s", + (pcvtinfo.compile_opts & CONF_SIGWINCH) ? "ON" : "OFF"); + next(); + fprintf(stderr,"PCVT_SLOW_INTERRUPT = %s", + (pcvtinfo.compile_opts & CONF_SLOW_INTERRUPT) ? "ON" : "OFF"); + next(); + fprintf(stderr,"PCVT_SW0CNOUTP = %s", + (pcvtinfo.compile_opts & CONF_SW0CNOUTP) ? "ON" : "OFF"); + next(); + fprintf(stderr,"PCVT_USEKBDSEC = %s", + (pcvtinfo.compile_opts & CONF_USEKBDSEC) ? "ON" : "OFF"); + next(); + fprintf(stderr,"PCVT_USL_VT_COMPAT = %s", + (pcvtinfo.compile_opts & CONF_USL_VT_COMPAT) ? "ON" : "OFF"); + next(); + fprintf(stderr,"PCVT_VT220KEYB = %s", + ((u_int)pcvtinfo.compile_opts & (u_int)CONF_VT220KEYB) ? "ON" : "OFF"); + next(); + fprintf(stderr,"PCVT_WAITRETRACE = %s", + (pcvtinfo.compile_opts & CONF_WAITRETRACE) ? "ON" : "OFF"); + next(); + fprintf(stderr,"XSERVER = %s", + (pcvtinfo.compile_opts & CONF_XSERVER) ? "ON" : "OFF"); + + fprintf(stderr,"\n\n"); + } + else /* !verbose */ + { + fprintf(stderr,"BSD Version = %u\n", pcvtinfo.opsys); + fprintf(stderr,"PCVT_NSCREENS = %u\n", pcvtinfo.nscreens); + fprintf(stderr,"PCVT_UPDATEFAST = %u\n", pcvtinfo.updatefast); + fprintf(stderr,"PCVT_UPDATESLOW = %u\n", pcvtinfo.updateslow); + fprintf(stderr,"PCVT_SYSBEEPF = %u\n", pcvtinfo.sysbeepf); + fprintf(stderr,"Compile options = 0x%08X\n", pcvtinfo.compile_opts); + } +} + +usage() +{ + fprintf(stderr,"\nispcvt - verify current video driver is the pcvt-driver\n"); + fprintf(stderr," usage: ispcvt [-v] [-c] [-d device]\n"); + fprintf(stderr,"options: -v be verbose\n"); + fprintf(stderr," -c print compile time configuration\n"); + fprintf(stderr," -d use devicefile for verification\n\n"); + exit(5); +} + +next() +{ + static int i = 0; + + fprintf(stderr, "%s", (i == 0) ? "\t\t" : "\n"); + + i = ~i; +} + +/* EOF */ diff --git a/usr.sbin/pcvt/kbdio/Makefile b/usr.sbin/pcvt/kbdio/Makefile new file mode 100644 index 0000000..08cbf3b --- /dev/null +++ b/usr.sbin/pcvt/kbdio/Makefile @@ -0,0 +1,36 @@ +.if !exists(${.CURDIR}/../Makefile.inc) +error: + @echo + @echo " You MUST link/copy" + @echo + @echo " ../Makefile.inc.NetBSD or ../Makefile.inc.FreeBSD" + @echo + @echo " to ../Makefile.inc before you can proceed !" + @echo +.else + +PROG= kbdio +SRCS= kbdio.y lex.l y.tab.h + +#YACC= bison +#YFLAGS+= -yd # Bison only + +YFLAGS+= -v # verbose + +LFLAGS+= -I + +DPADD= ${LIBM} ${LIBY} ${LIBL} +LDADD= -lm -ly -ll + +NOMAN= + +CFLAGS+= -I${.OBJDIR} -I${.CURDIR} #-g + +CLEANFILES+= y.output # comment file from bison + +install: + @${ECHO} "kbdio is not installed automatically ...." + +.include + +.endif diff --git a/usr.sbin/pcvt/kbdio/kbdio.y b/usr.sbin/pcvt/kbdio/kbdio.y new file mode 100644 index 0000000..8f825f1 --- /dev/null +++ b/usr.sbin/pcvt/kbdio/kbdio.y @@ -0,0 +1,338 @@ +/* Hello emacs, this should be edited in -*- Fundamental -*- mode */ +%{ +/* + * Copyright (c) 1994 Joerg Wunsch + * + * All rights reserved. + * + * This program is free software. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Joerg Wunsch + * 4. The name of the developer may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ident "$Header: /home/ncvs/src/usr.sbin/pcvt/kbdio/Attic/kbdio.y,v 1.2 1995/04/01 17:16:26 joerg Exp $" + +/* + * $Log: kbdio.y,v $ + * Revision 1.2 1995/04/01 17:16:26 joerg + * Update pcvt to 3.20b23 + * + * Submitted by: Hellmuth Michaelis + * + * Revision 1.1.1.1 1995/02/05 13:49:24 jkh + * PCVT userland utilities. + * Submitted by: hm + * + * Revision 1.2 1994/09/18 19:49:22 j + * Refined expr handling; can now set/clear bits. + * + * Revision 1.1 1994/09/18 12:57:13 j + * Initial revision + * + * + */ + +#include +#include +#include +#include +#include +#include + +#ifdef __NetBSD__ +#include +#endif + +#define KBD_DELAY \ + { u_char x = inb(0x84); } \ + { u_char x = inb(0x84); } \ + { u_char x = inb(0x84); } \ + { u_char x = inb(0x84); } \ + { u_char x = inb(0x84); } \ + { u_char x = inb(0x84); } + +#define YYDEBUG 1 + +void yyerror(const char *msg); + +static void help(int), status(void), data(int), kbd(int), cmdbyte(int), + kbc(int), whatMCA(void); +static int kbget(void); +%} + +%union { + int num; +} + +%token NEWLINE +%token ALL CMD DATA DEFAULTS ECHOC ENABLE EXPR HELP ID LED +%token MAKE ONLY RELEASE RESEND RESET SCAN STATUS TYPEMATIC +%token WHAT +%token NUM + +%type expr opr + +%% + +interpret: lines ; + +lines: line + | lines line + ; + +line: statements NEWLINE + | NEWLINE + | error NEWLINE { fprintf(stderr, "bing!\n"); } + ; + +statements: statement + | statements ';' statement + ; + +statement: '?' { help(0); } + | HELP { help(0); } + | HELP EXPR { help(1); } + | STATUS '?' { status(); } + | WHAT '?' { whatMCA(); } + | DATA '?' { data(kbget()); } + | LED '=' NUM { kbd(0xed); kbd($3); } + | ECHOC { kbd(0xee); kbget(); } + | SCAN '=' NUM { kbd(0xf0); kbd($3); + if($3 == 0) data(kbget()); } + | SCAN '?' { kbd(0xf0); kbd(0); data(kbget()); } + | ID '?' { kbd(0xf2); data(kbget()); + data(kbget()); } + | TYPEMATIC '=' NUM ',' NUM + { kbd(0xf3); + if($3 > 1000) $3 = 1000; + if($5 > 30) $5 = 30; + if($5 < 2) $5 = 2; + kbd( + (int) + (8.0 * log(30.0 / (double)$5) + / log(2)) + | ((($3 / 250) - 1) * 32) + ); + } + | ENABLE { kbd(0xf4); } + | DEFAULTS { kbd(0xf6); } + | ALL TYPEMATIC { kbd(0xf7); } + | ALL MAKE RELEASE { kbd(0xf8); } + | ALL MAKE ONLY { kbd(0xf9); } + | ALL TYPEMATIC MAKE RELEASE + { kbd(0xfa); } + | NUM TYPEMATIC { kbd(0xfb); kbd($1); } + | NUM MAKE RELEASE { kbd(0xfc); kbd($1); } + | NUM MAKE ONLY { kbd(0xfd); kbd($1); } + | RESEND { kbd(0xfe); } + | RESET { kbd(0xff); } + | CMD '?' { kbc(0x20); cmdbyte(kbget()); } + | CMD '=' expr { kbc(0x60); kbd($3); } + | /* lambda */ + ; + +expr: opr { $$ = $1; } + | expr '+' opr { $$ = $1 | $3; } + | expr '-' opr { $$ = $1 & ~($3); } + ; + +opr: NUM { $$ = $1; } + | CMD { kbc(0x20); $$ = kbget(); } + ; + +%% + +static void +help(int topic) { + switch(topic) { + case 0: + printf( + "Input consists of lines, containing one or more semicolon-separated\n" + "statements. Numbers are implicitly hexadecimal, append a dot for\n" + "decimal numbers. Valid statements include:\n" + "help [expr]; give help [to expression syntax]\n" + "status ? interpret kbd ctrl status byte\n" + "what ? check for MCA type 1 or 2 motherboard controller\n" + "data ? get one byte of data\n" + "led = NUM set kbd LEDs\n" + "echo = NUM echo byte to kbd\n" + "scan = NUM; scan ? set scan code set; return current set\n" + "id ? get two id bytes\n" + "typematic=delay,rate set typematic delay(ms)&rate(1/s)\n" + "enable; defaults enable kbd; back to defaults\n" + "all typematic make all keys typematic\n" + "all make release make all keys sending make/release\n" + "all make only make all keys sending make only\n" + "all typematic make release make all keys typematic & make/release\n" + "NUM typematic make specific key typematic\n" + "NUM make release make specific key sending make/release\n" + "NUM make only make specific key sending make only\n" + "resend; reset resend last byte from kbd; reset kbd\n" + "cmd ? fetch kbd ctrl command byte\n" + "cmd = expr set kbd ctrl command byte\n" + "\n"); + break; + + case 1: + printf( + "Expressions can either consist of a number, possibly followed\n" + "by a + or - sign and bit values in numeric or symbolic form.\n" + "Symbolic bit values are:\n" + "SCCONV IGNPAR CLKLOW OVRINH TEST IRQ\n" + "\n"); + break; + } +} + +static void +status(void) { + int c = inb(0x64); + if(c&0x80) printf("parity error | "); + if(c&0x40) printf("rx timeout | "); + if(c&0x20) printf("tx timeout | "); + if(c&0x10) printf("kbd released "); + else printf("kbd locked "); + if(c&0x08) printf("| cmd last sent "); + else printf("| data last sent "); + if(c&0x04) printf("| power-on "); + else printf("| test ok "); + if(c&0x02) printf("| ctrl write busy "); + else printf("| ctrl write ok "); + if(c&0x01) printf("| ctrl read ok\n"); + else printf("| ctrl read empty\n"); +} + +/* see: Frank van Gilluwe, "The Undocumented PC", Addison Wesley 1994, pp 273 */ + +static void +whatMCA(void) { + int new, sav; + kbc(0x20); /* get command byte */ + sav = kbget(); /* sav = command byte */ + kbc(0x60); /* set command byte */ + kbd(sav | 0x40); /* set keyboard xlate bit */ + kbc(0x20); /* get keyboard command */ + new = kbget(); /* new = command byte */ + kbc(0x60); /* set command byte */ + kbd(sav); /* restore command byte */ + if(new & 0xbf) + printf("Hmm - looks like MCA type 1 motherboard controller\n"); + else + printf("Hmm - looks like MCA type 2 motherboard controller\n"); +} + +static void +kbd(int d) { + int i = 100000; + while(i && (inb(0x64) & 2)) i--; + if(i == 0) { printf("kbd write: timed out\n"); return; } + outb(0x60, d); +} + +static void +kbc(int d) { + int i = 100000; + while(i && (inb(0x64) & 2)) i--; + if(i == 0) { printf("ctrl write: timed out\n"); return; } + outb(0x64, d); +} + +static int +kbget(void) { + int i, c; + for(;;) { + i = 10000; + while(i && (inb(0x64) & 1) == 0) i--; + if(i == 0) { printf("data read: timed out\n"); return -1; } + KBD_DELAY + c = (unsigned char)inb(0x60); + switch(c) { + case 0: case 0xff: + printf("got kbd overrun\n"); break; + case 0xaa: + printf("got self-test OK\n"); break; + case 0xee: + printf("got ECHO byte\n"); break; + case 0xfa: + printf("got ACK\n"); break; + case 0xfc: + printf("got self-test FAIL\n"); break; + case 0xfd: + printf("got internal failure\n"); break; + case 0xfe: + printf("got RESEND request\n"); break; + default: + goto done; + } + } +done: + return c; +} + +static void +cmdbyte(int d) { + if(d&0x40) printf("scan conv "); + else printf("pass thru "); + if(d&0x20) printf("| ign parity "); + else printf("| check parity "); + if(d&0x10) printf("| kbd clk low "); + else printf("| enable kbd "); + if(d&0x08) printf("| override kbd inh "); + if(d&0x04) printf("| test ok "); + else printf("| power-on "); + if(d&0x01) printf("| irq 1 enable\n"); + else printf("| no irq\n"); +} + +static void +data(int d) { + if(d < 0) return; + printf("data: 0x%02x\n", d); +} + +void yyerror(const char *msg) { + fprintf(stderr, "yyerror: %s\n", msg); +} + +int main(int argc, char **argv) { + int fd; + + if(argc > 1) yydebug = 1; + + if((fd = open("/dev/console", O_RDONLY)) < 0) + fd = 0; + + if(ioctl(fd, KDENABIO, 0) < 0) { + perror("ioctl(KDENABIO)"); + return 1; + } + yyparse(); + + (void)ioctl(fd, KDDISABIO, 0); + return 0; +} + diff --git a/usr.sbin/pcvt/kbdio/lex.l b/usr.sbin/pcvt/kbdio/lex.l new file mode 100644 index 0000000..b7592fe --- /dev/null +++ b/usr.sbin/pcvt/kbdio/lex.l @@ -0,0 +1,107 @@ +%{ +/* + * Copyright (c) 1994 Joerg Wunsch + * + * All rights reserved. + * + * This program is free software. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Joerg Wunsch + * 4. The name of the developer may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ident "$Header: /home/ncvs/src/usr.sbin/pcvt/kbdio/Attic/lex.l,v 1.2 1995/04/01 17:16:27 joerg Exp $" + +/* + * $Log: lex.l,v $ + * Revision 1.2 1995/04/01 17:16:27 joerg + * Update pcvt to 3.20b23 + * + * Submitted by: Hellmuth Michaelis + * + * Revision 1.1.1.1 1995/02/05 13:49:24 jkh + * PCVT userland utilities. + * Submitted by: hm + * + * Revision 1.2 1994/09/18 19:48:45 j + * Added the symbolic values for kbd cmd byte. + * + * Revision 1.1 1994/09/18 12:57:13 j + * Initial revision + * + * + */ + +#include +#include + +#include "y.tab.h" + +extern YYSTYPE yylval; + +%} + +D [0-9a-fA-F] + +%% + +all { return ALL; } +cmd { return CMD; } +data { return DATA; } +defaults { return DEFAULTS; } +echo { return ECHOC; } +enable { return ENABLE; } +expr { return EXPR; } +help { return HELP; } +id { return ID; } +led { return LED; } +make { return MAKE; } +only { return ONLY; } +release { return RELEASE; } +resend { return RESEND; } +reset { return RESET; } +scan { return SCAN; } +status { return STATUS; } +typematic { return TYPEMATIC; } +what { return WHAT; } + + /* numeric values */ +clklow { yylval.num = 0x10; return NUM; } +ignpar { yylval.num = 0x20; return NUM; } +irq { yylval.num = 0x01; return NUM; } +ovrinh { yylval.num = 0x08; return NUM; } +scconv { yylval.num = 0x40; return NUM; } +test { yylval.num = 0x04; return NUM; } + +{D}({D}*)\. { sscanf(yytext, "%d", &yylval.num); return NUM; } + +{D}({D}*) { sscanf(yytext, "%x", &yylval.num); return NUM; } + +[ \t] { /* ignore */ } + +\n { return NEWLINE; } + +. { return yytext[0]; } diff --git a/usr.sbin/pcvt/kcon/Makefile b/usr.sbin/pcvt/kcon/Makefile new file mode 100644 index 0000000..77a9f26 --- /dev/null +++ b/usr.sbin/pcvt/kcon/Makefile @@ -0,0 +1,14 @@ +PROG= kcon +DEVICE= /dev/ttyv0 +CFLAGS+= -I${.CURDIR}/../keycap -DKEYB_DEVICE=\"${DEVICE}\" + +.if exists(${.OBJDIR}/../keycap) +LIBKEYCAP= ${.OBJDIR}/../keycap/libkeycap.a +.else +LIBKEYCAP= ${.CURDIR}/../keycap/libkeycap.a +.endif + +DPADD= ${LIBKEYCAP} +LDADD= ${LIBKEYCAP} + +.include diff --git a/usr.sbin/pcvt/kcon/kcon.1 b/usr.sbin/pcvt/kcon/kcon.1 new file mode 100644 index 0000000..b430340 --- /dev/null +++ b/usr.sbin/pcvt/kcon/kcon.1 @@ -0,0 +1,122 @@ +.\" Copyright (c) 1992,1993,1994 Hellmuth Michaelis +.\" +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by Hellmuth Michaelis +.\" 4. The name authors may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" @(#)kcon.1, 3.20, Last Edit-Date: [Wed Jan 25 16:34:56 1995] +.\" +.Dd January 25, 1995 +.Dt KCON 1 +.Sh NAME +.Nm kcon +.Nd keyboard control and remapping +.Sh SYNOPSIS +.Nm kcon +.Op Fl d Ar delay +.Op Fl l +.Op Fl m Ar map +.Op Fl o +.Op Fl p +.Op Fl R +.Op Fl r Ar rate +.Op Fl s +.Op Fl t Ns Ar +/- +.Op Fl x +.Sh DESCRIPTION +.Nm kcon +is used for controlling all aspects of keyboard configuration for the 'pcvt' +video driver. +.Pp +The available options are: +.Bl -tag -width flag +.It Fl d Ar delay +Specifies the delay after which the last key entered will be repeated by the +Keyboard. Valid values are 0..3 corresponding to delays of 250, 500, 750 and +1000 milliseconds. +.It Fl l +Displays the current keyboard map in use by the driver. +.It Fl m Ar map +Specifies the map entry to be searched in the keyboard capabilities database +.Nm keycap. +The database is searched for the entry and if found, the mapping +is loaded and is used in the driver from then on. +.It Fl o +Switches display of control codes to octal in the listing of the current map. +To be used in conjunction with the +.Fl l +option. +.It Fl p +Uses 'pure' output when listing - the Escape character is displayed in either +octal or hexadecimal and not as 'ESC'. To be used in conjunction with the +.Fl l +option. +.It Fl r Ar rate +Specifies the character repetition rate. Valid argument values are 0...31 +corresponding to rates of 30 characters/second ... 2 characters/second. +.It Fl R +Reset the Keyboard. +.It Fl s +Displays the current settings of the rate and delay values. +.It Fl t Ar +/- +Specify this option to enable ( +.Ar + +) or disable ( +.Ar - +) the repetition of keys. +.It Fl x +Switches display of control codes to hexadecimal in the listing of the current map. +To be used in conjunction with the +.Fl l +option. This is the default behaviour. +.Sh FILES +.Bl -tag -width /usr/share/misc/keycap.pcvt -compact +.It Pa /usr/share/misc/keycap.pcvt +Keyboard capabilities data base file if nothing else was chosen during installation. +.It Pa /dev/console +Keyboard raw device. +.Sh SEE ALSO +.Xr keycap 3 , +.Xr keycap 5 +.Sh BUGS +.Nm kcon +detects several inconsistencies in the keycap database. In case of errors +.Nm kcon +exits with an error message. If this happens, the keyboard may remain in +an undefined state. To recover from such situation, execute +.Nm kcon -m default +.Sh EXAMPLES +The command +.Dq Li kcon -m gb +loads the entry 'gb' from the keycap file into the keyboard to switch to +a british keyboard behaviour. + +The command +.Dq Li kcon -r 0 -d 0 +switches the keyboard to emit characters at a rate of 30 characters per second +after a key has been held down for 250 milliseconds. + + diff --git a/usr.sbin/pcvt/kcon/kcon.c b/usr.sbin/pcvt/kcon/kcon.c new file mode 100644 index 0000000..1f9cded --- /dev/null +++ b/usr.sbin/pcvt/kcon/kcon.c @@ -0,0 +1,753 @@ +/* + * Copyright (c) 1992,1993,1994 Hellmuth Michaelis + * + * Copyright (c) 1992,1993 Holger Veit. + * + * All rights reserved. + * + * This code is derived from software contributed to 386BSD by + * Holger Veit + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by + * Hellmuth Michaelis and Holger Veit + * 4. The name authors may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +static char *id = + "@(#)kcon.c, 3.20, Last Edit-Date: [Wed Jan 25 16:33:08 1995]"; + +/*---------------------------------------------------------------------------* + * + * kcon.c Keyboard control and remapping + * ---------------------------------------------- + * + * based on "keymap" which was written by + * Holger Veit (veit@du9ds3.uni-duisburg.de) + * + * -hm a first rewrite + * -hm rewrite for pcvt 2.0 distribution + * -hm adding show current typematic values + * -hm hex/octal/esc output choices + * -hm remapping debugging + * -hm garbage output for remapped keys bugfix + * -hm patch from Lon Willet, adding -R + * + *---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include + +#include "keycap.h" + +int Rf = 0; +int df = 0; +int lf = 0; +int mf = 0; +int of = 0; +int pf = 0; +int rf = 0; +int tf = 0; +int xf = 0; +int sf = 0; + +/*---------------------------------------------------------------------------* + * main entry + *---------------------------------------------------------------------------*/ +main(argc, argv) +int argc; +char *argv[]; +{ + extern char *optarg; + extern int optind; + + int c = 0; + + int errf = 0; + + int rate = -1; + int delay = -1; + char *map; + int kbfd; + + while((c = getopt(argc, argv, "Rd:lm:opr:st:x")) != -1) + { + switch(c) + { + case 'R': + Rf = 1; + break; + + case 'd': + df = 1; + delay = atoi(optarg); + break; + + case 'l': + lf = 1; + break; + + case 'm': + mf = 1; + map = optarg; + break; + + case 'o': + if(xf) + errf = 1; + else + of = 1; + break; + + case 'p': + pf = 1; + break; + + case 'r': + rf = 1; + rate = atoi(optarg); + break; + + case 's': + sf = 1; + break; + + case 't': + if(*optarg == '+') + tf = 1; + else if(*optarg == '-') + tf = -1; + else + errf = 1; + break; + + case 'x': + if(of) + errf = 1; + else + xf = 1; + break; + + default: + usage(); + } + } + + if((Rf == 0 && df == 0 && lf == 0 && tf == 0 && sf == 0 && + rf == 0 && mf == 0 ) || errf) + { + usage(); + } + + if((kbfd = open(KEYB_DEVICE, 0)) < 0) + { + perror("kcon: keyboard open failiure"); + exit(1); + } + + if(sf) + { + showtypeamatic(kbfd); + exit(0); + } + + if(lf) + { + listcurrent(kbfd); + exit(0); + } + + if (Rf) + { + if (ioctl(kbfd, KBDRESET, 0) < 0) { + perror ("kcon: ioctl KBDRESET failed"); + exit (1); + } + } + + if(tf) + { + setrepeat(kbfd, tf); + } + + if(df || rf) + { + if(delay > 3) + { + fprintf(stderr,"Delay value (%d) out of range, possible values are 0..3!\n",delay); + exit(1); + } + if(rate > 31) + { + fprintf(stderr,"Rate value (%d) out of range, possible values are 0..31!\n",rate); + exit(1); + } + settypeam(kbfd, delay, rate); + } + + if(mf) + { + remapkeys(kbfd, map); + } + + close(kbfd); + exit(0); +} + +/*---------------------------------------------------------------------------* + * display usage info & exit + *---------------------------------------------------------------------------*/ +usage() +{ + fprintf(stderr, "\nkcon: keyboard control and remapping utility for pcvt video driver\n"); + fprintf(stderr, "usage: [-R] [-d delay] [-l] [-m map] [-o] [-p] [-r rate] [-t +/-] [-x]\n"); + fprintf(stderr, " -R full reset of keyboard\n"); + fprintf(stderr, " -d delay until a key is repeated (range: 0...3 => 250...1000ms)\n"); + fprintf(stderr, " -l produce listing of current keyboard mapping\n"); + fprintf(stderr, " -m set keyboard remapping from a keycap entry\n"); + fprintf(stderr, " -o set octal output for listing\n"); + fprintf(stderr, " -p pure, don't display escape as 'ESC' for listing\n"); + fprintf(stderr, " -r chars/second repeat value (range: 0...31 => 30...2 chars/sec)\n"); + fprintf(stderr, " -s show, display the current keyboard typematic values\n"); + fprintf(stderr, " -t switch repeat on(+) or off(-)\n"); + fprintf(stderr, " -x set hexadecimal output for listing\n\n"); + exit(1); +} + +/*---------------------------------------------------------------------------* + * convert control char in string to printable values + *---------------------------------------------------------------------------*/ +char *showcntrl(s) +u_char *s; +{ + static char res_str[80]; + static char conv_buf[80]; + int i; + + res_str[0] = '\0'; + + for(i = 0; s[i]; i++) + { + if(((s[i] > 0x20) && (s[i] <= 0x7e)) || ((s[i] >= 0xa0) && (s[i] <= 0xff))) + { + conv_buf[0] = s[i]; + conv_buf[1] = '\0'; + } + else if((s[i] == 0x1b) && (pf == 0)) + { + strcpy(conv_buf,"ESC "); + } + else if(of) + { + sprintf(conv_buf,"\\%03.3o ", s[i]); + } + else + { + sprintf(conv_buf,"0x%02.2X ", s[i]); + } + strcat(res_str, conv_buf); + } + return(res_str); +} + +/*---------------------------------------------------------------------------* + * list the current keyboard mapping + *---------------------------------------------------------------------------*/ +listcurrent(kbfd) +int kbfd; +{ + static char *keytypetab[] = { + "NONE ", + "SHIFT ", + "ALT/META ", + "NUMLOCK ", + "CONTROL ", + "CAPSLOCK ", + "ASCII ", + "SCROLL ", + "FUNCTION ", + "KEYPAD ", + "BREAK ", + "ALTGR ", + "SHIFTLOCK", + "CURSOR ", + "RETURN " + }; + + struct kbd_ovlkey keyboardmap[KBDMAXKEYS]; + struct kbd_ovlkey *kbmapp; + int keytype; + int altgr_defined; + int i; + + altgr_defined = 0; + kbmapp = keyboardmap; + + for (i = 0; i < KBDMAXKEYS; i++) + { + kbmapp->keynum = i; + + if(ioctl(kbfd, KBDGCKEY, kbmapp) < 0) + { + perror("kcon: ioctl KBDGCKEY failed"); + exit(1); + } + + if((kbmapp->type & KBD_MASK) == KBD_ALTGR) + altgr_defined = i; + + kbmapp++; + } + + if(altgr_defined) + { + printf("S Key KeyType Normal Shift Control Altgr \n"); + printf("- --- --------- --------------- --------------- --------------- ---------------\n"); + } + else + { + printf("S Key KeyType Normal Shift Control \n"); + printf("- --- --------- --------------- --------------- ---------------\n"); + } + + kbmapp = &keyboardmap[1]; + + for(i = 1; i < KBDMAXKEYS; i++) + { + keytype = kbmapp->type; + + if(keytype) + { + if(keytype & KBD_OVERLOAD) + printf("! %3.3d %9.9s ", i, keytypetab[keytype & KBD_MASK]); + else + printf("- %3.3d %9.9s ", i, keytypetab[keytype & KBD_MASK]); + + switch(keytype & KBD_MASK) + { + + case KBD_NUM: + case KBD_ASCII: + case KBD_FUNC: + case KBD_KP: + case KBD_CURSOR: + case KBD_RETURN: /* ??? */ + + if(kbmapp->subu == KBD_SUBT_STR) + printf("%-15s ",showcntrl(kbmapp->unshift)); + else + printf("Function() "); + + if(kbmapp->subs == KBD_SUBT_STR) + printf("%-15s ",showcntrl(kbmapp->shift)); + else + printf("Function() "); + + if(kbmapp->subc == KBD_SUBT_STR) + printf("%-15s ",showcntrl(kbmapp->ctrl)); + else + printf("Function() "); + + if(altgr_defined) + { + if(kbmapp->suba == KBD_SUBT_STR) + printf("%-15s ",showcntrl(kbmapp->altgr)); + else + printf("Function() "); + } + break; + } + putchar('\n'); + } + kbmapp++; + } +} + +/*---------------------------------------------------------------------------* + * show delay and rate values for keyboard + *---------------------------------------------------------------------------*/ +showtypeamatic(kbfd) +int kbfd; +{ + static char *delaytab[] = { + "250", + "500", + "750", + "1000" + }; + + static char *ratetab[] = { + "30.0", + "26.7", + "24.0", + "21.8", + "20.0", + "18.5", + "17.1", + "16.0", + "15.0", + "13.3", + "12.0", + "10.9", + "10.0", + "9.2", + "8.6", + "8.0", + "7.5", + "6.7", + "6.0", + "5.5", + "5.0", + "4.6", + "4.3", + "4.0", + "3.7", + "3.3", + "3.0", + "2.7", + "2.5", + "2.3", + "2.1", + "2.0" + }; + + int cur_typemat_val; + int delay, rate; + + if((ioctl(kbfd, KBDGTPMAT, &cur_typemat_val)) < 0) + { + perror("kcon: ioctl KBDGTPMAT failed"); + exit(1); + } + + delay = ((cur_typemat_val & 0x60) >> 5); + rate = cur_typemat_val & 0x1f; + + printf("\nDisplaying the current keyboard typematic values:\n\n"); + printf("The delay-until-repeat time is [ %s ] milliseconds\n",delaytab[delay]); + printf("The repeat-rate is [ %s ] characters per second\n\n",ratetab[rate]); +} + +/*---------------------------------------------------------------------------* + * set repeat feature on/off + *---------------------------------------------------------------------------*/ +setrepeat(kbfd, tf) +int kbfd; +int tf; +{ + int srepsw_val; + + if(tf == 1) + srepsw_val = KBD_REPEATON; + else + srepsw_val = KBD_REPEATOFF; + + if(ioctl(kbfd, KBDSREPSW, &srepsw_val) < 0) + { + perror("kcon: ioctl KBDREPSW failed"); + exit(1); + } +} + +/*---------------------------------------------------------------------------* + * set delay and rate values for keyboard + *---------------------------------------------------------------------------*/ +settypeam(kbfd, delay, rate) +int kbfd; +int delay; +int rate; +{ + int cur_typemat_val; + int new_typemat_val; + + if((ioctl(kbfd, KBDGTPMAT, &cur_typemat_val)) < 0) + { + perror("kcon: ioctl KBDGTPMAT failed"); + exit(1); + } + + if(delay == -1) + delay = (cur_typemat_val & 0x60); + else + delay = ((delay << 5) & 0x60); + + if(rate == -1) + rate = (cur_typemat_val & 0x1f); + else + rate &= 0x1f; + + new_typemat_val = delay | rate; + + if((ioctl(kbfd, KBDSTPMAT, &new_typemat_val)) < 0) + { + perror("kcon: ioctl KBDSTPMAT failed"); + exit(1); + } +} + +/*---------------------------------------------------------------------------* + * remap keyboard from keycap entry + *---------------------------------------------------------------------------*/ +remapkeys(kbfd, map) +int kbfd; +char *map; +{ + char cap_entry[1024]; + int ret; + char keyflag[128]; + int i; + + /* try to find the entry */ + + ret = kgetent(cap_entry, map); + + if(ret == -1) + { + fprintf(stderr, "kcon: keycap database not found or not accessible!\n"); + exit(1); + } + else if(ret == 0) + { + fprintf(stderr, "kcon: keycap entry [%s] not found in database!\n", map); + exit(1); + } + + /* set default mapping */ + + if((ioctl(kbfd, KBDDEFAULT)) < 0) + { + perror("kcon: ioctl KBDDEFAULT failed"); + exit(1); + } + + /* DE flag present? */ + + if(kgetflag("de")) + return; + + for(i = 0; i < KBDMAXKEYS; i++) + keyflag[i] = 0; + + set_lock(keyflag, kbfd); + + set_shift(keyflag, kbfd); + + set_char(keyflag, kbfd); +} + +/*---------------------------------------------------------------------------* + * care for lock keys + *---------------------------------------------------------------------------*/ +set_lock(keyflag, kbfd) +char keyflag[]; +int kbfd; +{ + int i, j; + char cap[16]; + struct kbd_ovlkey entry; + + struct { + char *ch; + u_short typ; + } lock[] = + { + "ca", KBD_CAPS, + "sh", KBD_SHFTLOCK, + "nl", KBD_NUMLOCK, + "sc", KBD_SCROLL + }; + + + for(i = 0; i < 4; i++) + { + int n; + + sprintf(cap, "%s", lock[i].ch); + + n = kgetnum(cap); + + if(n > 0) + { + if (keyflag[n]) + { + fprintf(stderr,"kcon: duplicate key definition for key [%d]!\n",n); + exit(1); + } + keyflag[n] = 1; + + entry.keynum = n; + entry.type = lock[i].typ; + + if((ioctl(kbfd, KBDSCKEY, &entry)) < 0) + { + perror("kcon: ioctl KBDSCKEY failed"); + exit(1); + } + } + } +} + +/*---------------------------------------------------------------------------* + * care for shifting keys + *---------------------------------------------------------------------------*/ +set_shift(keyflag, kbfd) +char keyflag[]; +int kbfd; +{ + int i, j; + char cap[16]; + struct kbd_ovlkey entry; + + struct { + char ch; + u_short typ; + } shift[] = + { + 'm', KBD_META, + 'l', KBD_ALTGR, + 'h', KBD_SHIFT, + 't', KBD_CTL + }; + + for(i = 0; i < 4; i++) + { + for(j = 1; j < 10; j++) + { + int n; + + sprintf(cap, "%c%d", shift[i].ch,j); + + n = kgetnum(cap); + + if (n >= 0) + { + if (keyflag[n]) + { + fprintf(stderr,"kcon: duplicate key definition for key [%d]!\n",n); + exit(1); + } + keyflag[n] = 1; + + entry.keynum = n; + entry.type = shift[i].typ; + if((ioctl(kbfd, KBDSCKEY, &entry)) < 0) + { + perror("kcon: ioctl KBDSCKEY failed"); + exit(1); + } + } + } + } +} + +/*---------------------------------------------------------------------------* + * care for normal keys + *---------------------------------------------------------------------------*/ +set_char(keyflag, kbfd) +char keyflag[]; +int kbfd; +{ + int i, j; + char cap[16]; + int setflag; + char *addr_str; + char *new_str; + struct kbd_ovlkey entry; + + struct { + char *addr; + char ch; + } standard[] = { + 0, 'D', + &entry.unshift[0], 'K', + &entry.shift[0], 'S', + &entry.ctrl[0], 'C', + &entry.altgr[0], 'A' + }; + + for(i = 1; i < KBDMAXKEYS; i++) + { + setflag = 0; + + entry.keynum = i; + + if((ioctl(kbfd, KBDGOKEY, &entry)) < 0) + { + perror("kcon: ioctl KBDGOKEY failed"); + exit(1); + } + + entry.type = KBD_ASCII; + + for(j = 0; j < 5; j++) + { + sprintf(cap, "%c%d", standard[j].ch,i); + + if((j == 0) && (kgetflag(cap))) + { + /* delete a key */ + + entry.type = KBD_NONE; + setflag = 1; + goto setit; + + } + else + { + addr_str = standard[j].addr; + if(new_str = kgetstr(cap, &addr_str)) + { + if(strlen(new_str) > KBDMAXOVLKEYSIZE) + { + fprintf(stderr, "kcon: database entry string [%s] longer than max [%d]!\n",new_str,KBDMAXOVLKEYSIZE); + exit(1); + } + setflag = 1; + } + } + } + +setit: if (setflag) + { + if (keyflag[i]) + { + fprintf(stderr,"kcon: duplicate key definition for key [%d]!\n",i); + exit(1); + } + keyflag[i] = 1; + + if((ioctl(kbfd, KBDSCKEY, &entry)) < 0) + { + perror("kcon: ioctl KBDSCKEY failed"); + exit(1); + } + } + } +} + +/*------------------- EOF ------------------------------------------------*/ diff --git a/usr.sbin/pcvt/keycap/Makefile b/usr.sbin/pcvt/keycap/Makefile new file mode 100644 index 0000000..cc6767d --- /dev/null +++ b/usr.sbin/pcvt/keycap/Makefile @@ -0,0 +1,32 @@ +.if !exists(${.CURDIR}/../Makefile.inc) +error: + @echo + @echo " You MUST link/copy" + @echo + @echo " ../Makefile.inc.NetBSD or ../Makefile.inc.FreeBSD" + @echo + @echo " to ../Makefile.inc before you can proceed !" + @echo +.else + +LIB = keycap +CAPDIR = /usr/share/misc +CAPPATH = $(CAPDIR)/keycap.pcvt +KEYCAPSRC= keycap.src +CFLAGS += -DKEYCAP_PATH=\"$(CAPPATH)\" +SRCS = keycap.c +MAN3 = keycap.${MAN3EXT} +MLINKS+= keycap.${MAN3EXT} kgetent.${MAN3EXT} \ + keycap.${MAN3EXT} kgetnum.${MAN3EXT} \ + keycap.${MAN3EXT} kgetflag.${MAN3EXT} \ + keycap.${MAN3EXT} kgetstr.${MAN3EXT} +MAN5 = man5/keycap.${MAN5EXT} +#CLEANFILES+= keycap.0 man5/keycap.0 + +beforeinstall: + ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ + ${.CURDIR}/${KEYCAPSRC} ${DESTDIR}${CAPPATH} + +.include + +.endif diff --git a/usr.sbin/pcvt/keycap/keycap.3 b/usr.sbin/pcvt/keycap/keycap.3 new file mode 100644 index 0000000..b62b427 --- /dev/null +++ b/usr.sbin/pcvt/keycap/keycap.3 @@ -0,0 +1,124 @@ +.\" +.\" Copyright (c) 1992,1993,1994 Hellmuth Michaelis +.\" +.\" Copyright (c) 1990 The Regents of the University of California. +.\" +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)keycap.3, 3.00, Last Edit-Date: [Sun Jan 2 13:46:43 1994] +.\" +.Dd January 3, 1993 +.Dt KEYCAP 3 +.Sh NAME +.Nm kgetent , +.Nm kgetnum , +.Nm kgetflag , +.Nm kgetstr +.Nd routines for accessing the keycap database +.Sh SYNOPSIS +.Ft int +.Fn kgetent "char *bp" "char *name" +.Ft int +.Fn kgetnum "char *id" +.Ft int +.Fn kgetflag "char *id" +.Ft char * +.Fn kgetstr "char *id" "char *area" +.Sh DESCRIPTION +These functions extract and use capabilities from a keyboard capability data +base, usually +.Pa /usr/share/misc/keycap.pcvt , +the format of which is described in +.Xr keycap 5 . +.Pp +The +.Fn kgetent +function +extracts the entry for keyboard mapping +.Fa name +into the buffer at +.Fa bp . +The +.Fa bp +argument +should be a character buffer of size +1024 and must be retained through all subsequent calls to +.Fn kgetnum , +.Fn kgetflag , +and +.Fn kgetstr . +The +.Fn kgetent +function +returns \-1 if none of the +.Nm keycap +data base files could be opened, +0 if the map name given does not have an entry, +and 1 if all goes well. +.Pp +The +.Fn kgetnum +function +gets the numeric value of capability +.Fa id , +returning \-1 if is not given for the map. +.Pp +The +.Fn kgetflag +function +returns 1 if the specified capability is present in +the map's entry, 0 if it is not. +.Pp +The +.Fn kgetstr +function +returns the string value of the capability +.Fa id , +places it in the buffer at +.Fa area , +and advances the +.Fa area +pointer. +The +.Fn kgetstr +function +returns +.Dv NULL +if the capability was not found. +.Pp +.Sh FILES +.Bl -tag -width /usr/share/misc/keycap.pcvt -compact +.It Pa /usr/share/misc/keycap.pcvt +Keyboard capabilities database (if nothing else chosen during installation). +.El +.Sh SEE ALSO +.Xr kcon 1 , +.Xr keycap 5 diff --git a/usr.sbin/pcvt/keycap/keycap.c b/usr.sbin/pcvt/keycap/keycap.c new file mode 100644 index 0000000..9bbb7e5 --- /dev/null +++ b/usr.sbin/pcvt/keycap/keycap.c @@ -0,0 +1,377 @@ +/*- + * Copyright (c) 1992, 1993 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Holger Veit + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +static char *id = + "@(#)keycap.c, 3.20, Last Edit-Date: [Tue Dec 20 14:51:50 1994]"; + +/*---------------------------------------------------------------------------* + * + * keycap.c Keyboard capabilities database handling + * ------------------------------------------------------- + * + * converted from printcap by Holger Veit (veit@du9ds3.uni-duisburg.de) + * + * BUG: Should use a "last" pointer in tbuf, so that searching + * for capabilities alphabetically would not be a n**2/2 + * process when large numbers of capabilities are given. + * + * Note: If we add a last pointer now we will screw up the + * tc capability. We really should compile termcap. + * + * modified by Hellmuth Michaelis (hm@hcshh.hcs.de) to fit into the + * vt220 driver pcvt 2.0 distribution + * + * -hm header conversion & cosmetic changes for pcvt 2.0 distribution + * -hm debugging remapping + * -hm cleaning up from termcap .... + * -hm split off header file keycap.h + * + *---------------------------------------------------------------------------*/ + +#include +#include + +#include "keycap.h" + +#define KEYCAP_BUFSIZ 1024 + +#define MAXHOP 32 /* max number of tc= indirections */ + +char *getenv(); + +static FILE *pfp = NULL; /* keycap data base file pointer */ +static char *tbuf; +static int hopcount; /* detect infinite loops in keycap, init 0 */ + +static int knchktc(); +static int knamatch(); +static char *kdecode(); + +/*---------------------------------------------------------------------------* + * match a name + *---------------------------------------------------------------------------*/ +static char *nmatch(id,cstr) +char *id,*cstr; +{ + register n = strlen(id); + register char *c = cstr+n; + + if (strncmp(id,cstr,n)==0 && + (*c==':' || *c=='|' || *c=='=' || *c=='#') || *c=='@') + return c; + return 0; +} + +/*---------------------------------------------------------------------------* + * Get an entry for keyboard name in buffer bp from the keycap file. + * Parse is very rudimentary, we just notice escaped newlines. + *---------------------------------------------------------------------------*/ +kgetent(bp, name) +char *bp, *name; +{ + register char *cp; + register int c; + register int i = 0, cnt = 0; + char ibuf[KEYCAP_BUFSIZ]; + char *cp2; + int tf; + + tbuf = bp; + tf = 0; + + tf = open(KEYCAP_PATH, 0); + + if (tf < 0) + return (-1); + for (;;) { + cp = bp; + for (;;) { + if (i == cnt) { + cnt = read(tf, ibuf, KEYCAP_BUFSIZ); + if (cnt <= 0) { + close(tf); + return (0); + } + i = 0; + } + c = ibuf[i++]; + if (c == '\n') { + if (cp > bp && cp[-1] == '\\'){ + cp--; + continue; + } + break; + } + if (cp >= bp+KEYCAP_BUFSIZ) { + write(2,"Keycap entry too long\n", 23); + break; + } else + *cp++ = c; + } + *cp = 0; + + /* + * The real work for the match. + */ + if (knamatch(name)) { + close(tf); + return(knchktc()); + } + } +} + +/*---------------------------------------------------------------------------* + * knchktc: check the last entry, see if it's tc=xxx. If so, recursively + * find xxx and append that entry (minus the names) to take the place of + * the tc=xxx entry. Note that this works because of the left to right scan. + *---------------------------------------------------------------------------*/ +static int knchktc() +{ + register char *p, *q; + char tcname[16]; /* name of similar keyboard */ + char tcbuf[KEYCAP_BUFSIZ]; + char *holdtbuf = tbuf; + int l; + + p = tbuf + strlen(tbuf) - 2; /* before the last colon */ + while (*--p != ':') + if (p MAXHOP) { + write(2, "Infinite tc= loop\n", 18); + return (0); + } + if (kgetent(tcbuf, tcname) != 1) + return(0); + for (q=tcbuf; *q != ':'; q++) + ; + l = p - holdtbuf + strlen(q); + if (l > KEYCAP_BUFSIZ) { + write(2, "Keycap entry too long\n", 23); + q[KEYCAP_BUFSIZ - (p-tbuf)] = 0; + } + strcpy(p, q+1); + tbuf = holdtbuf; + return(1); +} + +/*---------------------------------------------------------------------------* + * knamatch deals with name matching. The first field of the keycap entry + * is a sequence of names separated by |'s, so we compare against each such + * name. The normal : terminator after the last name (before the first field) + * stops us. + *---------------------------------------------------------------------------*/ +static int knamatch(np) +char *np; +{ + register char *Np, *Bp; + + Bp = tbuf; + if (*Bp == '#' || *Bp == 0) + return(0); + for (;;) { + for (Np = np; *Np && *Bp == *Np; Bp++, Np++) + continue; + if (*Np == 0 && (*Bp == '|' || *Bp == ':' || *Bp == 0)) + return (1); + while (*Bp && *Bp != ':' && *Bp != '|') + Bp++; + if (*Bp == 0 || *Bp == ':') + return (0); + Bp++; + } +} + +/*---------------------------------------------------------------------------* + * Skip to the next field. Notice that this is very dumb, not knowing about + * \: escapes or any such. If necessary, :'s can be put into the keycap file + * in octal. + *---------------------------------------------------------------------------*/ +static char *kskip(bp) +char *bp; +{ + while (*bp && *bp != ':') + bp++; + if (*bp == ':') + bp++; + return (bp); +} + +/*---------------------------------------------------------------------------* + * Return the (numeric) option id. Numeric options look like 'li#80' i.e. + * the option string is separated from the numeric value by a # character. + * If the option is not found we return -1. Note that we handle octal + * numbers beginning with 0. + *---------------------------------------------------------------------------*/ +int kgetnum(id) +char *id; +{ + register int i, base; + register char *bp = tbuf,*xp; + + for (;;) { + bp = kskip(bp); + if (*bp == 0) + return (-1); + if ((xp=nmatch(id,bp)) == 0) + continue; + bp = xp; /* we have an entry */ + if (*bp == '@') + return(-1); + if (*bp != '#') + continue; + bp++; + base = 10; + if (*bp == '0') + base = 8; + i = 0; + while (isdigit(*bp)) + i *= base, i += *bp++ - '0'; + return (i); + } +} + +/*---------------------------------------------------------------------------* + * Handle a flag option. Flag options are given "naked", i.e. followed by + * a : or the end of the buffer. Return 1 if we find the option, or 0 if + * it is not given. + *---------------------------------------------------------------------------*/ +int kgetflag(id) +char *id; +{ + register char *bp = tbuf,*xp; + + for (;;) { + bp = kskip(bp); + if (!*bp) + return (0); + if ((xp=nmatch(id,bp)) != 0) { + bp = xp; + if (!*bp || *bp == ':') + return (1); + else if (*bp == '@') + return(0); + } + } +} + +/*---------------------------------------------------------------------------* + * Get a string valued option. These are given as 'cl=^Z'. Much decoding + * is done on the strings, and the strings are placed in area, which is a + * ref parameter which is updated. No checking on area overflow. + *---------------------------------------------------------------------------*/ +char *kgetstr(id, area) +char *id; +char **area; +{ + register char *bp = tbuf,*xp; + + for (;;) { + bp = kskip(bp); + if (!*bp) + return (0); + if ((xp = nmatch(id,bp)) == 0) + continue; + bp = xp; + if (*bp == '@') + return(0); + if (*bp != '=') + continue; + bp++; + return (kdecode(bp, area)); + } +} + +/*---------------------------------------------------------------------------* + * kdecode does the grung work to decode the string capability escapes. + *---------------------------------------------------------------------------*/ +static char *kdecode(str, area) +char *str; +char **area; +{ + register char *cp; + register int c; + register char *dp; + int i; + + cp = *area; + while ((c = *str++) && c != ':') { + switch (c) { + + case '^': + c = *str++ & 037; + break; + + case '\\': + dp = "E\033^^\\\\::n\nr\rt\tb\bf\f"; + c = *str++; +nextc: + if (*dp++ == c) { + c = *dp++; + break; + } + dp++; + if (*dp) + goto nextc; + if (isdigit(c)) { + c -= '0', i = 2; + do + c <<= 3, c |= *str++ - '0'; + while (--i && isdigit(*str)); + } + break; + } + *cp++ = c; + } + *cp++ = 0; + str = *area; + *area = cp; + return (str); +} + +/*-------------------------------- EOF --------------------------------------*/ diff --git a/usr.sbin/pcvt/keycap/keycap.h b/usr.sbin/pcvt/keycap/keycap.h new file mode 100644 index 0000000..1dc4c3e --- /dev/null +++ b/usr.sbin/pcvt/keycap/keycap.h @@ -0,0 +1,49 @@ +/*- + * Copyright (c) 1992, 1993 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Holger Veit + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)keycap.h, 3.20, Last Edit-Date: [Tue Dec 20 14:52:11 1994] + */ + +#ifndef _KEYCAP_H_ +#define _KEYCAP_H_ + +int kgetent( char*, char* ); +int kgetnum( char* ); +int kgetflag( char* ); +char *kgetstr( char*, char** ); + +#endif /* _KEYCAP_H_ */ + +/*-------------------------------- EOF -------------------------------------*/ diff --git a/usr.sbin/pcvt/keycap/keycap.src b/usr.sbin/pcvt/keycap/keycap.src new file mode 100644 index 0000000..d4545ba --- /dev/null +++ b/usr.sbin/pcvt/keycap/keycap.src @@ -0,0 +1,630 @@ +# Copyright (c) 1992, 1993, 1994 Hellmuth Michaelis, Joerg Wunsch and +# Holger Veit. +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgement: +# This product includes software developed by Hellmuth Michaelis, +# Joerg Wunsch and Holger Veit. +# 4. The names of the Authors may not be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# @(#)keycap.src, 3.20, Last Edit-Date: [Wed Mar 8 20:53:01 1995] +# +#--------------------------------------------------------------------------- +# +# keyboard mappings for vt220 emulator pcvt 3.00 +# ---------------------------------------------- +# +# DEC MCS and/or ISO-Latin-1 Characterset used +# +# MF II Keyboards fully supported +# AT Keyboards lack a ALTGR Key, so they cannot be handled by +# the current driver implementation .... sorry +# +# If you design a new entry for national keyboards, please +# send it to hm@hcshh.hcs.de, thank you ! +# +# Many entries are taken from the 386BSD patchkit 0.2.4 codrv +# +#--------------------------------------------------------------------------- +# +# -hm patch from Thomas Gellekum +# -hm renamed finnish "f8" entry to "f1" +# +#--------------------------------------------------------------------------- + +df|default|default entry:\ + :de: + +tt|test|Test entry which swaps y and z:\ + :K22=z:S22=Z:C22=\032:\ + :K46=y:S46=Y:C46=\031: + +# from codrv, untested +be|belgium|Belgian mapping:\ + :K1=\262:S1=\263:\ + :K2=&:S2=1:A2=|:\ + :K3=\351:S3=2:A3=@:\ + :K4=":S4=3:A4=#:\ + :K5=':S5=4:\ + :K6=(:S6=5:\ + :K7=\247:S7=6:A7=\136:\ + :K8=\350:S8=7:\ + :K9=!:S9=8:\ + :K10=\347:S10=9:A10={:\ + :K11=\340:S11=0:A11=}:\ + :K12=):S12=\260:\ + :K13=-:S13=_:\ + :K17=a:S17=A:C17=^A:\ + :K18=z:S18=Z:C18=^z:\ + :K27=\136:S27=\250:A27=[:p1#27:\ + :K28=$:S28=*:A28=]:\ + :K31=q:S31=Q:C31=^q:\ + :K40=m:S40=M:C40=^m:\ + :K41=\371:S41=%:A41=':p2#41:\ + :K42=\265:S42=\243:A42=\264:p3#42:\ + :K45=<:S45=>:A45=\\:\ + :K46=w:S46=W:C46=^w:\ + :K52=,:S52=\077:\ + :K53=;:S53=.:\ + :K54=\072:S54=/:\ + :K55==:S55=+:A55=~:\ + :l1#62:a0: + +# from codrv, untested +ca|canadafr|Canadian French mapping:\ + :K1=#:S1=|:A1=\\:\ + :A2=\261:S3=":A3=@:S4=/:A4=\243:A5=\242:\ + :A6=\244:S7=\077:A7=\254:S8=&:A8=\246:S9=*:A9=\262:\ + :S10=(:A10=\263:S11=):A11=\274:\ + :K12=-:S12=_:A12=\275:\ + :K13==:S13=+:A13=\276:\ + :A25=\247:A26=\266:\ + :K27=\136:S27=\136:A27=[:\ + :K28=\270:S28=\250:A28=]:p1#28:\ + :A40=~:K41=`:S41=`:A41={:\ + :K42=<:S42=>:A42=}:\ + :K45=\253:S45=\273:A45=\260:\ + :A49=\253:A50=\273:A51=\260:\ + :A52=\265:K53=,:S53=,:A53=-:\ + :K54=\351:S54=\311:A54=':\ + :l1#62:a0: + +# from codrv, untested +c1|swissde|Swiss German mapping:\ + :K1=\247:S1=\260:p1#1:\ + :S2=+:A2=|:S3=":A3=@:S4=*:A4=#:S5=\347:S7=&:A7=\254:\ + :S8=/:A8=\246:S9=(:A9=\242:S10=):S11==:\ + :K12=`:S12=\077:A12=':p2#12:\ + :K13=^:S13=\\:A13=~:p3#13:\ + :K22=z:S22=Z:C22=\032:\ + :S27=\350:K27=\374:A27=[:\ + :K28=\250:S28=!:A28=]:\ + :S40=\351:K40=\366:\ + :S41=\340:K41=\344:A41={:\ + :K42=$:S42=\243:A42=}:\ + :K45=<:S45=>:A45=\\:\ + :K46=y:S46=Y:C46=\031: + :S53=;:S54=\072:K55=-:S55=_:\ + :l1#62:a0: + +# from codrv, untested +c2|swissfr|Swiss French mapping:\ + :K27=\350:S27=\374:A27=[:\ + :K40=\351:S40=\366:\ + :K41=\340:S41=\344:A41={:\ + :tc=swissde: + +# more programmer-like than an original German kbd, you needn't +# have gum-fingers to get `{}' and the like:-) +# maps: ae -> [, oe -> \, ue -> ], Ae -> {, Oe -> |, Ue -> } +# umlaute are available as AltGr- and Control-Mappings +# also maps Pause -> ^Z +# +# (from Joerg Wunsch) +# +# l1/m1 bindings: left Alt is AltGr +# Emacs functions: +# C79/C89: ctrl-{leftarrow,rightarrow} {backward,forward} word +# A79/A89: {backward,forward} sexp +# C83/C84: ctrl-{uparrow,downarrow} {backward,forward} window +# +de-prog|germany-prog|programmer's mapping for german keyboard:\ + :K27=]:S27=}:A27=\374:C27=\334:\ + :K40=\\:S40=|:A40=\366:C40=\326:\ + :K41=[:S41={:A41=\344:C41=\304:\ + :K126=\032:C126=\003:\ + :tc=de: +# :l1#60:l2#62:\ +# :C79=^[B:K79=^[[D:S79=^[OD:A79=^[^B:\ +# :C89=^[F:K89=^[[C:S89=^[OC:A89=^[^F:\ +# :C83=^U-1^XO:K83=^[[A:S84=^[OA:\ +# :C84=^XO:K84=^[[B:S84=^[OB:\ + +de|germany|German mapping for MF II-Keyboard:\ + :K1=\136:S1=\260:\ + :S3=\042:S4=\247:S7=&:S8=/:S9=(:S10=):S11=\075:\ + :A3=\262:A4=\263:A8={:A9=[:A10=]:A11=}:A12=\134:\ + :K12=\337:S12=?:C12=\034:\ + :K13=':S13=`:\ + :A17=\100:\ + :K22=z:S22=Z:C22=\032:\ + :K27=\374:S27=\334:\ + :K28=+:S28=*:A28=\176:\ + :K29=\043:S29=':A29=\174:\ + :K40=\366:S40=\326:\ + :K41=\344:S41=\304:\ + :A45=\174:\ + :K46=y:S46=Y:C46=\031:\ + :A52=\265:\ + :S53=;:S54=\072:\ + :K55=-:S55=_:\ + :l1#62: + +de-at|germany-at|German mapping for AT-Keyboard:\ + :K1=<:S1=>:\ + :S3=\042:\ + :S4=\247:\ + :S7=&:\ + :S8=/:\ + :S9=(:\ + :S10=):\ + :S11=\075:\ + :K12=\337:S12=?:C12=\034:\ + :K13=':S13=`:\ + :K14=#:S14=\136:\ + :K22=z:S22=Z:C22=\032:\ + :K27=\374:S27=\334:\ + :K28=+:S28=*:\ + :K29=\043:S29=':\ + :K40=\366:S40=\326:\ + :K41=\344:S41=\304:\ + :K46=y:S46=Y:C46=\031:\ + :S53=;:S54=\072:\ + :K55=-:S55=_:\ + +# from codrv, untested +# Includes improvements by Thomas Hiller (hiller@fzi.de) +# and Andreas Israel (ai@hrz.tu-chemnitz.de) +de-hi|germany-hiller|yet another German mapping:\ + :K1=\136:S1=\260:C1=|:\ + :S3=\042:S4=#:S7=&:S8=/:S9=(:S10=):S11=\075:\ + :A8={:A9=[:A10=]:A11=}:A17=@:A28=~:\ + :K12=\337:S12=\077:C12=\036:A12=\\:\ + :K13=':S13=`:C13=\134:p1#13:\ + :K22=z:S22=Z:C22=\032:\ + :K27=\374:S27=\334:C27=\035:\ + :K28=+:S28=*:C28=\000:\ + :K29=<:S29=>:C29=\134:\ + :K40=\366:S40=\326:C40=\034:\ + :K41=\344:S41=\304:C41=\033:\ + :K46=y:S46=Y:C46=\031:\ + :S53=;:S54=\072:\ + :K55=-:S55=_:\ + :l1#62:a0: + +# from codrv, untested +# Contribution by Thomas Hiller (hiller@fzi.de) +# "K42 may not work on 102 keys kbds, K29 seems to work" +d1|de-102|german with mf2:\ + :K29=#:\ + :K42=#:\ + :K45=<:S45=>:A45=|:\ + :tc=germany: + +# from codrv, untested +hv|holgi|Holgi's special MF1 keyboard mapping:\ + :K1=<:S1=>:C1=|:\ + :K29=#:S29=\136:A29=\\:C29=~:\ + :tc=germany: + +# from codrv, untested +# Contributed by Andreas Israel (ai@hrz.tu-chemnitz.de) +de-ai|nixmf2|ct22|nix|nix7|German Nixdorf MF2:\ + :A28=~:\ + :K29=#:S29=':\ + :K45=<:S45=>:A45=|:\ + :tc=germany: + +# from codrv, untested +dk|denmark|Danish mapping:\ + :K1=\275:S1=\247:\ + :S3=":A3=@:\ + :A4=\243:\ + :S5=\244:A5=$:\ + :S7=&:S8=/:A8={:S9=(:A9=[:S10=):A10=]:S11==:A11=}:\ + :K12=+:S12=\077:\ + :K13=':S13=`:A13=|:p1#13:\ + :K27=\345:S27=\305:\ + :K28=\250:S28=\136:A28=~:p2#28:\ + :K40=\346:S40=\306:\ + :K41=\370:S41=\330:\ + :K42=:S42=*:\ + :K45=<:S45=>:A45=\\:\ + :S53=;:S54=\072:\ + :K55=-:S55=_:\ + :l1#62:a0: + +# from codrv, untested +# Finnish keyboard map with 7-bit versions of the national +# chars. The Latin1 chars are available with Alt-7, Alt-8, etc +# (where normally you would have the 7-bit ones). +# Makes C/C++ programming more comfortable, since the 7-bit chars +# (|\{[}]) are needed much more often than the Latin1 chars. +# -- Petri.Wessman@hut.fi +fi|finland|finland7b|finland-ascii|Finnish ASCII mapping:\ + :l1#60:l2#62:\ + :A8=\344:A9=\304:A10=\305:A11=\345:A12=\326:A13=\366:\ + :K40=|:S40=\\:K41={:S41=[:K27=}:S27=]:\ + :S1=\275:K1=\247:\ + :S3=":A3=@:\ + :A4=\243:\ + :S5=$:A5=$:\ + :S7=&:S8=/:S9=(:S10=):S11==:\ + :K12=+:S12=\077:\ + :K13=':S13=`:\ + :K28=~:S28=\136:A28=~:\ + :K29=':S29=*:\ + :K45=<:S45=>:A45=|:\ + :S53=;:S54=\072:\ + :K55=-:S55=_:\ + :a0: + +# from codrv, untested +# Finnish keyboard map with the Latin1 national chars in +# their "right" place. --Petri.Wessman@hut.fi +f1|finland8b|finland-latin1|Finnish Latin1 mapping:\ + :A8={:A9=[:A10=]:A11=}:A12=\\:\ + :K40=\366:S40=\326:K41=\344:S41=\304:K27=\345:S27=\305:\ + :tc=finland: + + +# French keyboard mapping +# From Matthieu Herrb +# For 102 keys keyboards, produces 8 bits characters +# with ISO Latin-1 encoding +f8|france-iso-8859-1|French ISO 8859-1 102 keys keyboard:\ + :l1#62:\ + :K1=\262:S1=:\ + :K2=&:S2=1:\ + :K3=\351:S3=2:C3=\211:A3=~:\ + :K4=":S4=3:A4=#:\ + :K5=':S5=4:A5={:\ + :K6=(:S6=5:A6=[:\ + :K7=-:S7=6:C7=\036:A7=|:\ + :K8=\350:S8=7:C8=\210:A8=`:\ + :K9=_:S9=8:C9=\037:A9=\\:\ + :K10=\347:S10=9:C10=\207:A10=\136:\ + :K11=\340:S11=0:C11=\340:A11=@:\ + :K12=):S12=\260:A12=]:\ + :A13=}:\ + :K17=a:S17=A:C17=\001:\ + :K18=z:S18=Z:C18=\032:\ + :D27:\ + :K28=$:S28=\243:\ + :K29=*:S29=\265:\ + :K31=q:S31=Q:C31=\021:\ + :K40=m:S40=M:C40=\015;\ + :K41=\371:C41=\231:S41=%:\ + :K42=*:S42=\265:\ + :K46=w:S46=W:C46=\027:\ + :K52=,:S52=?:\ + :K53=;:S53=.:\ + :K54=\072:S54=/:C54=\037\ + :K55=!:S55=\266: + +# fr|france|French mapping:\ +# :de: +# +# from codrv, untested +# f1|france120|French 120 mapping:\ +# :tc=belgium: +# +# +# from codrv, untested +#f2|france189|French 189 mapping:\ +# :S1=:A1=':p3#1:\ +# :A2=:A3=~:A5={:A6=[:A7=|:A8=`:\ +# :S9=_:A9=\\:A10=\136:A11=@:A12=]:A13=}:\ +# :A27=:A28=\244:A41=:A42=:\ +# :A45=:!:S45=\247:\ +# :tc=belgium: + +# From: Andy Duplain, duplain@rtf.bt.co.uk +gb|greatbritain|British mapping for MF-2 keyboard:\ + :S1=|:S3=":C3=2:C12=-:S41=@:K42=#:S42=~:C42=#:K45=\\:S45=|:C45=\\: + +# from codrv, untested +# This entry has been corrected by Mike Trim (mtrim@crucible.demon.co.uk) +# (hv's comment: For the keys # and ~ you might also check the following +# line +# :K42=#:S42=~:\ +# Also I think I was wrong with the ALTGR key. If you need one, add this: +# :l1#62: +g1|greatbritain166|British 166 mapping:\ + :K1=`:S1=\254:A1=|:\ + :S3=":S4=\243:\ + :K41=':S41=@:\ + :K29=#:S29=~:\ + :K45=\\:S45=|: + +# from codrv, untested +g2|greatbritain168|British 168 mapping:\ + :K1=\\:S1=|:\ + :S3=":S4=\243:S7=&:S8=:S9=(:S10=):A10=\261:\ + :S11=#:A11=\260:S12=:K13=\254:S13=-:\ + :K27=@:S27=`:\ + :K28=[:S28={:A28=~:\ + :K40=;:S40=+:\ + :K41=\072:S41=*:A41=\136:\ + :K42=]:S42=}:\ + :K45=|:S45=_:\ + :A52=\265:\ + :l1#62:a0: + +# from codrv, untested +is:iceland:Island mapping:\ + :K1=\260:S1=\250:p1#1:\ + :S2=":S7=&:S8=/:A8={:S9=(:A9=[:S10=):A10=]:S11==:A11=}:\ + :K12=\\:S12=\326:\ + :K13=':S13=`:A13=|:\ + :A17=@:K27=\360:S27=\320:\ + :K28=':S28=\077:A28=~:\ + :K40=\346:S40=\306:\ + :K41=':S41=':A41=\136:p2#41:\ + :K42=+:S42=*:A42=`:p3#42:\ + :K45=<:S45=>:A45=|:\ + :S53=;:S54=\072:\ + :K54=\376:S54=\336:\ + :K104=,:104=,:\ + :l1#62:a0: + +# from codrv, untested +i1|italy141|Italian 141 mapping:\ + :K1=\\:S1=|:\ + :S3=":S4=\243:S7=&:S8=/:S9=(:S10=):S11==:\ + :K12=':S12=\077:\ + :K13=\354:S13=\136:\ + :K27=\350:S27=\351:\A27=[:\ + :K28=+:S28=*:A28=]:\ + :K40=\362:S40=\347:A40=@:\ + :K41=\340:S41=\260:A41=#:\ + :K42=\371:S42=\247:\ + :K45=<:S45=>:\ + :S53=;:S54=\072:\ + :K55=-:S55=_:\ + :l1#62:a0: + +# from codrv, untested +i2|italy142|Italian 142 mapping:\ + :A8={:A9=[:A10=]:A11=}:\ + :A17=@:A27=:A28=~:A40=:A41=:\ + :tc=italy141:a0: + +# from codrv, untested +nl|netherlands|Dutch mapping:\ + :K1=@:S1=\247:A1=\254:\ + :A2=\271:S3=":A3=\262:S4=#:A4=\263:A5=\274:A6=\275:S7=&:\ + :A7=\276:S8=_:A8=\243:S9=(:A9={:S10=):A10=}:S11=':\ + :K12=/:S12=\077:A12=\\:\ + :K13=\260:S13=~:A13=\270:p1#13:\ + :K20=\266:K27=\250:S27=^:p2#27:\ + :K28=*:S28=|:\ + :K40=+:S40=\261:\ + :K41=':S41=`:\ + :K42=<:S42=>:\ + :K45=[:S45=]:A45=|:\ + :S53=;:S54=\072:K55=-:S55=_:\ + :K104=,:S104=,:\ + :l1#62:a0: + +# Norwegian keyboard map with national characters. +# Anders Nordby, anders@fix.no +no|norway|Norwegian 8bit mapping ISO 8859-1:\ + :K1=\174:S1=\247:\ + :K2=\61:S2=\41:\ + :K3=\62:S3=\42:A3=\100:\ + :K4=\63:S4=\43:A4=\243:\ + :K5=\64:S5=\244:A5=\44:\ + :K6=\65:S6=\45:\ + :K7=\66:S7=\46:\ + :K8=\67:S8=\57:A8=\173:\ + :K9=\70:S9=\50:A9=\133:\ + :K10=\71:S10=\51:A10=\135:\ + :K11=\60:S11=\75:A11=\175:\ + :K12=\53:S12=\77:\ + :K13=\134:S13=\140:A13=\264:\ + :K28=\250:S28=\136:A28=\176:\ + :K29=\47:S29=\52:\ + :K54=\56:S54=\72:\ + :K53=\54:S53=\73:\ + :K55=\55:S55=\137:\ + :K41=\346:S41=\306:\ + :K40=\370:S40=\330:\ + :K27=\345:S27=\305:\ + :l1#62:a0: + +# from codrv, untested +pt|portugal|Portugesian mapping:\ + :K1=\\:S1=|:\ + :S3=":A3=@:A4=\243:A5=\247:S7=&:S8=/:A8={:S9=(:A9=[:\ + :S10=):A10=]:S11=}:A11==:\ + :K12=':S12=\077:\ + :K13=\253:S13=\273:\ + :K40=\347:S40=\307:\ + :K41=\272:S41=\252:\ + :K42=~:S42=^:p1#42:\ + :K45=<:S45=>:\ + :S53=;:S54=\072:K55=-:S55=_:\ + :l1#62:a0: + +# from codrv, untested +es|spain|Spainish mapping:\ + :K1=\272:S1=\252:A1=\\:\ + :A2=|:S3=":A3=@:S4=:A4=#:S7=&:A7=\254:S8=/:S9=(:S10=):S11==:\ + :K12=':S12=\077:p1#12:\ + :K13=\277:S13=\241:\ + :K27=`:S27=^:A27=[:p2#27:\ + :K28=+:S28=*:A28=]:\ + :K40=\361:S41=\321:\ + :K41=/:S41=\250:A41={:p3#41:\ + :K42=\347:S42=\307:A42=}:\ + :K45=<:S45=>:\ + :S53=;:S54=\072:\ + :K55=-:S55=_:\ + :K104=,:S104=,:\ + :l1#62:a0: + +# from codrv, untested +# Contributed by Mats O Jansson, moj@stacken.kth.se +# "Here is my map, rather large, but i want ALTGR normaly to be dead. +# Only seven bit national characters have been placed where national characters +# is on the keyboard." +# We can help this man, just use the 'a0' capability -hv- +s1|sweden1|Swedish mapping:\ + :l1#62:a0:\ + :D1:\ + :K12=+:K13=':K29=':\ + :S2=!:S3=":S4=#:S5=$:S6=%:S7=&:S8=/:\ + :S9=(:S10=):S11=\075:S12=\077:S13=`:S29=*:\ + :C2=:C3=\000:C4=\033:C5=\034:C6=\035:C7=:C8=:C9=:\ + :C10=:C11=:C12=:C13=:C29=:\ + :A3=\100:A5=$:A8={:\ + :A9=[:A10=]:A11=}:A12=\134:\ + :K27=]:K28=:\ + :S27=}:S28=\136:\ + :C27=\035:C28=:\ + :A28=\176:\ + :K40=\134:K41=[:\ + :S40=|:S41={:\ + :C40=\034:C41=\033:\ + :K45=<:K53=,:K54=.:K55=-:\ + :S45=>:S53=;:S54=\072:S55=_:\ + :C45=\034:C53=:C54=:C55=:\ + :A45=|:\ + :C61=\000: + +# from codrv, untested +# Contributed by Mats O Jansson, moj@stacken.kth.se +# "Here is my map, rather large, but i want ALTGR normaly to be dead. +# Only seven bit national characters have been placed where national +# characters is on the keyboard." +# We can help this man, just use the 'a0' capability -hv- +# Corrected by Paul Pries, 5322@msg.abc.se (Some national shifts were +# wrong). +sa|sweden1a|Swedish 7bit mapping ISO 646:\ + :l1#62:a0:\ + :D1:\ + :K12=+:K13=':K29=':\ + :S2=!:S3=":S4=#:S5=$:S6=%:S7=&:S8=/:\ + :S9=(:S10=):S11=\075:S12=\077:S13=`:S29=*:\ + :C2=:C3=\000:C4=\033:C5=\034:C6=\035:C7=:C8=:C9=:\ + :C10=:C11=:C12=:C13=:C29=:\ + :A3=\100:A5=$:A8={:\ + :A9=[:A10=]:A11=}:A12=\134:\ + :K27=}:K28=:\ + :S27=]:S28=\136:\ + :C27=\035:C28=:\ + :A28=\176:\ + :S40=\134:S41=[:\ + :K40=|:K41={:\ + :C40=\034:C41=\033:\ + :K45=<:K53=,:K54=.:K55=-:\ + :S45=>:S53=;:S54=\072:S55=_:\ + :C45=\034:C53=:C54=:C55=:\ + :A45=|:\ + :C61=\000: + +# from codrv, untested +# Swedish keyboard map with national characters. +# Paul Pries, 5322@msg.abc.se +s2|sweden2|Swedish 8bit mapping ISO 8859-1:\ + :l1#62:\ + :K1=\247:S1=:\ + :K12=+:K13=':K29=':\ + :S2=!:S3=":S4=#:S5=$:S6=%:S7=&:S8=/:\ + :S9=(:S10=):S11=\075:S12=\077:S13=`:S29=*:\ + :C2=:C3=\000:C4=\033:C5=\034:C6=\035:C7=:C8=:C9=:\ + :C10=:C11=:C12=:C13=:C29=:\ + :A3=\100:A4=\234:A5=$:A8={:\ + :A9=[:A10=]:A11=}:A12=\134:\ + :K27=\206:K28=:\ + :S27=\217:S28=\136:\ + :C27=\035:C28=:\ + :A28=\176:\ + :S40=\231:S41=\216:\ + :K40=\224:K41=\204:\ + :C40=\034:C41=\033:\ + :K45=<:K53=,:K54=.:K55=-:\ + :S45=>:S53=;:S54=\072:S55=_:\ + :C45=\034:C53=:C54=:C55=:\ + :A45=|:\ + :C61=\000: + +# +# tg: my idiosyncratic mappings (thomas@ghpc8.ihf.rwth-aachen.de) +# +# the six function keys above the cursor keys are arranged +# identical to a real VT220: +# +# find insert remove +# select up down +# +# since i don't have a use for the numbers on the keypad, +# i map NumLock, /, *, - to PF1-PF4; +# + is mapped to SS3 l, shifted + is mapped to SS3 m +# +# they convinced me finally to add some support for german umlauts. +# so, i stole the mapping from jörg wunsch's de-prog entry. +# +# tg +# + +tg:\ + :l1#62:\ + :A12=\337:\ + :A27=\374:C27=\334:\ + :A40=\366:C40=\326:\ + :A41=\344:C41=\304:\ + :K126=\032:C126=\003:\ + :K75=[1~:S75=[1~:C75=[1~:\ + :K76=[4~:S76=[4~:C76=[4~:\ + :K80=[2~:S80=[2~:C80=[2~:\ + :K81=[5~:S81=[5~:C81=[5~:\ + :K85=[3~:S85=[3~:C85=[3~:\ + :K86=[6~:S86=[6~:C86=[6~:\ + :K90=OP:S90=OP:C90=OP:\ + :K95=OQ:S95=OQ:C95=OQ:\ + :K100=OR:S100=OR:C100=OR:\ + :K104=On:S104=On:C104=On:\ + :K105=OS:S105=OS:C105=OS:\ + :K106=Ol:S106=Om:\ + :K108=OM:S108=OM:C108=OM: + +us|usa|United States mapping:\ + :de: + +# EOF diff --git a/usr.sbin/pcvt/keycap/man5/keycap.5 b/usr.sbin/pcvt/keycap/man5/keycap.5 new file mode 100644 index 0000000..d15cd5b --- /dev/null +++ b/usr.sbin/pcvt/keycap/man5/keycap.5 @@ -0,0 +1,130 @@ +.\" +.\" Copyright (c) 1992,1993,1994 Hellmuth Michaelis +.\" +.\" Copyright (c) 1990 The Regents of the University of California. +.\" +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)keycap.5, 3.00, Last Edit-Date: [Sun Jan 2 13:45:59 1994] +.\" $Id: keycap.5,v 1.5 1997/02/22 16:09:10 peter Exp $ +.\" +.Dd January 3, 1993 +.Dt KEYCAP 5 +.Sh NAME +.Nm keycap +.Nd keyboard mapping data base +.Sh SYNOPSIS +.Nm keycap +.Sh DESCRIPTION +The +.Nm keycap +file +is a data base describing keyboard mappings, used by +.Xr kcon 1 . +.Pp +Entries in +.Nm keycap +consist of a number of `:'-separated fields. +The first entry for each mapping gives the names that are known for the +mapping, separated by `|' characters. +All names but the first and last +should be in lower case and contain no blanks; +the last name may well contain +upper case and blanks for readability. +.Sh CAPABILITIES +.Pp +.Bl -column indent indent +.Sy Name Type Description +.It "de bool Resets Keyboard mapping to compiled-in default" +.It "D bool Disables key completely" + +.It "m num specify key numbers for ALT keys +.It "l num specify key numbers for ALTGR keys +.It "h num specify key numbers for SHIFT keys +.It "t num specify key numbers for CONTROL keys +.It "ca num specify key number for the CAPS LOCK key +.It "sh num specify key number for the SHIFT LOCK key +.It "nl num specify key number for the NUM LOCK key +.It "sc num specify key number for the SCROLL LOCK key + +.It "K str bind a string to a unshifted (normal) key +.It "S str bind a string to a shifted key +.It "C str bind a string to a control key +.It "A str bind a string to a altgr key + +.It "tc str Entry of similar map \- must be last." +.El + +Parameter describing the key number can have values from 1 to 128. + +A string parameter may have up to 15 characters. + +.Pp +.Ss A Sample Entry +The following entry, which describes a test entry, is among the very +easy entries in the +.Nm keycap +file as of this writing. +.Pp +.Bd -literal +tt\||test\||Test entry which swaps y and z:\e + :K22=z:S22=Z:C22=\e032:\e + :K46=y:S46=Y:C46=\e031: + +.Ed +.Pp +Entries may continue onto multiple lines by giving a \e as the last +character of a line. Comments may be included on lines beginning with +.Dq # . +.Sh FILES +.Bl -tag -width /usr/share/misc/keycap.pcvt -compact +.It Pa /usr/share/misc/keycap.pcvt +File containing keyboard mapping descriptions. +.El +.Sh SEE ALSO +.Xr kcon 1 , +.Xr keycap 3 +.Sh EXAMPLES +The entry +.Dq Li l1#60 +sets the keynumber for the ALTGR key to 60. + +The entry +.Dq Li K100=hugo +binds the string 'hugo' to the key number 100. + +The entry +.Dq Li K100=^D +binds the control character EOT (0x04) to the key number 100. + +The entry +.Dq Li K100=\e000 +binds the control character NUL (0x00) to the key number 100. diff --git a/usr.sbin/pcvt/loadfont/Makefile b/usr.sbin/pcvt/loadfont/Makefile new file mode 100644 index 0000000..c0f454f --- /dev/null +++ b/usr.sbin/pcvt/loadfont/Makefile @@ -0,0 +1,3 @@ +PROG= loadfont + +.include diff --git a/usr.sbin/pcvt/loadfont/loadfont.1 b/usr.sbin/pcvt/loadfont/loadfont.1 new file mode 100644 index 0000000..64fd3de --- /dev/null +++ b/usr.sbin/pcvt/loadfont/loadfont.1 @@ -0,0 +1,90 @@ +.\" Copyright (c) 1992, 1995 Hellmuth Michaelis +.\" +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by Hellmuth Michaelis +.\" 4. The name authors may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" @(#)loadfont.1, 3.20, Last Edit-Date: [Tue Apr 4 13:06:00 1995] +.\" +.Dd April 4, 1995 +.Dt LOADFONT 1 +.Sh NAME +.Nm loadfont +.Nd is used to load fonts into EGA or VGA boards for use by the 'pcvt' video +driver. +.Sh SYNOPSIS +.Nm loadfont +.Op Fl c Ar charsetno +.Op Fl d Ar devicefile +.Op Fl f Ar fontfilename +.Op Fl i +.Sh DESCRIPTION +The +.Nm loadfont +utility is used to load fonts needed for proper operation of the pcvt +VT220 driver on EGA and VGA boards into the font ram of this boards. +.Pp +The options are as follows: +.Bl -tag -width Ds +.It Fl c +Specifies the slot, the font is to load into. EGA boards have four +slots and VGA boards have eight slots available for downloading fonts. +.It Fl d +Specifies the devicefile to use. +.It Fl f +Specifies the file which contains the font to be downloaded. +.It Fl i +Gives information what type(s) of font do currently reside in which slot. +This is also the default behaviour if no options are specified on the commandline. +.El +.Pp +This utility is used only on EGA and VGA boards, as MDA, HCG and CGA boards +do not have downloadable charactersets available. +.Sh FILES +The following fontfiles are available in the pcvt distribution: + +.nf +/usr/share/misc/pcvtfonts/vt220l.808: 8x8 IBM II font +/usr/share/misc/pcvtfonts/vt220h.808: 8x8 Extension font +/usr/share/misc/pcvtfonts/vt220l.810: 8x10 IBM II font +/usr/share/misc/pcvtfonts/vt220h.810: 8x10 Extension font +/usr/share/misc/pcvtfonts/vt220l.814: 8x14 IBM II font +/usr/share/misc/pcvtfonts/vt220h.814: 8x14 Extension font +/usr/share/misc/pcvtfonts/vt220l.816: 8x16 IBM II font +/usr/share/misc/pcvtfonts/vt220h.816: 8x16 Extension font +.fi +.Sh EXAMPLES +The command +.Dq Li loadfont -c0 -f/usr/share/misc/pcvtfonts/vt220l.816 +loads a 8x16 font containing the standard IBM characterset II into font slot +0 on a VGA or EGA board. +.Sh BUGS +No known bugs +.Sh SEE ALSO +.Xr cursor 1 , +.Xr scon 1 , +.Xr pcvt 4 , +.Xr ispcvt 8 diff --git a/usr.sbin/pcvt/loadfont/loadfont.c b/usr.sbin/pcvt/loadfont/loadfont.c new file mode 100644 index 0000000..ce4abc3 --- /dev/null +++ b/usr.sbin/pcvt/loadfont/loadfont.c @@ -0,0 +1,345 @@ +/* + * Copyright (c) 1992, 1995 Hellmuth Michaelis + * + * Copyright (c) 1992, 1994 Brian Dunford-Shore + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by + * Hellmuth Michaelis and Brian Dunford-Shore + * 4. The name authors may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +static char *id = + "@(#)loadfont.c, 3.20, Last Edit-Date: [Fri Apr 7 10:13:16 1995]"; + +/*---------------------------------------------------------------------------* + * + * load a font into vga character font memory + * + * -hm removing explicit HGC support (same as MDA ..) + * -hm new pcvt_ioctl.h SIZ_xxROWS + * -hm add -d option + * + *---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include + +#define FONT8X8 2048 /* filesize for 8x8 font */ +#define HEIGHT8X8 8 /* 8 scan lines char cell height */ +#define SSCAN8X8 143 /* 400 scan lines on screen - 256 - 1 */ + +#define FONT8X10 2560 /* filesize for 8x10 font */ +#define HEIGHT8X10 10 /* 10 scan lines char cell height */ +#define SSCAN8X10 143 /* 400 scan lines on screen - 256 - 1 */ + +#define FONT8X14 3584 /* filesize for 8x14 font */ +#define HEIGHT8X14 14 /* 14 scan lines char cell height */ +#define SSCAN8X14 135 /* 392 scan lines on screen - 256 - 1 */ + +#define FONT8X16 4096 /* filesize for 8x16 font */ +#define HEIGHT8X16 16 /* 16 scan lines char cell height */ +#define SSCAN8X16 143 /* 400 scan lines on screen - 256 - 1 */ + +struct screeninfo screeninfo; + +#define DEFAULTFD 0 +int fd; + + +main(argc,argv) +int argc; +char *argv[]; +{ + extern int optind; + extern int opterr; + extern char *optarg; + + FILE *in; + struct stat sbuf, *sbp; + unsigned char *fonttab; + int ret; + int chr_height; + int scr_scan; + int scr_rows; + int c; + int chr_set = -1; + char *filename; + int fflag = -1; + int info = -1; + int dflag = 0; + char *device; + + while( (c = getopt(argc, argv, "c:d:f:i")) != -1) + { + switch(c) + { + case 'c': + chr_set = atoi(optarg); + break; + + case 'd': + device = optarg; + dflag = 1; + break; + + case 'f': + filename = optarg; + fflag = 1; + break; + + case 'i': + info = 1; + break; + + case '?': + default: + usage(); + break; + } + } + + if(chr_set == -1 || fflag == -1) + info = 1; + + if(dflag) + { + if((fd = open(device, O_RDWR)) == -1) + { + char buffer[80]; + strcpy(buffer,"ERROR opening "); + strcat(buffer,device); + perror(buffer); + exit(1); + } + } + else + { + fd = DEFAULTFD; + } + + if(info == 1) + { + int i; + + if(ioctl(fd, VGAGETSCREEN, &screeninfo) == -1) + { + perror("ioctl VGAGETSCREEN failed"); + exit(1); + } + + switch(screeninfo.adaptor_type) + { + case UNKNOWN_ADAPTOR: + case MDA_ADAPTOR: + case CGA_ADAPTOR: + printf("Adaptor does not support Downloadable Fonts!\n"); + break; + case EGA_ADAPTOR: + printheader(); + for(i = 0;i < 4;i++) + { + printvgafontattr(i); + } + break; + case VGA_ADAPTOR: + printheader(); + for(i = 0;i < 8;i++) + { + printvgafontattr(i); + } + } + printf("\n"); + exit(0); + } + + if(chr_set < 0 || chr_set > 7) + usage(); + + sbp = &sbuf; + + if((in = fopen(filename, "r")) == NULL) + { + char buffer[80]; + sprintf(buffer, "cannot open file %s for reading", filename); + perror(buffer); + exit(1); + } + + if((fstat(fileno(in), sbp)) != 0) + { + char buffer[80]; + sprintf(buffer, "cannot fstat file %s", filename); + perror(buffer); + exit(1); + } + + switch(sbp->st_size) + { + case FONT8X8: + chr_height = HEIGHT8X8; + scr_scan = SSCAN8X8; + scr_rows = SIZ_50ROWS; + break; + + case FONT8X10: + chr_height = HEIGHT8X10; + scr_scan = SSCAN8X10; + scr_rows = SIZ_40ROWS; + break; + + case FONT8X14: + chr_height = HEIGHT8X14; + scr_scan = SSCAN8X14; + scr_rows = SIZ_28ROWS; + break; + + case FONT8X16: + chr_height = HEIGHT8X16; + scr_scan = SSCAN8X16; + scr_rows = SIZ_25ROWS; + break; + + default: + fprintf(stderr,"error, file %s is no valid font file, size=%d\n",argv[1],sbp->st_size); + exit(1); + } + + if((fonttab = (unsigned char *)malloc((size_t)sbp->st_size)) == NULL) + { + fprintf(stderr,"error, malloc failed\n"); + exit(1); + } + + if((ret = fread(fonttab, sizeof(*fonttab), sbp->st_size, in)) != sbp->st_size) + { + fprintf(stderr,"error reading file %s, size = %d, read = is no valid font file, size=%d\n",argv[1],sbp->st_size, ret); + exit(1); + } + + loadfont(chr_set, chr_height, fonttab); + setfont(chr_set, 1, chr_height - 1, scr_scan, scr_rows); + + exit(0); +} + +setfont(charset, fontloaded, charscan, scrscan, scrrow) +int charset, fontloaded, charscan, scrscan, scrrow; +{ + struct vgafontattr vfattr; + + vfattr.character_set = charset; + vfattr.font_loaded = fontloaded; + vfattr.character_scanlines = charscan; + vfattr.screen_scanlines = scrscan; + vfattr.screen_size = scrrow; + + if(ioctl(fd, VGASETFONTATTR, &vfattr) == -1) + { + perror("loadfont - ioctl VGASETFONTATTR failed, error"); + exit(1); + } +} + +loadfont(fontset,charscanlines,font_table) +int fontset; +int charscanlines; +unsigned char *font_table; +{ + int i, j; + struct vgaloadchar vlc; + + vlc.character_set = fontset; + vlc.character_scanlines = charscanlines; + + for(i = 0; i < 256; i++) + { + vlc.character = i; + for (j = 0; j < charscanlines; j++) + { + vlc.char_table[j] = font_table[j]; + } + font_table += charscanlines; + if(ioctl(fd, VGALOADCHAR, &vlc) == -1) + { + perror("loadfont - ioctl VGALOADCHAR failed, error"); + exit(1); + } + } +} + +printvgafontattr(charset) +int charset; +{ + struct vgafontattr vfattr; + static int sizetab[] = { 25, 28, 35, 40, 43, 50 }; + + vfattr.character_set = charset; + + if(ioctl(fd, VGAGETFONTATTR, &vfattr) == -1) + { + perror("loadfont - ioctl VGAGETFONTATTR failed, error"); + exit(1); + } + printf(" %d ",charset); + if(vfattr.font_loaded) + { + + printf("Loaded "); + printf(" %2.2d ", sizetab[vfattr.screen_size]); + printf(" %2.2d ", + (((int)vfattr.character_scanlines) & 0x1f) + 1); + printf(" %3.3d", + ((int)vfattr.screen_scanlines+0x101)); + } + else + { + printf("Empty"); + } + printf("\n"); +} + +printheader() +{ + printf("\nEGA/VGA Charactersets Status Info:\n\n"); + printf("Set Status Lines CharScanLines ScreenScanLines\n"); + printf("--- ------ ----- ------------- ---------------\n"); +} + +usage() +{ + fprintf(stderr,"\nloadfont - load font into ega/vga font ram for pcvt video driver\n"); + fprintf(stderr,"usage: loadfont -c -d -f -i\n"); + fprintf(stderr," -c characterset to load (ega 0..3, vga 0..7)\n"); + fprintf(stderr," -d specify device\n"); + fprintf(stderr," -f filename containing binary font data\n"); + fprintf(stderr," -i print status and types of loaded fonts (default)\n"); + exit(1); +} diff --git a/usr.sbin/pcvt/mcon/Makefile b/usr.sbin/pcvt/mcon/Makefile new file mode 100644 index 0000000..1a3b934 --- /dev/null +++ b/usr.sbin/pcvt/mcon/Makefile @@ -0,0 +1,3 @@ +PROG= mcon + +.include diff --git a/usr.sbin/pcvt/mcon/mcon.1 b/usr.sbin/pcvt/mcon/mcon.1 new file mode 100644 index 0000000..61bd467 --- /dev/null +++ b/usr.sbin/pcvt/mcon/mcon.1 @@ -0,0 +1,166 @@ +.\" Copyright (c) 1994 Joerg Wunsch +.\" +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by Joerg Wunsch +.\" 4. The name authors may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" @(#)mcon.1, 3.00, Last Edit-Date: [Mon Jan 10 21:28:22 1994] +.\" +.Dd January 3, 1994 +.Dt MCON 1 +.Sh NAME +.Nm mcon +.Nd controls pcvt mouse emulator +.Sh SYNOPSIS +.Nm mcon +.Op Fl l Ar left-button-key +.Op Fl m Ar mid-button-key +.Op Fl r Ar right-button-key +.Op Fl a Ar accel-time +.Op Fl s Ar 0 | false | \&no +.Op Fl s Ar 1 | true | yes +.Ar device +.Sh DESCRIPTION +The +.Nm mcon +utility controls the configurable parameters for the mouse emulator of +.Xr pcvt 4 . +.br +.Em NB : +The mouse emulator is not configured in by default; the system's config +file needs to specify an option line + +.Em options Dq PCVT_EMU_MOUSE + +in order to get its functionality. +.Pp +Either way, the +.Nm +program must be called with an argument +.Ar device +that specifies the device node used for the mouse emulation. This is +usually the first device node of the +.Xr pcvt 4 +driver not being used as a virtual terminal device. E.\ g., if you +have configured eight virtual terminals +.Pq the default value , +named +.Pa /dev/ttyv0 +through +.Pa /dev/ttyv7 , +the mouse emulator would allocate +.Pa /dev/ttyv8 . + +If +.Nm +is called without any option, it will print the actual values of the +configurable parameters. + +If called with an option, the program attempts to set up the new value. +.Pp +The options are as follows: +.Bl -tag -width Ds +.It Fl l Ar left-button-key +.It Fl m Ar mid-button-key +.It Fl r Ar right-button-key +Maps the named +.Ar button key +to emulate either the left, middle, or right mouse button. +.Ar Button key +is the usual name for that key. Normal ASCII keys are denoted by the +character they're labeled with, function keys are named +.Em f1 +through +.Em f10 . +Note that the AT function keys +.Em f11 +and +.Em f12 +are +.Em extended +keys that cannot be mapped to be used with the mouse emulator since +it only allows basic PC-scancode keys to be used. + +.It Fl a Ar accel-time +Set the time limit for the internal accelerator to +.Ar accel-time +milliseconds. Key events occurring after a longer time than this limit +will move the mouse cursor in single steps. Key events arriving more +frequently will move the cursor accelerated by a factor of 6. Note that +despite of +.Em milliseconds +being the unit of choice here, the time resolution is restricted by the +timer tick distance of the underlying operating system, usually to a +granularity of 10 milliseconds. + +.It Fl s Ar 0 | false | \&no +.It Fl s Ar 1 | true | yes +The first form disables, the second form enables the +.Em sticky +behaviour of the mouse buttons. Sticky mouse keys behave much like +toggle-buttons: on first press, they become active, on second press, +they're deactivated. Pressing another button will deactivate any +other sticky button anyway. + +Sticky buttons might be more convenient since you don't need 20 fingers +at all; on the other hand, they make it virtually impossible to initiate +double or triple mouse clicks. +.El +.Sh EXAMPLES +The following example would install the default behaviour of the +mouse emulator: + +.Nm mcon +.Fl l Ar f1 +.Fl m Ar f2 +.Fl r Ar f3 +.Fl a Ar 250 +.Fl s Ar \&no +.Pa /dev/ttyv8 +.Sh BUGS +The key names used to map the button-emulating keys to scan codes +.Pq and vica verse +are based on the American keyboard layout. This would usually not +cause any trouble since the +.Dq button-of-choice +is certainly some function key that should be equal for any national +keyboard layout. +.Pp +The mouse emulator is a rude hack at all; its only purpose is to provide +a device to move the pointer within an X-windowing environment. +.Sh SEE ALSO +.Xr X 1 , +.Xr pcvt 4 +.Sh HISTORY +The +.Nm +utility appeared in +.Xr pcvt 4 , +release 3.00. +.Sh AUTHORS +The mouse emulator has been contributed by +.if n Joerg Wunsch. +.if t J\(:org Wunsch. diff --git a/usr.sbin/pcvt/mcon/mcon.c b/usr.sbin/pcvt/mcon/mcon.c new file mode 100644 index 0000000..db39944 --- /dev/null +++ b/usr.sbin/pcvt/mcon/mcon.c @@ -0,0 +1,193 @@ +/* + * Copyright (c) 1994 Joerg Wunsch + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Joerg Wunsch + * 4. The name authors may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @(#)mcon.c, 3.20, Last Edit-Date: [Tue Dec 20 14:53:15 1994] + */ + +/*---------------------------------------------------------------------------* + * + * history: + * + * -jw initial version; includes a basic mapping between PeeCee + * scan codes and key names + * -hm changed sys/pcvt_ioctl.h -> machine/pcvt_ioctl.h + * + *---------------------------------------------------------------------------*/ + +/* + * Utility program to wire the mouse emulator control ioctl to the + * user level. Allows setting of any configurable parameter, or + * display the current configuration. + */ + +#include +#include +#include +#include +#include +#include + +static const char *keynames[] = { + "", "esc", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", + "-", "+", "bksp", "tab", "q", "w", "e", "r", "t", "y", "u", + "i", "o", "p", "[", "]", "enter", "ctrl", "a", "s", "d", "f", + "g", "h", "j", "k", "l", ";", "\"", "`", "lshift", "\\", + "z", "x", "c", "v", "b", "n", "m", ",", ".", "/", "rshift", + "prtscr", "alt", "space", "caps", "f1", "f2", "f3", "f4", + "f5", "f6", "f7", "f8", "f9", "f10", "numlock", "scrolllock", + "kp7", "kp8", "kp9", "kp-", "kp4", "kp5", "kp6", "kp+", + "kp1", "kp2", "kp3", "kp0", "kp." +}; + + +const char *scantoname(int scan) { + if(scan >= sizeof keynames / sizeof(const char *)) + return "???"; + else + return keynames[scan]; +} + +int nametoscan(const char *name) { + int i; + for(i = 0; i < sizeof keynames / sizeof(const char *); i++) + if(strcmp(keynames[i], name) == 0) + return i; + return -1; +} + + +int main(int argc, char **argv) { + int c, errs = 0, fd, do_set = 0; + int left = 0, mid = 0, right = 0, accel = 0, sticky = -1; + struct mousedefs mdef; + + while((c = getopt(argc, argv, "l:m:r:a:s:")) != -1) + switch(c) { + case 'l': + left = nametoscan(optarg); + do_set = 1; + if(left == -1) goto keynameerr; + break; + + case 'm': + mid = nametoscan(optarg); + do_set = 1; + if(mid == -1) goto keynameerr; + break; + + case 'r': + right = nametoscan(optarg); + do_set = 1; + if(right == -1) goto keynameerr; + break; + + keynameerr: + { + fprintf(stderr, "unknown key name: %s\n", + optarg); + errs++; + } + break; + + case 'a': + accel = 1000 * strtol(optarg, 0, 10); + do_set = 1; + break; + + case 's': + if(strcmp(optarg, "0") == 0 + || strcmp(optarg, "false") == 0 + || strcmp(optarg, "no") == 0) + sticky = 0; + else if(strcmp(optarg, "1") == 0 + || strcmp(optarg, "true") == 0 + || strcmp(optarg, "yes") == 0) + sticky = 1; + else { + fprintf(stderr, "invalid argument to -s: %s\n", + optarg); + errs++; + } + do_set = 1; + break; + + default: + errs++; + } + + argc -= optind; + argv += optind; + + if(errs || argc != 1) { + fprintf(stderr, "usage: " + "mouse [-l key][-m key][-r key][-a acctime][-s 0|1] " + "mousedev\n"); + return 2; + } + + if((fd = open(argv[0], O_RDONLY)) < 0) { + perror("open(mousedev)"); + return 2; + } + if(ioctl(fd, KBDMOUSEGET, &mdef) < 0) { + perror("ioctl(KBDMOUSEGET)"); + return 1; + } + + if(!do_set) { + printf("Current mouse emulator definitions:\n" + "left button: %s\n" + "middle button: %s\n" + "right button: %s\n" + "acceleration limit: %d msec\n" + "sticky buttons: %s\n", + scantoname(mdef.leftbutton), + scantoname(mdef.middlebutton), + scantoname(mdef.rightbutton), + mdef.acceltime / 1000, + mdef.stickybuttons? "yes": "no"); + return 0; + } + + if(left) mdef.leftbutton = left & 0x7f; + if(mid) mdef.middlebutton = mid & 0x7f; + if(right) mdef.rightbutton = right & 0x7f; + + if(accel) mdef.acceltime = accel; + if(sticky != -1) mdef.stickybuttons = sticky; + + if(ioctl(fd, KBDMOUSESET, &mdef) < 0) { + perror("ioctl(KBDMOUSESET)"); + return 1; + } + + return 0; +} diff --git a/usr.sbin/pcvt/scon/Makefile b/usr.sbin/pcvt/scon/Makefile new file mode 100644 index 0000000..6fdb94e --- /dev/null +++ b/usr.sbin/pcvt/scon/Makefile @@ -0,0 +1,3 @@ +PROG= scon + +.include diff --git a/usr.sbin/pcvt/scon/scon.1 b/usr.sbin/pcvt/scon/scon.1 new file mode 100644 index 0000000..7787fda --- /dev/null +++ b/usr.sbin/pcvt/scon/scon.1 @@ -0,0 +1,214 @@ +.\" Copyright (c) 1992,1993,1994 Hellmuth Michaelis and Joerg Wunsch +.\" +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by +.\" Hellmuth Michaelis and Joerg Wunsch +.\" 4. The name authors may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" @(#)scon.1, 3.00, Last Edit-Date: [Mon Jan 10 21:30:48 1994] +.\" +.Dd December 31, 1993 +.Dt SCON 1 +.Sh NAME +.Nm scon +.Nd controls screen modes for pcvt video driver +.Sh SYNOPSIS +.Nm scon +.Op Fl a +.Op Fl c Ar screenno +.Op Fl d Ar device +.Op Fl f Ar on|off +.Op Fl h +.Op Fl H +.Op Fl l +.Op Fl m +.Op Fl v +.Op Fl V +.Op Fl s Ar lines +.br +.Nm scon +.Op Fl v +.Op Fl d Ar device +.Fl p Ar entry,red,green,blue +.br +.Nm scon +.Op Fl v +.Op Fl d Ar device +.Fl p Ar default +.br +.Nm scon +.Op Fl v +.Op Fl d Ar device +.Fl p Ar list +.Nm scon +.Op Fl v +.Fl t Ar timeout +.Nm scon +.Op Fl v +.Fl 1 | Fl 8 +.Sh DESCRIPTION +The +.Nm scon +utility controls several aspects of the runtime behaviour of the pcvt vt220 +driver. +.Pp +The options are as follows: +.Bl -tag -width Ds +.It Fl a +Returns a string describing the video adaptor found by pcvt, the string +returned could be MDA, HGC, CGA, EGA, VGA or UNKNOWN. +.It Fl c +Specify the screen number the current (displayed) screen should be switched +to. +.It Fl d +Specify the device filename (i.e. /dev/ttyv2) further operations specified on +the command line should be applied to. +.It Fl f +Some programs which silently assume 24 lines when they run on a VT220 show +incorrect behaviour when the terminal has really 25 lines. To support full +VT220 behaviour, it is possible to force pcvt to select only 24 lines when +it is running in 25-lines pure VT mode and/or in 28-lines HP-mode. The +.Fl f +option requires one additional parameter, the string 'on' or 'off' to switch +this mode for a virtual screen on or off respectively. This mode has no effect +if any other vertical resolutions are selected than the two above mentioned. +.It Fl h +Prints a usage/help text. +.It Fl l +Lists the current configuration of runtime changeable options and fixed +parameters (such as the type of the adaptor, and in case of a VGA adaptor, +the Manufacturer, Chipset and 132 column support) of the output portion +of the pcvt driver. +.It Fl m +Returns a string describing the connected display monitor type found by pcvt, +the string returned can be MONO, COLOR or UNKNOWN. +.It Fl v +Specify verbose operation of the program. +.It Fl V +Switch the specified/current screen into a pure VT220 mode without recognizing +any HP escape sequences and without displaying function key labels. +.It Fl H +Switch the specified/current screen into a mixed HP/VT220 mode. That is, that +in addition to the full VT220 emulation, the HP function key labels and the +escape sequences for handling the labels are available to the user. +.It Fl s +Specify the number of character lines on the screen. Possible parameters are +25, 28, 35, 40, 43 or 50. To use all this screen sizes, the fonts required +for proper operation of a desired size have to be downloaded to the EGA/VGA +font ram. This option is available only for EGA and VGA boards. +.It Fl p +Modify VGA palette +.Pq DAC . +The +.Fl p +is mutually exclusive with +.Fl s , +.Fl H , +and +.Fl V . +Naturally, option +.Fl p +is available only for VGA boards. Three flavors are available. + +If used with argument +.Dq Ar default , +this flag will restore the default palette +.Po +as installed by VGA ROM BIOS after hardware reset +.Pc . + +If used with argument +.Dq Ar list , +the current VGA DAC palette entries are listed. Each entry contains +the table index, values for red, green, and blue, and if there's a +known name for this entry, the color name. Trailing empty table +slots (RGB values all zero) are omitted. + +Otherwise, four comma-separated arguments are expected. The first +denotes the number of palette entry to be modified. This may be either +a number between 0 and 255, or the usual name of an associated color +.Pq case-insensitive . +The following values for red, green and blue are restricted to 0 through 63 +due to VGA DAC conventions. +Note that the first delimiter within such an argument may be a colon +.Dq \&: +instead of a comma +.Dq \&, +for better readability, but this violates common command argument +conventions. +Multiple +.Fl p +options may be specified if unambiguous. +.It Fl t +Specifying +.Fl t +will activate the screen saver. The behaviour depends on +.Ar timeout : +if +.Ar timeout +is given as 0, the screen saver is turned off. Otherwise, +.Ar timeout +is taken as a number of seconds to wait until activating the +screen saver. +NOTE: the +.Fl t +option is only available if screen saver support has been compiled into +the driver ! +.It Fl 1 +Sets 132 columns mode +.Pq only available on VGA adaptors . +.It Fl 8 +Sets 80 columns mode. +.El +.Pp +When switching between HP and VT mode, when switching the force 24 lines +mode on and off, or when switching between 80 and 132 columns operation, +the screen is cleared, the scrolling +region is reset and the cursor is placed in the home position. +.Sh EXAMPLES +The command +.Dq Li scon Fl H s Ar 28 +places the current screen into HP mode and sets the screen size to 28x80. + +Invoking +.Do +.Li scon Fl p +.Ar lightgray,0,15,0 +.Fl p +.Ar 0:45,45,45 +.Dc +will result in green on gray output for normal text. +Note that normal text color is light gray, and not white as one might expect. +.Sh BUGS +the +.Fl c +and +.Fl d +options collide somehow, this will change in a future release. +.Sh SEE ALSO +.Xr cursor 1 , +.Xr loadfont 1 , +.Xr pcvt 4 diff --git a/usr.sbin/pcvt/scon/scon.c b/usr.sbin/pcvt/scon/scon.c new file mode 100644 index 0000000..d42d5c4 --- /dev/null +++ b/usr.sbin/pcvt/scon/scon.c @@ -0,0 +1,856 @@ +/* + * Copyright (c) 1992,1993,1994 Hellmuth Michaelis and Joerg Wunsch + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by + * Hellmuth Michaelis and Joerg Wunsch + * 4. The name authors may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +static char *id = + "@(#)scon.c, 3.20, Last Edit-Date: [Sun Sep 25 12:33:21 1994]"; + +/*---------------------------------------------------------------------------* + * + * history: + * + * -hm moving fd for default device from 1 -> 0 for such things + * as "scon -p list | more" to be possible + * (reported by Gordon L. Burditt, gordon@sneaky.lonestar.org) + * -hm adding option "a" for just returning the type of video adaptor + * -hm removing explicit HGC support, same as MDA ... + * -hm vga type/family/132col support info on -l + * -hm force 24 lines in DEC 25 lines mode and HP 28 lines mode + * -hm fixed bug with 132 column mode display status display + * -jw added 132/80 col mode switching + * -hm removed -h flag, use -? now ... ;-) + * -hm S3 chipsets .. + * -hm Cirrus chipsets support from Onno van der Linden + * -hm -m option, display monitor type + * -hm bugfix, scon -c cleared dest screen, fixed + * + *---------------------------------------------------------------------------*/ + +#include +#include +#include + +#define DEFAULTFD 0 + +int aflag = -1; +int lflag = -1; +int mflag = -1; +int current = -1; +int pflag = -1; +int hflag = -1; +int res = -1; +char *device; +int dflag = -1; +int vflag = 0; +int Pflag = 0; +int tflag = 0; +int fflag = -1; +int colms = 0; +char *onoff; + +unsigned timeout; +struct screeninfo screeninfo; + +#define NVGAPEL 256 + +struct rgb { + unsigned r, g, b; + int dothis; +}; + +static struct rgb palette[NVGAPEL] = { + { 0x00, 0x00, 0x00, 0}, /* 0 - black */ + { 0x00, 0x00, 0x2a, 0}, /* 1 - blue */ + { 0x00, 0x2a, 0x00, 0}, /* 2 - green */ + { 0x00, 0x2a, 0x2a, 0}, /* 3 - cyan */ + { 0x2a, 0x00, 0x00, 0}, /* 4 - red */ + { 0x2a, 0x00, 0x2a, 0}, /* 5 - magenta */ + { 0x2a, 0x2a, 0x00, 0}, /* 6 */ + { 0x2a, 0x2a, 0x2a, 0}, /* 7 - lightgray */ + { 0x00, 0x00, 0x15, 0}, /* 8 */ + { 0x00, 0x00, 0x3f, 0}, /* 9 */ + { 0x00, 0x2a, 0x15, 0}, /* 10 */ + { 0x00, 0x2a, 0x3f, 0}, /* 11 */ + { 0x2a, 0x00, 0x15, 0}, /* 12 */ + { 0x2a, 0x00, 0x3f, 0}, /* 13 */ + { 0x2a, 0x2a, 0x15, 0}, /* 14 */ + { 0x2a, 0x2a, 0x3f, 0}, /* 15 */ + { 0x00, 0x15, 0x00, 0}, /* 16 */ + { 0x00, 0x15, 0x2a, 0}, /* 17 */ + { 0x00, 0x3f, 0x00, 0}, /* 18 */ + { 0x00, 0x3f, 0x2a, 0}, /* 19 */ + { 0x2a, 0x15, 0x00, 0}, /* 20 - brown */ + { 0x2a, 0x15, 0x2a, 0}, /* 21 */ + { 0x2a, 0x3f, 0x00, 0}, /* 22 */ + { 0x2a, 0x3f, 0x2a, 0}, /* 23 */ + { 0x00, 0x15, 0x15, 0}, /* 24 */ + { 0x00, 0x15, 0x3f, 0}, /* 25 */ + { 0x00, 0x3f, 0x15, 0}, /* 26 */ + { 0x00, 0x3f, 0x3f, 0}, /* 27 */ + { 0x2a, 0x15, 0x15, 0}, /* 28 */ + { 0x2a, 0x15, 0x3f, 0}, /* 29 */ + { 0x2a, 0x3f, 0x15, 0}, /* 30 */ + { 0x2a, 0x3f, 0x3f, 0}, /* 31 */ + { 0x15, 0x00, 0x00, 0}, /* 32 */ + { 0x15, 0x00, 0x2a, 0}, /* 33 */ + { 0x15, 0x2a, 0x00, 0}, /* 34 */ + { 0x15, 0x2a, 0x2a, 0}, /* 35 */ + { 0x3f, 0x00, 0x00, 0}, /* 36 */ + { 0x3f, 0x00, 0x2a, 0}, /* 37 */ + { 0x3f, 0x2a, 0x00, 0}, /* 38 */ + { 0x3f, 0x2a, 0x2a, 0}, /* 39 */ + { 0x15, 0x00, 0x15, 0}, /* 40 */ + { 0x15, 0x00, 0x3f, 0}, /* 41 */ + { 0x15, 0x2a, 0x15, 0}, /* 42 */ + { 0x15, 0x2a, 0x3f, 0}, /* 43 */ + { 0x3f, 0x00, 0x15, 0}, /* 44 */ + { 0x3f, 0x00, 0x3f, 0}, /* 45 */ + { 0x3f, 0x2a, 0x15, 0}, /* 46 */ + { 0x3f, 0x2a, 0x3f, 0}, /* 47 */ + { 0x15, 0x15, 0x00, 0}, /* 48 */ + { 0x15, 0x15, 0x2a, 0}, /* 49 */ + { 0x15, 0x3f, 0x00, 0}, /* 50 */ + { 0x15, 0x3f, 0x2a, 0}, /* 51 */ + { 0x3f, 0x15, 0x00, 0}, /* 52 */ + { 0x3f, 0x15, 0x2a, 0}, /* 53 */ + { 0x3f, 0x3f, 0x00, 0}, /* 54 */ + { 0x3f, 0x3f, 0x2a, 0}, /* 55 */ + { 0x15, 0x15, 0x15, 0}, /* 56 - darkgray */ + { 0x15, 0x15, 0x3f, 0}, /* 57 - lightblue */ + { 0x15, 0x3f, 0x15, 0}, /* 58 - lightgreen */ + { 0x15, 0x3f, 0x3f, 0}, /* 59 - lightcyan */ + { 0x3f, 0x15, 0x15, 0}, /* 60 - lightred */ + { 0x3f, 0x15, 0x3f, 0}, /* 61 - lightmagenta */ + { 0x3f, 0x3f, 0x15, 0}, /* 62 - yellow */ + { 0x3f, 0x3f, 0x3f, 0}, /* 63 - white */ + { 0x00, 0x00, 0x00, 0} /* 64 ... - empty */ +}; + +static struct colname { + const char *name; + unsigned idx; +} colnames[] = { + {"black", 0}, + {"blue", 1}, + {"green", 2}, + {"cyan", 3}, + {"red", 4}, + {"magenta", 5}, + {"brown", 20}, + {"lightgray", 7}, + {"lightgrey", 7}, + {"darkgray", 56}, + {"darkgrey", 56}, + {"lightblue", 57}, + {"lightgreen", 58}, + {"lightcyan", 59}, + {"lightred", 60}, + {"lightmagenta", 61}, + {"yellow", 62}, + {"white", 63}, + /* must be terminator: */ {(const char *)NULL, 0} +}; + + +static void parsepopt(char *arg, unsigned *idx, + unsigned *r, unsigned *g, unsigned *b); +static void printpalette(int fd); + +main(argc,argv) +int argc; +char *argv[]; +{ + extern int optind; + extern int opterr; + extern char *optarg; + + int c; + int fd; + + while( (c = getopt(argc, argv, "ac:d:f:HVlms:t:vp:18")) != -1) + { + switch(c) + { + case 'a': + aflag = 1; + break; + + case 'l': + lflag = 1; + break; + + case 'm': + mflag = 1; + break; + + case 'c': + current = atoi(optarg); + break; + + case 'd': + device = optarg; + dflag = 1; + break; + + case 'f': + onoff = optarg; + fflag = 1; + break; + + case 'V': + pflag = 1; + break; + + case 'H': + hflag = 1; + break; + + case 's': + if (!strncmp(optarg, "25", 2)) + res = SIZ_25ROWS; + else if(!strncmp(optarg, "28", 2)) + res = SIZ_28ROWS; + else if(!strncmp(optarg, "35", 2)) + res = SIZ_35ROWS; + else if(!strncmp(optarg, "40", 2)) + res = SIZ_40ROWS; + else if(!strncmp(optarg, "43", 2)) + res = SIZ_43ROWS; + else if(!strncmp(optarg, "50", 2)) + res = SIZ_50ROWS; + break; + + case 'v': + vflag++; + break; + + case 'p': + if(!strcmp(optarg, "list")) + { + if(Pflag) + { + fprintf(stderr, + "-p list is mutual exclusive " + "with other -p options\n"); + return 2; + } + Pflag = 3; + } + else if(!strcmp(optarg, "default")) + { + if(Pflag) + { + fprintf(stderr, + "multiple -p default not " + "allowed\n"); + return 2; + } + Pflag = 2; + } else { + unsigned idx, r, g, b; + + if(Pflag > 1) + { + fprintf(stderr, + "-p default and -p i,r,g,b " + "ambiguous\n"); + return 2; + } + Pflag = 1; + parsepopt(optarg, &idx, &r, &g, &b); + if(idx >= NVGAPEL) + { + fprintf(stderr, + "index %u in -p option " + "out of range\n", idx); + return 2; + } + palette[idx].r = r; + palette[idx].g = g; + palette[idx].b = b; + palette[idx].dothis = 1; + } + break; + + case 't': + tflag++; + timeout = atoi(optarg); + break; + + case '1': + colms = 132; + break; + + case '8': + colms = 80; + break; + + case '?': + default: + usage(); + break; + } + } + + if((pflag == 1) && (hflag == 1)) + usage(); + + if(dflag == -1 && lflag == -1 && current == -1 && pflag == -1 && + hflag == -1 && res == -1 && Pflag == 0 && tflag == 0 && fflag == -1 + && colms == 0 && mflag == -1) + { + lflag = 1; + } + + if(dflag == -1) + { + if(vflag) + printf("using current device\n"); + fd = DEFAULTFD; /* -hm, Feb 12 1993 */ + } + else + { + if((fd = open(device, O_RDWR)) == -1) + { + char buffer[80]; + strcpy(buffer,"ERROR opening "); + strcat(buffer,device); + perror(buffer); + exit(1); + } + if(vflag) + printf("using device %s\n",device); + } + + if(aflag == 1) /* return adaptor type */ + { + printadaptor(fd); + exit(0); + } + + if(mflag == 1) /* return monitor type */ + { + printmonitor(fd); + exit(0); + } + + if(lflag == 1) /* list information */ + { + if(vflag) + printf("processing option -l, listing screen info\n"); + printinfo(fd); + exit(0); + } + + if(tflag) /* set screen saver timeout */ + { + if(vflag) + { + printf( + "processing option -t, setting screen saver timeout: " + ); + if(timeout) + printf("new timeout = %d s\n", timeout); + else + printf("turned off\n"); + } + + if(ioctl(fd, VGASCREENSAVER, &timeout) < 0) + { + perror("ioctl(VGASCREENSAVER)"); + fprintf(stderr, "Check the driver, the screensaver is probably not compiled in!\n"); + exit(2); + } + goto success; + } + + if(colms) + { + if(vflag) + printf("Setting number of columns to %d\n", colms); + if(ioctl(fd, VGASETCOLMS, &colms) < 0) + { + perror("ioctl(VGASETCOLMS)"); + exit(2); + } + goto success; + } + + if(Pflag == 3) + { + /* listing VGA palette */ + if(vflag) + printf("processing option -p list, " + "listing VGA palette\n"); + + printpalette(fd); + goto success; + } + + if(Pflag) + { + unsigned int idx; + + /* setting VGA palette */ + if(vflag) + printf("processing option -p, setting VGA palette%s\n", + Pflag == 2? " to default": ""); + + for(idx = 0; idx < NVGAPEL; idx++) + if(Pflag == 2 || palette[idx].dothis) + { + struct vgapel p; + p.idx = idx; + p.r = palette[idx].r; + p.g = palette[idx].g; + p.b = palette[idx].b; + if(ioctl(fd, VGAWRITEPEL, (caddr_t)&p) < 0) + { + perror("ioctl(fd, VGAWRITEPEL)"); + return 2; + } + } + goto success; + } + + screeninfo.screen_no = -1; /* We are using fd */ + screeninfo.current_screen = current; + screeninfo.pure_vt_mode = -1; + screeninfo.screen_size = res; + screeninfo.force_24lines = -1; + + if(current != -1) /* set current screen */ + { + if(vflag) + printf("processing option -c, setting current screen to %d\n",current); + + if(ioctl(1, VGASETSCREEN, &screeninfo) == -1) + { + perror("ioctl VGASETSCREEN failed"); + exit(1); + } + exit(0); + } + + if(pflag == 1) + { + if(vflag) + printf("processing option -V, setting emulation to pure VT220\n"); + screeninfo.pure_vt_mode = M_PUREVT; + } + else if(hflag == 1) + { + if(vflag) + printf("processing option -H, setting emulation to VT220 + HP Labels\n"); + screeninfo.pure_vt_mode = M_HPVT; + } + else + { + if(vflag) + printf("no change in terminal emulation\n"); + } + + if(vflag) + { + if(res == -1) + printf("no change in screen resolution\n"); + else if(res == SIZ_25ROWS) + printf("change screen resolution to 25 lines\n"); + else if(res == SIZ_28ROWS) + printf("change screen resolution to 28 lines\n"); + else if(res == SIZ_35ROWS) + printf("change screen resolution to 35 lines\n"); + else if(res == SIZ_40ROWS) + printf("change screen resolution to 40 lines\n"); + else if(res == SIZ_43ROWS) + printf("change screen resolution to 43 lines\n"); + else if(res == SIZ_50ROWS) + printf("change screen resolution to 50 lines\n"); + } + + if(fflag == 1) /* force 24 lines on/off */ + { + if(!strcmp(onoff, "on")) + { + fflag = 1; + } + else if(!strcmp(onoff, "off")) + { + fflag = 0; + } + else + { + fprintf(stderr,"you must specify 'on' or 'off' with -f option!\n"); + exit(1); + } + } + screeninfo.force_24lines = fflag; + + if(ioctl(fd, VGASETSCREEN, &screeninfo) == -1) + { + perror("ioctl VGASETSCREEN failed"); + exit(1); + } +success: + if(vflag) + printf("successful execution of ioctl VGASETSCREEN!\n"); + exit(0); +} + +usage() +{ + fprintf(stderr,"\nscon - screen control utility for the pcvt video driver\n"); + fprintf(stderr,"usage: scon -a -l -m -v -c [n] -d [dev] -f [on|off] -V -H -s [n]\n"); + fprintf(stderr,"usage: scon -p [default | list | i,r,g,b] | -t [sec] | -1 | -8\n"); + fprintf(stderr," -a list video adaptor type (MDA,CGA,EGA or VGA)\n"); + fprintf(stderr," -c switch current virtual screen to \n"); + fprintf(stderr," -d set parameters(-V|-H|-s) for virtual device\n"); + fprintf(stderr," -f force 24 lines in VT 25 lines and HP 28 lines mode\n"); + fprintf(stderr," -H set VT220/HP emulation mode for a virtual screen\n"); + fprintf(stderr," -l list current parameters for a virtual screen\n"); + fprintf(stderr," -m report monitor type (MONO/COLOR)\n"); + fprintf(stderr," -p default set default VGA palette\n"); + fprintf(stderr," -p list list current VGA palette\n"); + fprintf(stderr," -p set VGA palette entry i to r/g/b\n"); + fprintf(stderr," -p set VGA palette entry for color name to r/g/b\n"); + fprintf(stderr," -s set 25, 28, 35, 40, 43 or 50 lines for a virtual screen\n"); + fprintf(stderr," -t set screen saver timeout [seconds]\n"); + fprintf(stderr," -1 set 132 columns mode\n"); + fprintf(stderr," -8 set 80 columns mode\n"); + fprintf(stderr," -v verbose mode\n"); + fprintf(stderr," -V set pure VT220 emulation for a virtual screen\n"); + fprintf(stderr," -? display help (this message)\n\n"); + exit(1); +} + +printadaptor(fd) +int fd; +{ + if(ioctl(fd, VGAGETSCREEN, &screeninfo) == -1) + { + perror("ioctl VGAGETSCREEN failed"); + exit(1); + } + switch(screeninfo.adaptor_type) + { + default: + case UNKNOWN_ADAPTOR: + printf("UNKNOWN\n"); + break; + + case MDA_ADAPTOR: + printf("MDA\n"); + break; + + case CGA_ADAPTOR: + printf("CGA\n"); + break; + + case EGA_ADAPTOR: + printf("EGA\n"); + break; + + case VGA_ADAPTOR: + printf("VGA\n"); + break; + } +} + +printmonitor(fd) +int fd; +{ + if(ioctl(fd, VGAGETSCREEN, &screeninfo) == -1) + { + perror("ioctl VGAGETSCREEN failed"); + exit(1); + } + switch(screeninfo.monitor_type) + { + default: + printf("UNKNOWN\n"); + break; + + case MONITOR_MONO: + printf("MONO\n"); + break; + + case MONITOR_COLOR: + printf("COLOR\n"); + break; + } +} + +char *vga_type(int number) +{ + static char *vga_tab[] = { + "Generic VGA", + "ET4000", + "ET3000", + "PVGA1A", + "WD90C00", + "WD90C10", + "WD90C11", + "VIDEO 7 VEGA", + "VIDEO 7 FAST", + "VIDEO 7 VER5", + "VIDEO 7 1024I", + "Unknown VIDEO 7", + "TVGA 8800BR", + "TVGA 8800CS", + "TVGA 8900B", + "TVGA 8900C", + "TVGA 8900CL", + "TVGA 9000", + "TVGA 9100", + "TVGA 9200", + "Unknown TRIDENT", + "S3 80C911", + "S3 80C924", + "S3 80C801/80C805", + "S3 80C928", + "Unknown S3", + "CL-GD5402", + "CL-GD5402r1", + "CL-GD5420", + "CL-GD5420r1", + "CL-GD5422", + "CL-GD5424", + "CL-GD5426", + "CL-GD5428", + + }; + return(vga_tab[number]); +} + +char *vga_family(int number) +{ + static char *vga_tab[] = { + "Generic VGA", + "Tseng Labs", + "Western Digital", + "Video Seven", + "Trident", + "S3 Incorporated", + "Cirrus Logic", + }; + return(vga_tab[number]); +} + +printinfo(fd) +int fd; +{ + if(ioctl(fd, VGAGETSCREEN, &screeninfo) == -1) + { + perror("ioctl VGAGETSCREEN failed"); + exit(1); + } + + printf( "\nVideo Adaptor Type = "); + + switch(screeninfo.adaptor_type) + { + default: + case UNKNOWN_ADAPTOR: + printf("UNKNOWN Video Adaptor\n"); + break; + + case MDA_ADAPTOR: + printf("MDA - Monochrome Display Adaptor\n"); + break; + + case CGA_ADAPTOR: + printf("CGA - Color Graphics Adaptor\n"); + break; + + case EGA_ADAPTOR: + printf("EGA - Enhanced Graphics Adaptor\n"); + break; + + case VGA_ADAPTOR: + printf("VGA - Video Graphics Adaptor/Array\n"); + printf(" VGA Chipset Manufacturer = %s\n", + vga_family(screeninfo.vga_family)); + printf(" VGA Chipset Type = %s\n", + vga_type(screeninfo.vga_type)); + printf(" Support for 132 Column Mode = %s\n", + screeninfo.vga_132 ? "Yes" : "No"); + break; + } + + printf( "Display Monitor Type = "); + + switch(screeninfo.monitor_type) + { + default: + printf("UNKNOWN Monitor Type\n"); + break; + + case MONITOR_MONO: + printf("Monochrome Monitor\n"); + break; + + case MONITOR_COLOR: + printf("Color Monitor\n"); + break; + } + + printf( "Number of Downloadable Fonts = %d\n",screeninfo.totalfonts); + printf( "Number of Virtual Screens = %d\n",screeninfo.totalscreens); + printf( "Info Request Screen Number = %d\n",screeninfo.screen_no); + printf( "Current Displayed Screen = %d\n",screeninfo.current_screen); + + if(screeninfo.pure_vt_mode == M_PUREVT) + printf( "Terminal Emulation Mode = VT220\n"); + else + printf( "Terminal Emulation Mode = VT220 with HP Features\n"); + + printf( "Lines = "); + + switch(screeninfo.screen_size) + { + case SIZ_25ROWS: + printf( "25\n"); + break; + + case SIZ_28ROWS: + printf( "28\n"); + break; + + case SIZ_35ROWS: + printf( "35\n"); + break; + + case SIZ_40ROWS: + printf( "40\n"); + break; + + case SIZ_43ROWS: + printf( "43\n"); + break; + + case SIZ_50ROWS: + printf( "50\n"); + break; + + default: + printf( "UNKNOWN\n"); + break; + } + printf( "Force 24 Lines = %s", + screeninfo.force_24lines ? "Yes" : "No"); + + printf("\n\n"); +} + +static const char *findname(unsigned idx) +{ + /* try to find a name for palette entry idx */ + /* if multiple names exist, returns first matching */ + register struct colname *cnp; + + for(cnp = colnames; cnp->name; cnp++) + if(cnp->idx == idx) + return cnp->name; + + /* not found */ + return (const char *)NULL; +} + +static void printpalette(int fd) +{ + register unsigned idx, last; + + for(idx = 0; idx < NVGAPEL; idx++) + { + struct vgapel p; + p.idx = idx; + if(ioctl(fd, VGAREADPEL, &p) < 0) + { + perror("ioctl(VGAREADPEL)"); + exit(2); + } + palette[idx].r = p.r; + palette[idx].g = p.g; + palette[idx].b = p.b; + } + + /* find last non-empty entry */ + for(last = NVGAPEL - 1; last; last--) + if(palette[last].r || palette[last].g || palette[last].b) + break; + + if(last != NVGAPEL - 1) + last++; + + /* now, everything's collected. print out table */ + printf("VGA palette status\n"); + printf("index red green blue name\n"); + for(idx = 0; idx < last; idx++) + { + const char *cp; + printf("%5d %5d %5d %5d", + idx, palette[idx].r, palette[idx].g, palette[idx].b); + if(cp = findname(idx)) + printf(" %s\n", cp); + else + putchar('\n'); + } + putchar('\n'); +} + + +static void parsepopt(char *arg, unsigned *idx, + unsigned *r, unsigned *g, unsigned *b) +{ + char firstarg[21]; + register unsigned i; + + if(sscanf(arg, "%20[a-zA-Z0-9]%*[,:]%u,%u,%u", firstarg, r, g, b) < 4 + || strlen(firstarg) == 0) { + fprintf(stderr, "too few args in -p i,r,g,b\n"); + exit(2); + } + + if(firstarg[0] >= '0' && firstarg[0] <= '9') { + *idx = strtoul(firstarg, NULL, 10); + return; + } + + for(i = 0; colnames[i].name; i++) + if(strcasecmp(colnames[i].name, firstarg) == 0) { + *idx = colnames[i].idx; + return; + } + fprintf(stderr, "arg ``%s'' in -p option not recognized\n", + firstarg); + exit(2); +} diff --git a/usr.sbin/pcvt/set2061/CAUTION b/usr.sbin/pcvt/set2061/CAUTION new file mode 100644 index 0000000..e1eba06 --- /dev/null +++ b/usr.sbin/pcvt/set2061/CAUTION @@ -0,0 +1,28 @@ +CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION +CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION +CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION + + THE USE OF THIS PROGRAM MAY DESTROY YOUR MONITOR !!! + ==================================================== + + IF YOU DON'T KNOW WHAT YOU ARE DOING, STAY AWAY FROM IT !!! + =========================================================== + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION +CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION +CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION + diff --git a/usr.sbin/pcvt/set2061/ICD2061Aalt.c b/usr.sbin/pcvt/set2061/ICD2061Aalt.c new file mode 100644 index 0000000..a74ec4e --- /dev/null +++ b/usr.sbin/pcvt/set2061/ICD2061Aalt.c @@ -0,0 +1,297 @@ +/* + * This code is derived from code available from the STB bulletin board + */ + +/* $XFree86: mit/server/ddx/x386/common_hw/ICD2061Aalt.c,v 2.6 1994/04/15 05:10:30 dawes Exp $ */ + +#ifndef KERNEL +#include "compiler.h" +#else +#define GCCUSESGAS +#define PCVT_STANDALONE 1 +#endif + +#define SEQREG 0x03C4 +#define MISCREG 0x03C2 +#define MISCREAD 0x03CC + +double fref = 14.31818 * 2.0; +char ascclk[] = "VIDEO CLOCK ?"; + +unsigned short clknum; +unsigned short vlbus_flag; +unsigned short card; +unsigned short crtcaddr; +unsigned short clockreg; + +static double range[15] = {50.0, 51.0, 53.2, 58.5, 60.7, 64.4, 66.8, 73.5, + 75.6, 80.9, 83.2, 91.5, 100.0, 120.0, 120.0}; + +#ifdef __STDC__ +static double genratio(unsigned int *p, unsigned int *q, double tgt); +static double f(unsigned int p, unsigned int q, double basefreq); +#if 0 +static void prtbinary(unsigned int size, unsigned int val); +#endif +static void wait_vb(); +static void wrt_clk_bit(unsigned int value); +static void init_clock(unsigned long setup, unsigned short crtcport); +#else +static double genratio(); +static double f(); +#if 0 +static void prtbinary(); +#endif +static void wait_vb(); +static void wrt_clk_bit(); +static void init_clock(); +#endif + +void AltICD2061SetClock(frequency, select) +register long frequency; /* in Hz */ +int select; +{ + unsigned int m, mval, ival; + int i; + long dwv; + double realval; + double freq, fvco; + double dev, devx; + double delta, deltax; + unsigned int p, q; + unsigned int bestp, bestq; + unsigned char tmp; + + crtcaddr=(inb(0x3CC) & 0x01) ? 0x3D4 : 0x3B4; + + + outb(crtcaddr, 0x11); /* Unlock CRTC registers */ + tmp = inb(crtcaddr + 1); + outb(crtcaddr + 1, tmp & ~0x80); + + outw(crtcaddr, 0x4838); /* Unlock S3 register set */ + outw(crtcaddr, 0xA039); + + clknum = select; + + freq = ((double)frequency)/1000000.0; + if (freq > range[14]) + freq =range[14]; + else if (freq <= 6.99) + freq = 7.0; + +/* + * Calculate values to load into ICD 2061A clock chip to set frequency + */ + delta = 999.0; + dev = 999.0; + ival = 99; + mval = 99; + + fvco = freq / 2; + for (m = 0; m < 8; m++) { + fvco *= 2.0; + for (i = 14; i >= 0; i--) + if (fvco >= range[i]) + break; + if (i < 0) + continue; + if (i == 14) + break; + devx = (fvco - (range[i] + range[i+1])/2)/fvco; + if (devx < 0) + devx = -devx; + deltax = genratio(&p, &q, fvco); + if (delta < deltax) + continue; + if (deltax < delta || devx < dev) { + bestp = p; + bestq = q; + delta = deltax; + dev = devx; + ival = i; + mval = m; + } + } + fvco = fref; + for (m=0; m 128) + mmax = 128; + while (m < mmax) { + test = f(m, k, fref) - tgt; + if (test < 0) test = -test; + if (mindiff > test) { + mindiff = test; + *p = m; + *q = k; + } + m++; + } + } + return (mindiff); + } + +#if 0 +static void prtbinary(size, val) + unsigned int size; + unsigned int val; + { + unsigned int mask; + int k; + + mask = 1; + + for (k=size; --k > 0 || mask <= val/2;) + mask <<= 1; + + while (mask) { + fputc((mask&val)? '1': '0' , stderr); + mask >>= 1; + } + } +#endif + +static void wait_vb() + { + while ((inb(crtcaddr+6) & 0x08) == 0) + ; + while (inb(crtcaddr+6) & 0x08) + ; + } + + +#ifdef __STDC__ +static void init_clock(unsigned long setup, unsigned short crtcport) +#else +static void init_clock(setup, crtcport) + unsigned long setup; + unsigned short crtcport; +#endif + { + unsigned char nclk[2], clk[2]; + unsigned short restore42; + unsigned short oldclk; + unsigned short bitval; + int i; + unsigned char c; + +#ifndef PCVT_STANDALONE + (void)xf86DisableInterrupts(); +#endif + + oldclk = inb(0x3CC); + + outb(crtcport, 0x42); + restore42 = inb(crtcport+1); + + outw(0x3C4, 0x0100); + + outb(0x3C4, 1); + c = inb(0x3C5); + outb(0x3C5, 0x20 | c); + + outb(crtcport, 0x42); + outb(crtcport+1, 0x03); + + outw(0x3C4, 0x0300); + + nclk[0] = oldclk & 0xF3; + nclk[1] = nclk[0] | 0x08; + clk[0] = nclk[0] | 0x04; + clk[1] = nclk[0] | 0x0C; + + outb(crtcport, 0x42); + i = inw(crtcport); + + outw(0x3C4, 0x0100); + + wrt_clk_bit(oldclk | 0x08); + wrt_clk_bit(oldclk | 0x0C); + for (i=0; i<5; i++) { + wrt_clk_bit(nclk[1]); + wrt_clk_bit(clk[1]); + } + wrt_clk_bit(nclk[1]); + wrt_clk_bit(nclk[0]); + wrt_clk_bit(clk[0]); + wrt_clk_bit(nclk[0]); + wrt_clk_bit(clk[0]); + for (i=0; i<24; i++) { + bitval = setup & 0x01; + setup >>= 1; + wrt_clk_bit(clk[1-bitval]); + wrt_clk_bit(nclk[1-bitval]); + wrt_clk_bit(nclk[bitval]); + wrt_clk_bit(clk[bitval]); + } + wrt_clk_bit(clk[1]); + wrt_clk_bit(nclk[1]); + wrt_clk_bit(clk[1]); + + outb(0x3C4, 1); + c = inb(0x3C5); + outb(0x3C5, 0xDF & c); + + outb(crtcport, 0x42); + outb(crtcport+1, restore42); + + outb(0x3C2, oldclk); + + outw(0x3C4, 0x0300); + +#ifndef PCVT_STANDALONE + xf86EnableInterrupts(); +#endif + + } + +static void wrt_clk_bit(value) + unsigned int value; + { + int j; + + outb(0x3C2, value); + for (j=2; --j; ) + inb(0x200); + } diff --git a/usr.sbin/pcvt/set2061/Makefile b/usr.sbin/pcvt/set2061/Makefile new file mode 100644 index 0000000..38cc44d --- /dev/null +++ b/usr.sbin/pcvt/set2061/Makefile @@ -0,0 +1,13 @@ +PROG= set2061 +SRCS= main.c ICD2061Aalt.c +CFLAGS+= -DGCCUSESGAS -DPCVT_STANDALONE +NOMAN= + +all: $(PROG) + +install: + @${ECHO} "set2061 is not installed automatically ...." + +.include + +$(PROG): compiler.h diff --git a/usr.sbin/pcvt/set2061/README b/usr.sbin/pcvt/set2061/README new file mode 100644 index 0000000..76109f9 --- /dev/null +++ b/usr.sbin/pcvt/set2061/README @@ -0,0 +1,22 @@ +CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION + + THE USE OF THIS PROGRAM MAY DESTROY YOUR MONITOR !!! + ==================================================== + + IF YOU DON'T KNOW WHAT YOU ARE DOING, STAY AWAY FROM IT !!! + =========================================================== + +Read the file "CAUTION" before proceeding !!! + +The files: + + ICD2061Aalt.c and + compiler.h + +come from the Xfree86 2.1 distribution and have been slightly modified to +fit in a non-XFree environment. + +I use it to program the clock generator ICD2061a on my S3 928 based ELSA +Winner VGA board to 40MHz for clock generator #2: set2061 -n2 -f40000000. + +This enables me to use 132 columns mode on this VGA board. diff --git a/usr.sbin/pcvt/set2061/compiler.h b/usr.sbin/pcvt/set2061/compiler.h new file mode 100644 index 0000000..4ff14bd --- /dev/null +++ b/usr.sbin/pcvt/set2061/compiler.h @@ -0,0 +1,341 @@ +/* $XFree86: mit/server/ddx/x386/common/compiler.h,v 2.3 1993/10/03 14:55:28 dawes Exp $ */ +/* + * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Thomas Roell not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Thomas Roell makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * $Header: /home/ncvs/src/usr.sbin/pcvt/set2061/Attic/compiler.h,v 1.2 1995/05/30 03:49:45 rgrimes Exp $ + */ + + +#ifndef _COMPILER_H +#define _COMPILER_H + +#ifndef __STDC__ +# ifdef signed +# undef signed +# endif +# ifdef volatile +# undef volatile +# endif +# ifdef const +# undef const +# endif +# define signed /**/ +# ifdef __GNUC__ +# define volatile __volatile__ +# define const __const__ +# else +# define const /**/ +# endif /* __GNUC__ */ +#endif /* !__STDC__ */ + +#ifdef NO_INLINE + +extern void outb(); +extern void outw(); +extern unsigned int inb(); +extern unsigned int inw(); +#if NeedFunctionPrototypes +extern unsigned char rdinx(unsigned short, unsigned char); +extern void wrinx(unsigned short, unsigned char, unsigned char); +extern void modinx(unsigned short, unsigned char, unsigned char, unsigned char); +extern int testrg(unsigned short, unsigned char); +extern int textinx2(unsigned short, unsigned char, unsigned char); +extern int textinx(unsigned short, unsigned char); +#else /* NeedFunctionProtoypes */ +extern unsigned char rdinx(); +extern void wrinx(); +extern void modinx(); +extern int testrg(); +extern int textinx2(); +extern int textinx(); +#endif /* NeedFunctionProtoypes */ + +#else /* NO_INLINE */ + +#ifdef __GNUC__ + +#ifndef FAKEIT +#ifdef GCCUSESGAS + +/* + * If gcc uses gas rather than the native assembler, the syntax of these + * inlines has to be different. DHD + */ + +static __inline__ void +outb(port, val) +short port; +char val; +{ + __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port)); +} + + +static __inline__ void +outw(port, val) +short port; +short val; +{ + __asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port)); +} + +static __inline__ unsigned int +inb(port) +short port; +{ + unsigned char ret; + __asm__ __volatile__("inb %1,%0" : + "=a" (ret) : + "d" (port)); + return ret; +} + +static __inline__ unsigned int +inw(port) +short port; +{ + unsigned short ret; + __asm__ __volatile__("inw %1,%0" : + "=a" (ret) : + "d" (port)); + return ret; +} + +#else /* GCCUSESGAS */ + +static __inline__ void +outb(port, val) + short port; + char val; +{ + __asm__ __volatile__("out%B0 (%1)" : :"a" (val), "d" (port)); +} + +static __inline__ void +outw(port, val) + short port; + short val; +{ + __asm__ __volatile__("out%W0 (%1)" : :"a" (val), "d" (port)); +} + +static __inline__ unsigned int +inb(port) + short port; +{ + unsigned char ret; + __asm__ __volatile__("in%B0 (%1)" : + "=a" (ret) : + "d" (port)); + return ret; +} + +static __inline__ unsigned int +inw(port) + short port; +{ + unsigned short ret; + __asm__ __volatile__("in%W0 (%1)" : + "=a" (ret) : + "d" (port)); + return ret; +} + +#endif /* GCCUSESGAS */ + +#else /* FAKEIT */ + +static __inline__ void +outb(port, val) + short port; + char val; +{ +} + +static __inline__ void +outw(port, val) + short port; + short val; +{ +} + +static __inline__ unsigned int +inb(port) + short port; +{ + return 0; +} + +static __inline__ unsigned int +inw(port) + short port; +{ + return 0; +} + +#endif /* FAKEIT */ + +#else /* __GNUC__ */ +#if !defined(AMOEBA) && !defined(_MINIX) +# if defined(__STDC__) && (__STDC__ == 1) +# define asm __asm +# endif +# ifdef SVR4 +# include +# ifndef __USLC__ +# define __USLC__ +# endif +# endif +# include +#endif +#endif + +/* + *----------------------------------------------------------------------- + * Port manipulation convenience functions + *----------------------------------------------------------------------- + */ + +#ifndef __GNUC__ +#define __inline__ /**/ +#endif + +/* + * rdinx - read the indexed byte port 'port', index 'ind', and return its value + */ +static __inline__ unsigned char +#ifdef __STDC__ +rdinx(unsigned short port, unsigned char ind) +#else +rdinx(port, ind) +unsigned short port; +unsigned char ind; +#endif +{ + if (port == 0x3C0) /* reset attribute flip-flop */ + (void) inb(0x3DA); + outb(port, ind); + return(inb(port+1)); +} + +/* + * wrinx - write 'val' to port 'port', index 'ind' + */ +static __inline__ void +#ifdef __STDC__ +wrinx(unsigned short port, unsigned char ind, unsigned char val) +#else +wrinx(port, ind, val) +unsigned short port; +unsigned char ind, val; +#endif +{ + outb(port, ind); + outb(port+1, val); +} + +/* + * modinx - in register 'port', index 'ind', set the bits in 'mask' as in 'new'; + * the other bits are unchanged. + */ +static __inline__ void +#ifdef __STDC__ +modinx(unsigned short port, unsigned char ind, + unsigned char mask, unsigned char new) +#else +modinx(port, ind, mask, new) +unsigned short port; +unsigned char ind, mask, new; +#endif +{ + unsigned char tmp; + + tmp = (rdinx(port, ind) & ~mask) | (new & mask); + wrinx(port, ind, tmp); +} + +/* + * tstrg - returns true iff the bits in 'mask' of register 'port' are + * readable & writable. + */ + +static __inline__ int +#ifdef __STDC__ +testrg(unsigned short port, unsigned char mask) +#else +tstrg(port, mask) +unsigned short port; +unsigned char mask; +#endif +{ + unsigned char old, new1, new2; + + old = inb(port); + outb(port, old & ~mask); + new1 = inb(port) & mask; + outb(port, old | mask); + new2 = inb(port) & mask; + outb(port, old); + return((new1 == 0) && (new2 == mask)); +} + +/* + * testinx2 - returns true iff the bits in 'mask' of register 'port', index + * 'ind' are readable & writable. + */ +static __inline__ int +#ifdef __STDC__ +testinx2(unsigned short port, unsigned char ind, unsigned char mask) +#else +testinx2(port, ind, mask) +unsigned short port; +unsigned char ind, mask; +#endif +{ + unsigned char old, new1, new2; + + old = rdinx(port, ind); + wrinx(port, ind, old & ~mask); + new1 = rdinx(port, ind) & mask; + wrinx(port, ind, old | mask); + new2 = rdinx(port, ind) & mask; + wrinx(port, ind, old); + return((new1 == 0) && (new2 == mask)); +} + +/* + * testinx - returns true iff all bits of register 'port', index 'ind' are + * readable & writable. + */ +static __inline__ int +#ifdef __STDC__ +testinx(unsigned short port, unsigned char ind) +#else +testinx(port, ind, mask) +unsigned short port; +unsigned char ind; +#endif +{ + return(testinx2(port, ind, 0xFF)); +} + +#endif /* NO_INLINE */ +#endif /* _COMPILER_H */ diff --git a/usr.sbin/pcvt/set2061/main.c b/usr.sbin/pcvt/set2061/main.c new file mode 100644 index 0000000..49862fa --- /dev/null +++ b/usr.sbin/pcvt/set2061/main.c @@ -0,0 +1,112 @@ +/* + * Copyright (c) 1994 Hellmuth Michaelis + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by + * Hellmuth Michaelis + * 4. The name authors may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +static char *id = + "@(#)set2061.c, 1.00, Last Edit-Date: [Sun Jan 15 19:52:05 1995]"; + +/*---------------------------------------------------------------------------* + * + * history: + * + * -hm start using 132 columns on my Elsa Winner + * + *---------------------------------------------------------------------------*/ + +#include +#include +#include + +#define DEFAULTFD 0 + +void AltICD2061SetClock(long frequency, int select); + +main(argc,argv) +int argc; +char *argv[]; +{ + extern int optind; + extern int opterr; + extern char *optarg; + + int fd; + int c; + long freq = -1; + int no = -1; + + while( (c = getopt(argc, argv, "f:n:")) != -1) + { + switch(c) + { + case 'f': + freq = atoi(optarg); + break; + + case 'n': + no = atoi(optarg); + break; + + case '?': + default: + usage(); + break; + } + } + + if(freq == -1 || no == -1) + usage(); + + if((fd = open("/dev/console", O_RDONLY)) < 0) + fd = DEFAULTFD; + + if(ioctl(fd, KDENABIO, 0) < 0) + { + perror("ioctl(KDENABIO)"); + return 1; + } + + AltICD2061SetClock(freq, no); + + (void)ioctl(fd, KDDISABIO, 0); + + exit(0); +} + +usage() +{ + fprintf(stderr,"\nset2061 - program the ICD2061 video clock chip\n"); + fprintf(stderr,"usage: set2061 -f -n \n"); + fprintf(stderr," -f frequency in Hz\n"); + fprintf(stderr," -n clock generator number\n"); + exit(1); +} + diff --git a/usr.sbin/pcvt/userkeys/Makefile b/usr.sbin/pcvt/userkeys/Makefile new file mode 100644 index 0000000..2e7452f --- /dev/null +++ b/usr.sbin/pcvt/userkeys/Makefile @@ -0,0 +1,3 @@ +PROG= vt220keys + +.include diff --git a/usr.sbin/pcvt/userkeys/vt220keys.1 b/usr.sbin/pcvt/userkeys/vt220keys.1 new file mode 100644 index 0000000..215d2f8 --- /dev/null +++ b/usr.sbin/pcvt/userkeys/vt220keys.1 @@ -0,0 +1,131 @@ +.TH VT220KEYS 1 +.UC 4 +.SH NAME +vt220keys \- define SHIFTED function keys on VT220 terminal +.SH SYNTAX +.B vt220keys +[ +.B \-cil +] +[ keyname keystring ] ... +.SH DESCRIPTION +.I Vt220keys +sets up a "vt220 terminal" in vt200 mode to allow user +definition of the SHIFTED function keys. Each +\f2keyname\f1 specified on the command line will be loaded with +the corresponding \f2keystring\f1. +A \f2keyname\f1 is one of the following "words": +F6 F7 F8 F9 F10 F11 ESC F12 BS F13 LF F14 HELP DO F17 F18 F19 F20. +\f2Keystrings\f1 +must be quoted if spaces, tabs, or shell metacharacters are included. +.PP +.B Vt220keys +expects to receive some combination of option flags and/or +argument pair(s), otherwise a usage message +is printed. +.PP +The options are: +.TP +.B \-c +Clears all SHIFTED function key definitions before setting them to user +defined strings. +.TP +.B \-i +Read the initialization file +.I $HOME/.vt220rc +for SHIFTED function key definitions. This is done before any +argument pair specified on the command line is processed. +Each line in the file must consist of two fields (separated by spaces +or tabs) where the first field is the +\f2keyname\f1 and the second field is the \f2keystring\f1. +The second field extends to the end of the line, thus a +\f2keystring\f1 +may include spaces or tabs. A newline (return) may be specified +within the string by using the C Language notation for newline (\\n). +.TP +.B \-l +Locks the function keys from further definition. +Locking occurs after processing the initialization file (if the "i" +option is specified) and any argument +pairs. +The only way +to unlock is by turning the power off. +.SH EXAMPLES +vt220keys -ci +.br +vt220keys F6 'nroff -ms ' +.br +vt220keys -i F20 'cc -O -c ' +.br +vt220keys -l HELP man +.SH "OTHER FEATURES" +Pressing the function keys without using the shift key, generates +a string of characters. With +\f2csh\f1(1) this string can be aliased to some command. For example: +.br + alias ^[[17~ "ls -CR | more" +.br +where ^[[17~ is what is generated by pressing the F6 key. Therefore +F6 can perform two commands, depending if pressed with/without the SHIFT +key. +.PP +.B Vt220keys +can be called from your .login or .profile file. Typically an user +will create a initialization file and include a line like +.br + vt220keys -ci +.br +OR +.br + vt220keys -cil +.br +in the above mentioned files. This way the SHIFTED function keys +will be set to your favorite commands when logging in. +.SH CAVEATS +If the SHIFTED function keys are unlocked, redefinition of a SHIFTED +function key will rewrite the old string. +.PP +There are 256 bytes available for the SHIFTED function keys. Space is +supplied on a first-come/first-serve basis. After the 256 bytes are +used, you can't define any more keys unless space is cleared. This +can be done by redefining a key to contain a string of fewer bytes. +.PP +All key definitions are stored in volatile RAM, and are lost when +terminal power is lost. +.PP +The ESC key (unshifted) no longer generates the proper escape character. This +is of particular importance since many editors require use of the +ESC key. Here are some available alternatives: +.sp +.in +.5i +The escape character can be generated by typing ^[ (control-[). +.sp +Use +.B vt220keys +as follows (note ^[ is control-[) +.br +.in +.5i +vt220keys ESC '^[' +.in +.br +This will require you +to press the SHIFT key and ESC to generate the escape sequence. +.sp +Some editors, allow other character(s) to be substituted for the +escape character. For example with +.B emacs +include this line in your .emacs_pro: +.br + (bind-to-key "ESC-prefix" "\\033[23~") +.br +Thus when the ESC key is pressed, emacs will allow the characters +generated (^[[23~) to perform the same function as the escape +character. +.in +.SH FILES +$HOME/.vt220rc \- initialization file +.SH "SEE ALSO" +VT220 Programmer Reference Manual +.br +VT220 Programmer Pocket Guide + diff --git a/usr.sbin/pcvt/userkeys/vt220keys.c b/usr.sbin/pcvt/userkeys/vt220keys.c new file mode 100644 index 0000000..55664c5 --- /dev/null +++ b/usr.sbin/pcvt/userkeys/vt220keys.c @@ -0,0 +1,297 @@ +/* + * Trivial program to load VT220 Function keys with strings, + * note that the values only get sent when the key is shifted + * (shoulda been an option to flip the shift set like the Z19!) + * + * Typing no args gives help, basically pairs of keyname/value + * strings. + * + * Author, Author: Barry Shein, Boston University + * + * HISTORY + {1} 30-Oct-85 Kenneth J. Lester (ken) at ektools + + Added the necessary code to read an initialization file. This + should make it easier to used this program. Also added code + that will set-up the terminal in vt200 (this saves the user the + trouble of checking if the set-up is in vt200). + + Restructed the main function to use getopt, for argument + processing. + + Alterated usage function to include new "i" option (init file) + + + -hm minor modifications for pcvt 2.0 release + +*/ + +#include +#include + +/* + * The default toupper() macro is stupid, will toupper anything + */ + +#ifdef toupper +#undef toupper +#endif +#define toupper(c) (islower(c) ? ((c)-' ') : c) + +#define VT200_7BIT 1 +#define ESC 033 +#define INITFILE ".vt220rc" + +struct keynames { + char *name ; + char *string ; +} keys[] = { + "F6", "17", + "F7", "18", + "F8", "19", + "F9", "20", + "F10", "21", + "F11", "23", + "ESC", "23", + "F12", "24", + "BS", "24", + "F13", "25", + "LF", "25", + "F14", "26", + "HELP", "28", + "DO", "29", + "F17", "31", + "F18", "32", + "F19", "33", + "F20", "34", + NULL, NULL +}; + +char prog[BUFSIZ]; + +main(argc,argv) + int argc; + char *argv[]; +{ + /* these are defined in the getopt routine */ + extern char *optarg; /* argument give to an option */ + extern int optind; /* argv index after option processing */ + + int option; /* option character returned by getopt */ + int initf = 0; /* read initialization file */ + int lockf = 0; /* lock keys after loading strings */ + int clearf = 0; /* clear all keys before loading strings */ + char *strcpy(); + + (void) strcpy(prog, *argv); /* store program name */ + + if(argc == 1) usage(); /* program requires options */ + + /* get options */ + while ((option = getopt(argc, argv, "cli")) != -1) + switch(option) + { + case 'c' : + clearf++; + break; + case 'l' : + lockf++; + break; + case 'i' : + initf++; + break; + case '?' : + usage(); + } + + if (VT200_7BIT) + printf("\033[62;1\"p"); /* vt200 7 bits */ + else + printf("\033[62;2\"p"); /* vt200 8 bits */ + + if(clearf) clearkeys(); + + if (initf) getinit(); + + /* process {key, key string} pairs. Note optind is index to argv + for first pair. By adding 1 to optind insures that a pair exists + i.e. the last key has a key string. */ + + while(optind + 1 < argc) + { + dokey(argv[optind], argv[optind+1]); + optind += 2; + } + + if(lockf) lockkeys(); + + exit(0); +} + +/****************************************************************************/ + +/* + * Load the VT220 SHIFT-FNKEY value, the basic pattern is + * "\EP1;1|"+KEYNAME+"/"+VAL_AS_HEX+"\E\\" + * that is, literally what is in quotes (w/o quotes) then the + * name of the key from the keytable above (a numeric string) + * then a slash, then the string value as hex pairs then ESC-BACKSLASH + * + * Note: you can gang together key defns with semicolons but that + * would complicate things, especially error handling, so do it all + * for each pair, who cares, really. + */ + +dokey(nm,val) char *nm, *val; +{ + register char *scr; + register struct keynames *kp; + + for(scr = nm; *scr = toupper(*scr); scr++) + ; + for(kp = keys; kp->name != NULL; kp++) + if(strcmp(nm,kp->name) == 0) { + printf("%cP1;1|%s/",ESC,kp->string); + while(*val) printf("%02x",*val++); + printf("%c\\",ESC); + fflush(stdout); + return; + } + fprintf(stderr,"Bad key name: %s\n",nm); + usage(); /* bad key name, give up */ +} + +/****************************************************************************/ + +clearkeys() +{ + printf("%cP0;1|%c\\",ESC,ESC); + fflush(stdout); +} + +/****************************************************************************/ + +lockkeys() +{ + printf("%cP1;0|%c\\",ESC,ESC); + fflush(stdout); +} + +/****************************************************************************/ + +usage() +{ + int i; + + fprintf(stderr,"Usage: %s [-cil] [keyname string keyname string...]\n\n",prog); + fprintf(stderr,"The following options are available\n"); + fprintf(stderr,"\t-c\tclears keys first\n"); + fprintf(stderr,"\t-l\t[sets then] locks further setting\n"); + fprintf(stderr,"\t-i\tfirst read initialization file $HOME/%s\n",INITFILE); + fprintf(stderr,"(note that the only way to unlock is via Set-Up)\n\n"); + fprintf(stderr,"Keyname is one of:\n\t"); + for(i=0; keys[i].name != NULL; i++) + fprintf(stderr,"%s ",keys[i].name); + fprintf(stderr,"\nKeyname is SHIFTED function key that sends the string\n\n"); + fprintf(stderr,"Strings may need quoting to protect from shell\n"); + fprintf(stderr,"You must specify an option or key,string pairs\n\n"); + exit(1); +} + +/****************************************************************************/ + +/* This routine process the INITFILE. This file expects lines in the format + + keyname ws string + + Where ws is white space (spaces or tabs) and is optional white space. + The string may include spaces or tabs and need not be quoted. If the + string has the sequence of "\n" then a newline character is included in + the string. + + examples: + + F6 ls -lg\n + F7 uulog -s + +*/ + +#include +#include + +getinit() +{ + char *home; /* user's home directory */ + char path[BUFSIZ]; /* full path name of init file */ + char buf[BUFSIZ]; /* buffer to hold 1 line from init file */ + char key[BUFSIZ]; /* buffer, to hold specified fcn key */ + char keystr[BUFSIZ]; /* string associated with fcn key */ + char *ptr; /* pointer to transverse buf */ + int i, j; /* array indices */ + int statflag; /* whether init file is regular & readable */ + struct stat statbuf; /* stat of the init file */ + FILE *fp; /* file pointer to init file */ + + /* system calls and subroutines */ + FILE *fopen(); + char *strcpy(); + char *strcat(); + char *fgets(); + char *getenv(); + + /* construct full path name for init file */ + home = getenv("HOME"); + (void) strcpy(path, home); + (void) strcat(path,"/"); + (void) strcat(path,INITFILE); + + /* check status if init file */ + if (stat(path, &statbuf) != -1) + { + statflag = statbuf.st_mode & S_IFREG && statbuf.st_mode & S_IREAD; + if (!statflag || (fp = fopen(path, "r")) == NULL) + { + fprintf(stderr, "couldn't open initalization file: %s\n", path); + exit(1); + } + + /* process lines from init file */ + while (fgets(buf, BUFSIZ, fp) != NULL) + { + /* variable initializations */ + i = 0; j = 0; + key[0] = '\0'; keystr[0] = '\0'; + ptr = buf; + + while (*ptr == ' ' || *ptr == '\t') ptr++; /*skip whitespace*/ + + if (*ptr == '\n') break; /* we hit an emtpy line */ + + while (!isspace(*ptr) && *ptr != '\0') /* get keyname */ + key[i++] = *ptr++; + key[i] = '\0'; /* place EOS in buffer */ + + while (*ptr == ' ' || *ptr == '\t') ptr++; /*skip whitespace*/ + + while (*ptr != '\n' && *ptr != '\0') /* get string */ + { + /* check if string is to include newline i.e. \n */ + if (*ptr == '\\' && *(ptr+1) == 'n') + { + keystr[j] = '\012'; + ptr++; + } + else + keystr[j] = *ptr; + j++; ptr++; + } + keystr[j] = '\0'; /* place EOS in buffer */ + dokey(key, keystr); /* load key with string */ + } + } + else + { + fprintf(stderr, "init file %s not found\n\n", path); + usage(); + } +} diff --git a/usr.sbin/pcvt/vgaio/CAUTION b/usr.sbin/pcvt/vgaio/CAUTION new file mode 100644 index 0000000..e1eba06 --- /dev/null +++ b/usr.sbin/pcvt/vgaio/CAUTION @@ -0,0 +1,28 @@ +CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION +CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION +CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION + + THE USE OF THIS PROGRAM MAY DESTROY YOUR MONITOR !!! + ==================================================== + + IF YOU DON'T KNOW WHAT YOU ARE DOING, STAY AWAY FROM IT !!! + =========================================================== + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION +CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION +CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION + diff --git a/usr.sbin/pcvt/vgaio/Makefile b/usr.sbin/pcvt/vgaio/Makefile new file mode 100644 index 0000000..9edd896 --- /dev/null +++ b/usr.sbin/pcvt/vgaio/Makefile @@ -0,0 +1,38 @@ +# $Id: Makefile,v 1.9 1998/05/06 15:23:53 bde Exp $ + +.if !exists(${.CURDIR}/../Makefile.inc) +error: + @echo + @echo " You MUST link/copy" + @echo + @echo " ../Makefile.inc.NetBSD or ../Makefile.inc.FreeBSD" + @echo + @echo " to ../Makefile.inc before you can proceed !" + @echo +.else + +PROG= vgaio +MAN8= vgaio.${MAN8EXT} + +SRCS= vgaio.y lex.l y.tab.h +YACC= yacc + +#YFLAGS+= -yd # Bison +#YFLAGS+= -v # verbose + +LFLAGS+= -I + +DPADD= ${LIBM} ${LIBY} ${LIBL} +LDADD= -lm -ly -ll + +CFLAGS= -O2 # due to a gcc bug, it compiles only with -O2! +CFLAGS+= -I${.OBJDIR} -I${.CURDIR} + +CLEANFILES+= y.output # comment file from bison + +install: + @${ECHO} "vgaio is not installed automatically ...." + +.include + +.endif diff --git a/usr.sbin/pcvt/vgaio/lex.l b/usr.sbin/pcvt/vgaio/lex.l new file mode 100644 index 0000000..7fb6ef2 --- /dev/null +++ b/usr.sbin/pcvt/vgaio/lex.l @@ -0,0 +1,86 @@ +%{ +/* + * Copyright (c) 1994 Joerg Wunsch + * + * All rights reserved. + * + * This program is free software. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Joerg Wunsch + * 4. The name of the developer may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ident "$Header: /home/ncvs/src/usr.sbin/pcvt/vgaio/Attic/lex.l,v 1.1.1.1 1995/02/05 13:49:23 jkh Exp $" + +/* + * $Log: lex.l,v $ + * Revision 1.1.1.1 1995/02/05 13:49:23 jkh + * PCVT userland utilities. + * Submitted by: hm + * + * Revision 1.1 1994/03/29 02:47:20 mycroft + * pcvt 3.0, with some performance enhancements by Joerg Wunsch and me. + * + * Revision 1.2 1994/01/08 17:42:58 j + * cleanup + * made multiple commands per line work + * wrote man page + * + * Revision 1.3 21.12.1994 -hm + * Added mi command for accessing the misc out register + */ + +#include +#include + +#include "vgaio.h" +#include "y.tab.h" + +extern YYSTYPE yylval; + +%} + +D [0-9a-fA-F] + +%% + +cr|CR { return CR; } + +ar|AR { return AR; } + +gr|GR { return GR; } + +sr|SR { return SR; } + +mi|MI { return MI; } + +{D}({D}*) { sscanf(yytext, "%x", &yylval.num); return NUM; } + +[ \t] { /* ignore */ } + +\n { return NEWLINE; } + +. { return yytext[0]; } diff --git a/usr.sbin/pcvt/vgaio/vgaio.8 b/usr.sbin/pcvt/vgaio/vgaio.8 new file mode 100644 index 0000000..a7a4c0f --- /dev/null +++ b/usr.sbin/pcvt/vgaio/vgaio.8 @@ -0,0 +1,143 @@ +.\" +.\" Copyright (c) 1994 Joerg Wunsch +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by Joerg Wunsch +.\" 4. The name of the developer may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $Id: vgaio.8,v 1.2 1998/03/23 08:26:31 charnier Exp $ +.\" -hm updated 31.12.94 +.\" +.Dd December 31, 1994 +.Dt VGAIO 8 +.Sh NAME +.Nm vgaio +.Nd perform input/output on a Video Graphics Array +.Sh SYNOPSIS +.Nm vgaio +.Op Fl d +.Sh DESCRIPTION +.Ss Purpose +.Nm Vgaio +is used to perform register-level input/output on a Video Graphics Array. +Since some of the sequences required to access those registers are very +silly, +.Nm vgaio +cares of all the things necessary and allows the user to access the +registers of several register groups with their symbolic names. + +.Ss Options +.Bl -tag -width 10n -offset indent +.It Fl d +Turn on the grammar parser debugger. + +.El +.Ss Command language +The command language of +.Nm +constitutes of some very simple tokens and rules. Commands are executed +line by line as they are entered. Each line may contain any number of +semicolon-separated input/output commands. + +Symbolic register names look like: + +.D1 Ao Em reggroup Ac Ao Em regnumber Ac + +with +.Aq Em regnumber +being any hexadecimal number +.Pq without a leading Em 0x , +and +.Aq Em reggroup +one of the strings +.Dq Em ar , +.Dq Em cr , +.Dq Em gr , +.Dq Em mi , +or +.Dq Em sr , +standing for the +.Em Attribute controller , +.Em CRT controller , +.Em Graphics controller , +.Em Miscellaneous Output Register , +or +.Em Timing sequencer , +respectively. + +An input instruction has the form + +.D1 Ao Em regname Ac ? + +and will cause +.Nm +to output a line like + +.Bd -ragged -offset indent +.Ao Em regname Ac \& = 0x Ns +.Aq Em number +.Ed + +An output instruction looks like + +.Bd -ragged -offset indent +.Ao Em regname Ac = +.Aq Em number +.Ed + +Spaces or Tabs between the +.Aq Em reggroup , +the +.Aq Em regnumber , +or any of the other tokens are ignored. They are not required anyway. + +The +.Dq Em mi +needs a single unused argument to satisfy the syntax :-) (-hm). + + +.Ss Access control +The caller must have uid 0 in order to gain the required access to +the IO registers. + +.Sh HISTORY +This program is considered +.Dq hackware . +It has been developed in order to simplify the process of developing other +software that needs to program the Video Graphics Array. + +Remember, to use this program, your kernel has to be compiled with XSERVER +being defined ! + +.Sh AUTHORS +The program has been contributed by +.if n Joerg Wunsch, +.if t J\(:org Wunsch, +Dresden +.Aq joerg_wunsch@uriah.sax.de . diff --git a/usr.sbin/pcvt/vgaio/vgaio.h b/usr.sbin/pcvt/vgaio/vgaio.h new file mode 100644 index 0000000..61b9064 --- /dev/null +++ b/usr.sbin/pcvt/vgaio/vgaio.h @@ -0,0 +1,63 @@ +/* + * Copyright (c) 1994 Joerg Wunsch + * + * All rights reserved. + * + * This program is free software. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Joerg Wunsch + * 4. The name of the developer may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * $Header + * The author may be reached unter + * + * $Log: vgaio.h,v $ + * Revision 1.2 1995/03/05 22:46:27 joerg + * Upgrade to beta 3.20/b22 + * + * Revision 1.1 1994/03/29 02:47:25 mycroft + * pcvt 3.0, with some performance enhancements by Joerg Wunsch and me. + * + * Revision 1.2 1994/01/08 17:42:58 j + * cleanup + * made multiple commands per line work + * wrote man page + * + * + */ + +/* common structure to hold the definition for a VGA register */ + +#ifndef VGAIO_H +#define VGAIO_H + +struct reg { + int group, num; +}; + +#endif /* VGAIO_H */ diff --git a/usr.sbin/pcvt/vgaio/vgaio.y b/usr.sbin/pcvt/vgaio/vgaio.y new file mode 100644 index 0000000..ec169d8 --- /dev/null +++ b/usr.sbin/pcvt/vgaio/vgaio.y @@ -0,0 +1,255 @@ +%{ +/* + * Copyright (c) 1994 Joerg Wunsch + * + * All rights reserved. + * + * This program is free software. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Joerg Wunsch + * 4. The name of the developer may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ident "$Header: /home/ncvs/src/usr.sbin/pcvt/vgaio/Attic/vgaio.y,v 1.1.1.1 1995/02/05 13:49:24 jkh Exp $" + +/* + * $Log: vgaio.y,v $ + * Revision 1.1.1.1 1995/02/05 13:49:24 jkh + * PCVT userland utilities. + * Submitted by: hm + * + * Revision 1.1 1994/03/29 02:47:27 mycroft + * pcvt 3.0, with some performance enhancements by Joerg Wunsch and me. + * + * Revision 1.2 1994/01/08 17:42:58 j + * cleanup + * made multiple commands per line work + * wrote man page + * + * Revision 1.3 21.12.1994 -hm + * Added mi command for accessing the misc out register + * hex values shown as 2 fixed chars, added binary output + */ + +#include +#include +#include +#include +#include + +#ifdef __NetBSD__ +#include +#endif + +#include "vgaio.h" + +void setreg(struct reg r, int val); +void getreg(struct reg r); +void yyerror(const char *msg); + +#define YYDEBUG 1 + +unsigned short vgabase; + +%} + +%union { + int num; + struct reg reg; +} + +%token MI GR CR SR AR NEWLINE +%token NUM + +%type reggroup +%type register + +%% + +interpret: lines ; + +lines: line + | lines line + ; + +line: statements NEWLINE + | NEWLINE + | error NEWLINE { fprintf(stderr, "bing!\n"); } + ; + +statements: statement + | statements ';' statement + ; + +statement: register '?' { getreg($1); } + | register '=' NUM { setreg($1, $3); } + | /* lambda */ + ; + +register: reggroup NUM { $$.num = $2; $$.group = $1; } + ; + +reggroup: GR { $$ = GR; } + | CR { $$ = CR; } + | SR { $$ = SR; } + | AR { $$ = AR; } + | MI { $$ = MI; } + ; + +%% + +static struct { + int id; + const char *name; +} regnames[] = { + {GR, "gr"}, {CR, "cr"}, {SR, "sr"}, {AR, "ar"}, {MI, "mi"}, + {0, 0} +}; + +const char *getname(struct reg r) { + int idx; + for(idx = 0; regnames[idx].id; idx++) + if(regnames[idx].id == r.group) + return regnames[idx].name; + return "??"; +} + +/*---------------------------------------------------------------------------* + * return ptr to string of 1's and 0's for value + *---------------------------------------------------------------------------*/ +char * +bin_str(unsigned long val, int length) +{ + static char buffer[80]; + int i = 0; + + if (length > 32) + length = 32; + + val = val << (32 - length); + + while (length--) + { + if (val & 0x80000000) + buffer[i++] = '1'; + else + buffer[i++] = '0'; + if ((length % 4) == 0 && length) + buffer[i++] = '.'; + val = val << 1; + } + return (buffer); +} + +void getreg(struct reg r) { + int val; /* FreeBSD gcc ONLY accepts an int !! */ + + switch(r.group) { + case GR: + outb(0x3ce, r.num); + val = inb(0x3cf); + break; + + case AR: + r.num &= 0x1f; + (void)inb(vgabase + 0x0a); + outb(0x3c0, r.num + 0x20); + val = inb(0x3c1); + break; + + case CR: + outb(vgabase + 4, r.num); + val = inb(vgabase + 5); + break; + + case SR: + outb(0x3c4, r.num); + val = inb(0x3c5); + break; + + case MI: + val = inb(0x3cc); + break; + } + + printf("%s%02x = 0x%02x = %s (bin)\n", getname(r), r.num, val, bin_str(val,8)); +} + +void setreg(struct reg r, int val) { + switch(r.group) { + case GR: + outb(0x3ce, r.num); + outb(0x3cf, val); + break; + + case AR: + r.num &= 0x1f; + (void)inb(vgabase + 0x0a); + outb(0x3c0, r.num); + outb(0x3c0, val); + outb(0x3c0, r.num + 0x20); + break; + + case CR: + outb(vgabase + 4, r.num); + outb(vgabase + 5, val); + break; + + case SR: + outb(0x3c4, r.num); + outb(0x3c5, val); + break; + + case MI: + outb(0x3c2, val); + break; + } + + printf("%s%02x set to 0x%02x = %s (bin) now\n", getname(r), r.num, val, bin_str(val,8)); +} + +void yyerror(const char *msg) { + fprintf(stderr, "yyerror: %s\n", msg); +} + +int main(int argc, char **argv) { + int fd; + + if(argc > 1) yydebug = 1; + + if((fd = open("/dev/console", O_RDONLY)) < 0) + fd = 0; + + if(ioctl(fd, KDENABIO, 0) < 0) { + perror("ioctl(KDENABIO)"); + return 1; + } + vgabase = (inb(0x3cc) & 1)? 0x3d0: 0x3b0; + yyparse(); + + (void)ioctl(fd, KDDISABIO, 0); + return 0; +} diff --git a/usr.sbin/pcvt/vttest/Makefile b/usr.sbin/pcvt/vttest/Makefile new file mode 100644 index 0000000..3c6f089 --- /dev/null +++ b/usr.sbin/pcvt/vttest/Makefile @@ -0,0 +1,6 @@ + +PROG= vttest +CFLAGS+= -traditional -DUSEMYSTTY +SRCS= main.c esc.c + +.include diff --git a/usr.sbin/pcvt/vttest/README b/usr.sbin/pcvt/vttest/README new file mode 100644 index 0000000..589d08f --- /dev/null +++ b/usr.sbin/pcvt/vttest/README @@ -0,0 +1,57 @@ +NOTES FROM THE MOD.SOURCES MODERATOR: +I split the source up into the three separate pieces it now is. +In doing this, I put lines like "int reading;" in a header file +that both C modules include. If your Unix requires one of these +to be "extern int reading;" then you will have some editing to do. +Also note that this program uses FIONREAD, which must be implemented +differently in SystemV, etc., and check out the setjmp() call... + /Rich $alz +Oh, yeah: I also wrote the Makefile and manpage, such as they are. +------------------------------------------------------------------- + +This is a program to test the compatibility (or to demonstrate the +non-compatibility) of so-called "VT100-compatible" terminals. In +conformance of the good old hacker traditions, the only documentation +of this program is the source code itself. To understand it, you also +need a copy of the original VT100 manual from DEC. + +Comments and bug reports: Since this is a release (via USENET) to the +whole world, a lot of people are going to have opinions and fresh +ideas about it. (What -- bugs in MY program? Aww...) I can't deal +with everyone sending me a hacked version, but if you have found a +serious bug, or ported it to VMS, do tell me. I can't promise any new +version release, though. From this version on (1.7b) VTTEST will have +to live its own life without its father holding its hand. + +My adress is: + +Network-mail adress: (mcvax,seismo)!enea!suadb!lindberg + +Real-world-mail address: Per Lindberg + QZ, Stockholm University Computing Center + Box 27322 + S - 102 54 Stockholm + SWEDEN + +The original version of this program is written for the Sargasso C +compiler for the DECsystem-10. Many thanks to all sales persons with +quote VT100-compatible unquote terminals, who prompted me to write +this program, and also to: + +-- Bo Kleve, LIDAC, Linkoping University, Sweden + for the portation to DECSYSTEM-20 with the Sargasso C compiler + +-- Johan Widen, TTDS, Royal Institute of Technology, Stockholm, Sweden + for the portation to various UNIX systems (incl. System III and Xenix) + +-- Russ Herman, AES Data Inc., Missisauga, Ont. Canada + for fixes and code for the VT102 test + +Thanx also to JMR "Gremlin" at KTH, and Goran Wallberg at QZ +for suggestions, bug fixes, etc. + +This program does not have support for all the different variations +of VT100, like VT125, VT131 nor the new VT200 series. Feel free to +add that yourself. Happy Hacking! + + /TMP diff --git a/usr.sbin/pcvt/vttest/esc.c b/usr.sbin/pcvt/vttest/esc.c new file mode 100644 index 0000000..b2bce92 --- /dev/null +++ b/usr.sbin/pcvt/vttest/esc.c @@ -0,0 +1,398 @@ +#include "header.h" + +println(s) char *s; { + printf("%s\n", s); +} + +esc(s) char *s; { + printf("%c%s", 27, s); +} + +esc2(s1, s2) char s1, s2; { + printf("%c%s%s", 27, s1, s2); +} + +brcstr(ps, c) char *ps, c; { + printf("%c[%s%c", 27, ps, c); +} + +brc(pn,c) int pn; char c; { + printf("%c[%d%c", 27, pn, c); +} + +brc2(pn1, pn2 ,c) int pn1, pn2; char c; { + printf("%c[%d;%d%c", 27, pn1, pn2, c); +} + +cub(pn) int pn; { /* Cursor Backward */ + brc(pn,'D'); +} +cud(pn) int pn; { /* Cursor Down */ + brc(pn,'B'); +} +cuf(pn) int pn; { /* Cursor Forward */ + brc(pn,'C'); +} +cup(pn1, pn2) int pn1, pn2; { /* Cursor Position */ + brc2(pn1, pn2, 'H'); +} +cuu(pn) int pn; { /* Cursor Up */ + brc(pn,'A'); +} +da() { /* Device Attributes */ + brc(0,'c'); +} +decaln() { /* Screen Alignment Display */ + esc("#8"); +} +decdhl(lower) int lower; { /* Double Height Line (also double width) */ + if (lower) esc("#4"); + else esc("#3"); +} +decdwl() { /* Double Wide Line */ + esc("#6"); +} +deckpam() { /* Keypad Application Mode */ + esc("="); +} +deckpnm() { /* Keypad Numeric Mode */ + esc(">"); +} +decll(ps) char *ps; { /* Load LEDs */ + brcstr(ps, 'q'); +} +decrc() { /* Restore Cursor */ + esc("8"); +} +decreqtparm(pn) int pn; { /* Request Terminal Parameters */ + brc(pn,'x'); +} +decsc() { /* Save Cursor */ + esc("7"); +} +decstbm(pn1, pn2) int pn1, pn2; { /* Set Top and Bottom Margins */ + if (pn1 || pn2) brc2(pn1, pn2, 'r'); + else esc("[r"); + /* Good for >24-line terminals */ +} +decswl() { /* Single With Line */ + esc("#5"); +} +dectst(pn) int pn; { /* Invoke Confidence Test */ + brc2(2, pn, 'y'); +} +dsr(pn) int pn; { /* Device Status Report */ + brc(pn, 'n'); +} +ed(pn) int pn; { /* Erase in Display */ + brc(pn, 'J'); +} +el(pn) int pn; { /* Erase in Line */ + brc(pn,'K'); +} +hts() { /* Horizontal Tabulation Set */ + esc("H"); +} +hvp(pn1, pn2) int pn1, pn2; { /* Horizontal and Vertical Position */ + brc2(pn1, pn2, 'f'); +} +ind() { /* Index */ + esc("D"); +} +nel() { /* Next Line */ + esc("E"); +} +ri() { /* Reverse Index */ + esc("M"); +} +ris() { /* Reset to Initial State */ + esc("c"); +} +rm(ps) char *ps; { /* Reset Mode */ + brcstr(ps, 'l'); +} +scs(g,c) int g; char c; { /* Select character Set */ + printf("%c%c%c%c%c%c%c", 27, g ? ')' : '(', c, + 27, g ? '(' : ')', 'B', + g ? 14 : 15); +} +sgr(ps) char *ps; { /* Select Graphic Rendition */ + brcstr(ps, 'm'); +} +sm(ps) char *ps; { /* Set Mode */ + brcstr(ps, 'h'); +} +tbc(pn) int pn; { /* Tabulation Clear */ + brc(pn, 'g'); +} + +vt52cup(l,c) int l,c; { + printf("%cY%c%c", 27, l + 31, c + 31); +} + +char inchar() { + + /* + * Wait until a character is typed on the terminal + * then read it, without waiting for CR. + */ + +#ifdef UNIX + int lval, waittime, getpid(); static int val; char ch; + + fflush(stdout); + lval = val; + brkrd = 0; + reading = 1; + read(0,&ch,1); + reading = 0; + if (brkrd) + val = 0177; + else + val = ch; + if ((val==0177) && (val==lval)) + kill(getpid(), (int) SIGTERM); +#endif +#ifdef SARG10 + int val, waittime; + + waittime = 0; + while(!uuo(051,2,&val)) { /* TTCALL 2, (INCHRS) */ + zleep(100); /* Wait 0.1 seconds */ + if ((waittime += ttymode) > 600) /* Time-out, in case */ + return('\177'); /* of hung in ttybin(1) */ + } +#endif +#ifdef SARG20 /* try to fix a time-out function */ + int val, waittime; + + waittime = 0; + while(jsys(SIBE,2,_PRIIN) == 0) { /* Is input empty? */ + zleep(100); + if ((waittime += ttymode) > 600) + return('\177'); + } + ejsys(BIN,_PRIIN); + val = jsac[2]; +#endif + return(val); +} + +char *instr() { + + /* + * Get an unfinished string from the terminal: + * wait until a character is typed on the terminal, + * then read it, and all other available characters. + * Return a pointer to that string. + */ + + + int i, val, crflag; long l1; char ch; + static char result[80]; + + i = 0; + result[i++] = inchar(); +/* Wait 0.1 seconds (1 second in vanilla UNIX) */ +#ifdef SARG10 + if (trmop(01031,0) < 5) zleep(500); /* wait longer if low speed */ + else zleep(100); +#else + zleep(100); +#endif +#ifdef UNIX + fflush(stdout); +#ifdef XENIX + while(rdchk(0)) { + read(0,result+i,1); + if (i++ == 78) break; + } +#else +#ifdef SIII + while(read(2,result+i,1) == 1) + if (i++ == 78) break; +#else + while(ioctl(0,FIONREAD,&l1), l1 > 0L) { + while(l1-- > 0L) { + read(0,result+i,1); + if (i++ == 78) goto out1; + } + } +out1: +#endif +#endif +#endif +#ifdef SARG10 + while(uuo(051,2,&val)) { /* TTCALL 2, (INCHRS) */ + if (!(val == '\012' && crflag)) /* TOPS-10 adds LF to CR */ + result[i++] = val; + crflag = val == '\015'; + if (i == 79) break; + zleep(50); /* Wait 0.05 seconds */ + } +#endif +#ifdef SARG20 + while(jsys(SIBE,2,_PRIIN) != 0) { /* read input until buffer is empty */ + ejsys(BIN,_PRIIN); + result[i++] = jsac[2]; + if (i == 79) break; + zleep(50); /* Wait 0.05 seconds */ + } +#endif + result[i] = '\0'; + return(result); +} + +ttybin(bin) int bin; { +#ifdef SARG10 + #define OPEN 050 + #define IO_MOD 0000017 + #define _IOPIM 2 + #define _IOASC 0 + #define _TOPAG 01021 + #define _TOSET 01000 + + int v; + static int arglst[] = { + _IOPIM, + `TTY`, + 0 + }; + arglst[0] = bin ? _IOPIM : _IOASC; + v = uuo(OPEN, 1, &arglst[0]); + if (!v) { printf("OPEN failed"); exit(); } + trmop(_TOPAG + _TOSET, bin ? 0 : 1); + ttymode = bin; +#endif +#ifdef SARG20 + /* TTYBIN will set the line in BINARY/ASCII mode + * BINARY mode is needed to send control characters + * Bit 28 must be 0 (we don't flip it). + * Bit 29 is used for the mode change. + */ + + #define _TTASC 0000100 + #define _MOXOF 0000043 + + int v; + + ejsys(RFMOD,_CTTRM); + v = ejsys(SFMOD,_CTTRM, bin ? (~_TTASC & jsac[2]) : (_TTASC | jsac[2])); + if (v) { printf("SFMOD failed"); exit(); } + v = ejsys(MTOPR,_CTTRM,_MOXOF,0); + if (v) { printf("MTOPR failed"); exit(); } +#endif +} + +#ifdef SARG20 +/* + * SUPERBIN turns off/on all input character interrupts + * This affects ^C, ^O, ^T + * Beware where and how you use it !!!!!!! + */ + +superbin(bin) int bin; { + int v; + + v = ejsys(STIW,(0//-5), bin ? 0 : -1); + if (v) { printf("STIW superbinary setting failed"); exit(); } + ttymode = bin; +} + +/* + * PAGE affects the ^S/^Q handshake. + * Set bit 34 to turn it on. Clear it for off. + */ + +page(bin) int bin; { + int v; + + #define TT_PGM 0000002 + + ejsys(RFMOD,_CTTRM); /* Get the current terminal status */ + v = ejsys(STPAR,_CTTRM, bin ? (TT_PGM | jsac[2]) : (~TT_PGM & jsac[2])); + if (v) { printf("STPAR failed"); exit(); } +} +#endif + +trmop(fc,arg) int fc, arg; { +#ifdef SARG10 + int retvalp; + int arglst[3]; + + /* TRMOP is a TOPS-10 monitor call that does things to the terminal. */ + + /* Find out TTY nbr (PA1050 barfs if TRMOP get -1 instead of udx) */ + /* A TRMNO monitor call returns the udx (Universal Device Index) */ + + arglst[0] = fc; /* function code */ + arglst[1] = calli(0115, -1); /* udx, TRMNO. UUO */ + arglst[2] = arg; /* Optional argument */ + + if (calli(0116, 3 // &arglst[0], &retvalp)) /* TRMOP. UUO */ + return (retvalp); + else { + printf("?Error return in TRMOP."); + exit(); + } +#endif +} + +inputline(s) char *s; { + scanf("%s",s); +#ifdef SARG10 + readnl(); +#endif +#ifdef SARG20 + readnl(); +#endif +} + +inflush() { + + /* + * Flush input buffer, make sure no pending input character + */ + + int val; + +#ifdef UNIX +#ifdef XENIX + while(rdchk(0)) read(0,&val,1); +#else +#ifdef SIII + while(read(2,&val,1)); +#else + long l1; + ioctl (0, FIONREAD, &l1); + while(l1-- > 0L) read(0,&val,1); +#endif +#endif +#endif +#ifdef SARG10 + while(uuo(051,2,&val)) /* TTCALL 2, (INCHRS) */ + ; +#endif +#ifdef SARG20 + ejsys(CFIBF,_PRIIN); /* Clear input buffer */ +#endif +} + +zleep(t) int t; { + +/* + * Sleep and do nothing (don't waste CPU) for t milliseconds + */ + +#ifdef SARG10 + calli(072,t); /* (HIBER) t milliseconds */ +#endif +#ifdef SARG20 + ejsys(DISMS,t); /* DISMISS for t milliseconds */ +#endif +#ifdef UNIX + t = t / 1000; + if (t == 0) t = 1; + sleep(t); /* UNIX can only sleep whole seconds */ +#endif +} diff --git a/usr.sbin/pcvt/vttest/header.h b/usr.sbin/pcvt/vttest/header.h new file mode 100644 index 0000000..300564a --- /dev/null +++ b/usr.sbin/pcvt/vttest/header.h @@ -0,0 +1,43 @@ +#define VERSION "1.7b 1985-04-19" + +/* Choose one of these */ + +/* #define XENIX */ /* XENIX implies UNIX */ +/* #define SIII */ /* SIII implies UNIX, (NDELAY a la System III) */ +#define UNIX /* UNIX */ +/* #define VMS */ /* VMS not done yet -- send me your version!!!! */ +/* #define SARG20 */ /* Sargasso C for TOPS-20 */ +/* #define SARG10 */ /* Sargasso C for TOPS-10 */ + +/* These #ifdef:s are implementation dependent stuff for the Sargasso C */ +/* Unix C barfs on directives like "#strings", so we keep them */ +/* indented. Then unix c can't find them, but Sargasso C *can*. */ +/* Admittedly kludgey, but it works...) */ +#ifdef SARG10 + #define _UNIXCON /* Make UNIX-flavored I/O on TOPS */ + #strings low /* put strings in lowseg mem so we can modify them. */ +#endif +#ifdef SARG20 + #define _UNIXCON /* Make UNIX-flavored I/O on TOPS */ + #strings low /* put strings in lowseg mem so we can modify them. */ + #include +#endif + +#include + + +#ifdef UNIX +#include +#include +#include +#include +jmp_buf intrenv; +struct sgttyb sgttyOrg, sgttyNew; +char stdioBuf[BUFSIZ]; +int brkrd, reading; +extern onterm(), onbrk(); +#ifdef SIII +#include +#endif +#endif +int ttymode; diff --git a/usr.sbin/pcvt/vttest/main.c b/usr.sbin/pcvt/vttest/main.c new file mode 100644 index 0000000..02cbc62 --- /dev/null +++ b/usr.sbin/pcvt/vttest/main.c @@ -0,0 +1,2016 @@ +/* + VTTEST.C + + Written Novemeber 1983 - July 1984 by Per Lindberg, + Stockholm University Computer Center (QZ), Sweden. + + THE MAD PROGRAMMER STRIKES AGAIN! + + This software is (c) 1984 by QZ + Non-commercial use and copying allowed. + +If you are developing a commercial product, and use this program to do +it, and that product is successful, please send a sum of money of your +choice to the address below. + +*/ + +#include "header.h" + +char inchar(), *instr(), *lookup(); + +struct table { + int key; + char *msg; +} paritytable[] = { + { 1, "NONE" }, + { 4, "ODD" }, + { 5, "EVEN" }, + { -1, "" } +},nbitstable[] = { + { 1, "8" }, + { 2, "7" }, + { -1,"" } +},speedtable[] = { + { 0, "50" }, + { 8, "75" }, + { 16, "110" }, + { 24, "132.5"}, + { 32, "150" }, + { 40, "200" }, + { 48, "300" }, + { 56, "600" }, + { 64, "1200" }, + { 72, "1800" }, + { 80, "2000" }, + { 88, "2400" }, + { 96, "3600" }, + { 104, "4800" }, + { 112, "9600" }, + { 120, "19200" }, + { -1, "" } +}; + +#ifdef USEMYSTTY +#ifndef stty +int stty(fd,ptr) +int fd; +struct sgttyb *ptr; +{ + return(ioctl(fd, TIOCSETP, ptr)); +} +#endif +#ifndef gtty +int gtty(fd,ptr) +int fd; +struct sgttyb *ptr; +{ + return(ioctl(fd, TIOCGETP, ptr)); +} +#endif +#endif + +main() { + + int menuchoice; + + static char *mainmenu[] = { + "Exit", + "Test of cursor movements", + "Test of screen features", + "Test of character sets", + "Test of double-sized characters", + "Test of keyboard", + "Test of terminal reports", + "Test of VT52 mode", + "Test of VT102 features (Insert/Delete Char/Line)", + "Test of known bugs", + "Test of reset and self-test", + "" + }; + +#ifdef UNIX + initterminal(setjmp(intrenv)); + signal(SIGINT, onbrk); + signal(SIGTERM, onterm); + reading = 0; +#else + initterminal(0); +#endif + do { +#ifdef SARG20 + ttybin(1); /* set line to binary mode again. It's reset somehow!! */ +#endif + ed(2); + cup(5,10); printf("VT100 test program, version %s", VERSION); + cup(7,10); println("Choose test type:"); + menuchoice = menu(mainmenu); + switch (menuchoice) { + case 1: tst_movements(); break; + case 2: tst_screen(); break; + case 3: tst_characters(); break; + case 4: tst_doublesize(); break; + case 5: tst_keyboard(); break; + case 6: tst_reports(); break; + case 7: tst_vt52(); break; + case 8: tst_insdel(); break; + case 9: tst_bugs(); break; + case 10: tst_rst(); break; + } + } while (menuchoice); + bye(); +} + +tst_movements() { + + /* Test of: + CUF (Cursor Forward) + CUB (Cursor Backward) + CUD (Cursor Down) IND (Index) NEL (Next Line) + CUU (Cursor Up) RI (Reverse Index) + CUP (Cursor Position) HVP (Horizontal and Vertical Position) + ED (Erase in Display) + EL (Erase in Line) + DECALN (Screen Alignment Display) + + Cursor control characters inside CSI sequences + */ + + int i, row, col, pass, width, hlfxtra; + char c, *ctext = "This is a correct sentence"; + + for (pass = 0; pass <= 1; pass++) { + if (pass == 0) { rm("?3"); width = 80; hlfxtra = 0; } + else { sm("?3"); width = 132; hlfxtra = 26; } + + decaln(); + cup( 9,10+hlfxtra); ed(1); + cup(18,60+hlfxtra); ed(0); el(1); + cup( 9,71+hlfxtra); el(0); + for (row = 10; row <= 16; row++) { + cup(row, 10+hlfxtra); el(1); + cup(row, 71+hlfxtra); el(0); + } + cup(17,30); el(2); + for (col = 1; col <= width; col++) { + hvp(24, col); printf("*"); + hvp( 1, col); printf("*"); + } + cup(2,2); + for (row = 2; row <= 23; row++) { + printf("+"); + cub(1); + ind(); + } + cup(23,width-1); + for (row = 23; row >=2; row--) { + printf("+"); + cub(1); ri(); + } + cup(2,1); + for (row = 2; row <= 23; row++) { + printf("*"); + cup(row, width); + printf("*"); + cub(10); + if(row < 10) + nel(); + else + printf("\n"); + } + cup(2,10); + cub(42+hlfxtra); cuf(2); + for (col = 3; col <= width-2; col++) { + printf("+"); + cuf(0); cub(2); cuf(1); + } + cup(23,70+hlfxtra); + cuf(42+hlfxtra); cub(2); + for (col = width-2; col >= 3; col--) { + printf("+"); + cub(1); cuf(1); cub(0); printf("%c", 8); + } + cup( 1, 1); cuu(10); cuu(1); cuu(0); + cup(24,width); cud(10); cud(1); cud(0); + + cup(10,12+hlfxtra); + for (row = 10; row <= 15; row++) { + for (col = 12+hlfxtra; col <= 69+hlfxtra; col++) printf(" "); + cud(1); cub(58); + } + cuu(5); cuf(1); + printf("The screen should be cleared, and have an unbroken bor-"); + cup(12,13+hlfxtra); + printf("der of *'s and +'s around the edge, and exactly in the"); + cup(13,13+hlfxtra); + printf("middle there should be a frame of E's around this text"); + cup(14,13+hlfxtra); + printf("with one (1) free position around it. "); + holdit(); + } + rm("?3"); + + ed(2); + cup(1,1); + println("Test of cursor-control characters inside ESC sequences."); + println("Below should be two identical lines:"); + println(""); + println("A B C D E F G H I J K L M N O P Q R S"); + for (i = 1; i < 20; i++) { + printf("%c", 64 + i); + brcstr("2\010", 'C'); /* Two forward, one backspace */ + } + println(""); + println(""); + holdit(); + + ed(2); + cup(1,1); + println("Test of leading zeros in ESC sequences."); + printf("Two lines below you should see the sentence \"%s\".",ctext); + for (col = 1; *ctext; col++) + printf("\033[00000000004;00000000%dH%c",col,*ctext++); + cup(20,1); + holdit(); +} + +tst_screen() { + + /* Test of: + - DECSTBM (Set Top and Bottom Margins) + - TBC (Tabulation Clear) + - HTS (Horizontal Tabulation Set) + - SM RM (Set/Reset mode): - 80/132 chars + - Origin: Realtive/absolute + - Scroll: Smooth/jump + - Wraparound + - SGR (Select Graphic Rendition) + - SM RM (Set/Reset Mode) - Inverse + - DECSC (Save Cursor) + - DECRC (Restore Cursor) + */ + + int i, j, cset, row, col, down, soft, background; + + static char *tststr = "*qx`"; + static char *attr[5] = { ";0", ";1", ";4", ";5", ";7" }; + + cup(1,1); + sm("?7"); /* Wrap Around ON */ + for (col = 1; col <= 160; col++) printf("*"); + rm("?7"); /* Wrap Around OFF */ + cup(3,1); + for (col = 1; col <= 160; col++) printf("*"); + sm("?7"); /* Wrap Around ON */ + cup(5,1); + println("This should be three identical lines of *'s completely filling"); + println("the top of the screen without any empty lines between."); + println("(Test of WRAP AROUND mode setting.)"); + holdit(); + + ed(2); + tbc(3); + cup(1,1); + for (col = 1; col <= 78; col += 3) { + cuf(3); hts(); + } + cup(1,4); + for (col = 4; col <= 78; col += 6) { + tbc(0); cuf(6); + } + cup(1,7); tbc(1); tbc(2); /* no-op */ + cup(1,1); for (col = 1; col <= 78; col += 6) printf("\t*"); + cup(2,2); for (col = 2; col <= 78; col += 6) printf(" *"); + cup(4,1); + println("Test of TAB setting/resetting. These two lines"); + printf("should look the same. "); + holdit(); + for (background = 0; background <= 1; background++) { + if (background) rm("?5"); + else sm("?5"); + sm("?3"); /* 132 cols */ + ed(2); /* VT100 clears screen on SM3/RM3, but not obviously, so... */ + cup(1,1); tbc(3); + for (col = 1; col <= 132; col += 8) { + cuf(8); hts(); + } + cup(1,1); for (col = 1; col <= 130; col += 10) printf("1234567890"); + printf("12"); + for (row = 3; row <= 20; row++) { + cup(row,row); + printf("This is 132 column mode, %s background.", + background ? "dark" : "light"); + } + holdit(); + rm("?3"); /* 80 cols */ + ed(2); /* VT100 clears screen on SM3/RM3, but not obviously, so... */ + cup(1,1); for (col = 1; col <= 80; col += 10) printf("1234567890"); + for (row = 3; row <= 20; row++) { + cup(row,row); + printf("This is 80 column mode, %s background.", + background ? "dark" : "light"); + } + holdit(); + } + + ed(2); + sm("?6"); /* Origin mode (relative) */ + for (soft = -1; soft <= 0; soft++) { + if (soft) sm("?4"); + else rm("?4"); + for (row = 12; row >= 1; row -= 11) { + decstbm(row, 24-row+1); + ed(2); + for (down = 0; down >= -1; down--) { + if (down) cuu(24); + else cud(24); + for (i = 1; i <= 30; i++) { + printf("%s scroll %s region %d Line %d\n", + soft ? "Soft" : "Jump", + down ? "down" : "up", + 2*(13-row), i); + if (down) { ri(); ri(); } + } + } + holdit(); + } + } + ed(2); + decstbm(23,24); + printf( + "\nOrigin mode test. This line should be at the bottom of the screen."); + cup(1,1); + printf("%s", + "This line should be the one above the bottom of the screeen. "); + holdit(); + ed(2); + rm("?6"); /* Origin mode (absolute) */ + cup(24,1); + printf( + "Origin mode test. This line should be at the bottom of the screen."); + cup(1,1); + printf("%s", "This line should be at the top if the screen. "); + holdit(); + decstbm(1,24); + + ed(2); + cup( 1,20); printf("Graphic rendition test pattern:"); + cup( 4, 1); sgr("0"); printf("vanilla"); + cup( 4,40); sgr("0;1"); printf("bold"); + cup( 6, 6); sgr(";4"); printf("underline"); + cup( 6,45);sgr(";1");sgr("4");printf("bold underline"); + cup( 8, 1); sgr("0;5"); printf("blink"); + cup( 8,40); sgr("0;5;1"); printf("bold blink"); + cup(10, 6); sgr("0;4;5"); printf("underline blink"); + cup(10,45); sgr("0;1;4;5"); printf("bold underline blink"); + cup(12, 1); sgr("1;4;5;0;7"); printf("negative"); + cup(12,40); sgr("0;1;7"); printf("bold negative"); + cup(14, 6); sgr("0;4;7"); printf("underline negative"); + cup(14,45); sgr("0;1;4;7"); printf("bold underline negative"); + cup(16, 1); sgr("1;4;;5;7"); printf("blink negative"); + cup(16,40); sgr("0;1;5;7"); printf("bold blink negative"); + cup(18, 6); sgr("0;4;5;7"); printf("underline blink negative"); + cup(18,45); sgr("0;1;4;5;7"); printf("bold underline blink negative"); + sgr(""); + + rm("?5"); /* Inverse video off */ + cup(23,1); el(0); printf("Dark background. "); holdit(); + sm("?5"); /* Inverse video */ + cup(23,1); el(0); printf("Light background. "); holdit(); + rm("?5"); + ed(2); + cup(8,12); printf("normal"); + cup(8,24); printf("bold"); + cup(8,36); printf("underscored"); + cup(8,48); printf("blinking"); + cup(8,60); printf("reversed"); + cup(10,1); printf("stars:"); + cup(12,1); printf("line:"); + cup(14,1); printf("x'es:"); + cup(16,1); printf("diamonds:"); + for (cset = 0; cset <= 3; cset++) { + for (i = 0; i <= 4; i++) { + cup(10 + 2 * cset, 12 + 12 * i); + sgr(attr[i]); + if (cset == 0 || cset == 2) scs(0,'B'); + else scs(0,'0'); + for (j = 0; j <= 4; j++) { + printf("%c", tststr[cset]); + } + decsc(); + cup(cset + 1, i + 1); sgr(""); scs(0,'B'); printf("A"); + decrc(); + for (j = 0; j <= 4; j++) { + printf("%c", tststr[cset]); + } + } + } + sgr("0"); scs(0,'B'); cup(21,1); + println("Test of the SAVE/RESTORE CURSOR feature. There should"); + println("be ten characters of each flavour, and a rectangle"); + println("of 5 x 4 A's filling the top left of the screen."); + holdit(); +} + +tst_characters() { + /* Test of: + SCS (Select character Set) + */ + + int i, j, g, cset; + char chcode[5], *setmsg[5]; + + chcode[0] = 'A'; + chcode[1] = 'B'; + chcode[2] = '0'; + chcode[3] = '1'; + chcode[4] = '2'; + setmsg[0] = "UK / national"; + setmsg[1] = "US ASCII"; + setmsg[2] = "Special graphics and line drawing"; + setmsg[3] = "Alternate character ROM standard characters"; + setmsg[4] = "Alternate character ROM special graphics"; + + cup(1,10); printf("Selected as G0 (with SI)"); + cup(1,48); printf("Selected as G1 (with SO)"); + for (cset = 0; cset <= 4; cset++) { + scs(1,'B'); + cup(3 + 4 * cset, 1); + sgr("1"); + printf("Character set %c (%s)",chcode[cset], setmsg[cset]); + sgr("0"); + for (g = 0; g <= 1; g++) { + scs(g,chcode[cset]); + for (i = 1; i <= 3; i++) { + cup(3 + 4 * cset + i, 10 + 38 * g); + for (j = 0; j <= 31; j++) { + printf("%c", i * 32 + j); + } + } + } + } + scs(1,'B'); + cup(24,1); printf("These are the installed character sets. "); + holdit(); +} + +tst_doublesize() { + /* Test of: + DECSWL (Single Width Line) + DECDWL (Double Width Line) + DECDHL (Double Height Line) (also implicit double width) + */ + + int col, i, w, w1; + + /* Print the test pattern in both 80 and 132 character width */ + + for(w = 0; w <= 1; w++) { + w1 = 13 * w; + + ed(2); + cup(1, 1); + if (w) { sm("?3"); printf("132 column mode"); } + else { rm("?3"); printf(" 80 column mode"); } + + cup( 5, 3 + 2 * w1); + printf("v------- left margin"); + + cup( 7, 3 + 2 * w1); + printf("This is a normal-sized line"); + decdhl(0); decdhl(1); decdwl(); decswl(); + + cup( 9, 2 + w1); + printf("This is a Double-width line"); + decswl(); decdhl(0); decdhl(1); decdwl(); + + cup(11, 2 + w1); + decdwl(); decswl(); decdhl(1); decdhl(0); + printf("This is a Double-width-and-height line"); + cup(12, 2 + w1); + decdwl(); decswl(); decdhl(0); decdhl(1); + printf("This is a Double-width-and-height line"); + + cup(14, 2 + w1); + decdwl(); decswl(); decdhl(1); decdhl(0); el(2); + printf("This is another such line"); + cup(15, 2 + w1); + decdwl(); decswl(); decdhl(0); decdhl(1); + printf("This is another such line"); + + cup(17, 3 + 2 * w1); + printf("^------- left margin"); + + cup(21, 1); + printf("This is not a double-width line"); + for (i = 0; i <= 1; i++) { + cup(21,6); + if (i) { printf("**is**"); decdwl(); } + else { printf("is not"); decswl(); } + cup(23,1); holdit(); + } + } + /* Set vanilla tabs for next test */ + cup(1,1); tbc(3); for (col = 1; col <= 132; col += 8) { cuf(8); hts(); } + rm("?3"); + ed(2); + scs(0,'0'); + + cup( 8,1); decdhl(0); printf("lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk"); + cup( 9,1); decdhl(1); printf("lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk"); + cup(10,1); decdhl(0); printf("x%c%c%c%c%cx",9,9,9,9,9); + cup(11,1); decdhl(1); printf("x%c%c%c%c%cx",9,9,9,9,9); + cup(12,1); decdhl(0); printf("x%c%c%c%c%cx",9,9,9,9,9); + cup(13,1); decdhl(1); printf("x%c%c%c%c%cx",9,9,9,9,9); + cup(14,1); decdhl(0); printf("x x"); + cup(15,1); decdhl(1); printf("x x"); + cup(16,1); decdhl(0); printf("mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj"); + cup(17,1); decdhl(1); printf("mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj"); + scs(0,'B'); sgr("1;5"); + cup(12,3); + printf("* The mad programmer strikes again * "); + cup(13,3); printf("%c",9); cub(6); + printf("* The mad programmer strikes again *"); + sgr("0"); + cup(22,1); + println("Another test pattern... a frame with blinking bold text,"); + printf("all in double-height double-width size. "); + holdit(); + + decstbm(8,24); /* Absolute origin mode, so cursor is set at (1,1) */ + cup(8,1); + for (i = 1; i <= 12; i++) + ri(); + decstbm(0,0); /* No scroll region */ + cup(1,1); + printf("%s", "Exactly half of the box should remain. "); + holdit(); +} + +tst_keyboard() { + +/* Test of: + - DECLL (Load LEDs) + - Keyboard return messages + - SM RM (Set/Reset Mode) - Cursor Keys + - Auto repeat + - DECKPAM (Keypad Application Mode) + - DECKPNM (Keypad Numeric Mode) + +The standard VT100 keayboard layout: + + UP DN LE RI + +ESC 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0) -_ =+ `~ BS + +TAB* qQ wW eE rR tT yY uU iI oO pP [{ ]} DEL + +** ** aA sS dD fF gG hH jJ kK lL ;: ," RETN \| + +** **** zZ xX cC vV bB nN mM ,< .> /? **** LF + + ****************SPACE BAR**************** + + PF1 PF2 PF3 PF4 + + *7* *8* *9* *-* + + *4* *5* *6* *,* + + *1* *2* *3* + + ***0*** *.* ENT +*/ + + char *ledmsg[6], *ledseq[6]; + + int i, j, okflag; + int kblayout; + int ckeymode; + int fkeymode; + char kbdc; + char *kbds = " "; + char *curkeystr, *fnkeystr, *abmstr; + char arptstring[500]; + + static struct key { + char c; + int row; + int col; + char *symbol; + } keytab [] = { + { 27, 1, 0, "ESC" }, + { '1', 1, 6, "1" }, { '!', 1, 7, "!" }, + { '2', 1, 11, "2" }, { '@', 1, 12, "@" }, + { '3', 1, 16, "3" }, { '#', 1, 17, "#" }, + { '4', 1, 21, "4" }, { '$', 1, 22, "$" }, + { '5', 1, 26, "5" }, { '%', 1, 27, "%" }, + { '6', 1, 31, "6" }, { '^', 1, 32, "^" }, + { '7', 1, 36, "7" }, { '&', 1, 37, "&" }, + { '8', 1, 41, "8" }, { '*', 1, 42, "*" }, + { '9', 1, 46, "9" }, { '(', 1, 47, "(" }, + { '0', 1, 51, "0" }, { ')', 1, 52, ")" }, + { '-', 1, 56, "-" }, { '_', 1, 57, "_" }, + { '=', 1, 61, "=" }, { '+', 1, 62, "+" }, + { '`', 1, 66, "`" }, { '~', 1, 67, "~" }, + { 8, 1, 70, "BS" }, + { 9, 2, 0, " TAB " }, + { 'q', 2, 8, "q" }, { 'Q', 2, 9, "Q" }, + { 'w', 2, 13, "w" }, { 'W', 2, 14, "W" }, + { 'e', 2, 18, "e" }, { 'E', 2, 19, "E" }, + { 'r', 2, 23, "r" }, { 'R', 2, 24, "R" }, + { 't', 2, 28, "t" }, { 'T', 2, 29, "T" }, + { 'y', 2, 33, "y" }, { 'Y', 2, 34, "Y" }, + { 'u', 2, 38, "u" }, { 'U', 2, 39, "U" }, + { 'i', 2, 43, "i" }, { 'I', 2, 44, "I" }, + { 'o', 2, 48, "o" }, { 'O', 2, 49, "O" }, + { 'p', 2, 53, "p" }, { 'P', 2, 54, "P" }, + { '[', 2, 58, "[" }, { '{', 2, 59, "{" }, + { ']', 2, 63, "]" }, { '}', 2, 64, "}" }, + { 127, 2, 71, "DEL" }, + { 'a', 3, 10, "a" }, { 'A', 3, 11, "A" }, + { 's', 3, 15, "s" }, { 'S', 3, 16, "S" }, + { 'd', 3, 20, "d" }, { 'D', 3, 21, "D" }, + { 'f', 3, 25, "f" }, { 'F', 3, 26, "F" }, + { 'g', 3, 30, "g" }, { 'G', 3, 31, "G" }, + { 'h', 3, 35, "h" }, { 'H', 3, 36, "H" }, + { 'j', 3, 40, "j" }, { 'J', 3, 41, "J" }, + { 'k', 3, 45, "k" }, { 'K', 3, 46, "K" }, + { 'l', 3, 50, "l" }, { 'L', 3, 51, "L" }, + { ';', 3, 55, ";" }, { ':', 3, 56, ":" }, + {'\'', 3, 60, "'" }, { '"', 3, 61,"\"" }, + { 13, 3, 65, "RETN"}, + {'\\', 3, 71,"\\" }, { '|', 3, 72, "|" }, + { 'z', 4, 12, "z" }, { 'Z', 4, 13, "Z" }, + { 'x', 4, 17, "x" }, { 'X', 4, 18, "X" }, + { 'c', 4, 22, "c" }, { 'C', 4, 23, "C" }, + { 'v', 4, 27, "v" }, { 'V', 4, 28, "V" }, + { 'b', 4, 32, "b" }, { 'B', 4, 33, "B" }, + { 'n', 4, 37, "n" }, { 'N', 4, 38, "N" }, + { 'm', 4, 42, "m" }, { 'M', 4, 43, "M" }, + { ',', 4, 47, "," }, { '<', 4, 48, "<" }, + { '.', 4, 52, "." }, { '>', 4, 53, ">" }, + { '/', 4, 57, "/" }, { '?', 4, 58, "?" }, + { 10, 4, 69, "LF" }, + { ' ', 5, 13, " SPACE BAR "}, + {'\0', 0, 0, "" } + }; + + static struct natkey { + char natc; + int natrow; + int natcol; + char *natsymbol; + } natkeytab [][29] = { + { + { '"', 1, 12, "\""}, + { '&', 1, 32, "&" }, + { '/', 1, 37, "/" }, + { '(', 1, 42, "(" }, + { ')', 1, 47, ")" }, + { '=', 1, 52, "=" }, + { '+', 1, 56, "+" }, { '?', 1, 57, "?" }, + { '`', 1, 61, "`" }, { '@', 1, 62, "@" }, + { '<', 1, 66, "<" }, { '>', 1, 67, ">" }, + { '}', 2, 58, "}" }, { ']', 2, 59, "]" }, + { '^', 2, 63, "^" }, { '~', 2, 64, "~" }, + { '|', 3, 55, "|" }, {'\\', 3, 56,"\\" }, + { '{', 3, 60, "{" }, { '[', 3, 61, "[" }, + {'\'', 3, 71, "'" }, { '*', 3, 72, "*" }, + { ',', 4, 47, "," }, { ';', 4, 48, ";" }, + { '.', 4, 52, "." }, { ':', 4, 53, ":" }, + { '-', 4, 57, "-" }, { '_', 4, 58, "_" }, + {'\0', 0, 0, "" } + }, + { + { '"', 1, 12, "\""}, + { '&', 1, 32, "&" }, + { '/', 1, 37, "/" }, + { '(', 1, 42, "(" }, + { ')', 1, 47, ")" }, + { '=', 1, 52, "=" }, + { '+', 1, 56, "+" }, { '?', 1, 57, "?" }, + { '`', 1, 61, "`" }, { '@', 1, 62, "@" }, + { '<', 1, 66, "<" }, { '>', 1, 67, ">" }, + { '}', 2, 58, "}" }, { ']', 2, 59, "]" }, + { '~', 2, 63, "~" }, { '^', 2, 64, "^" }, + { '|', 3, 55, "|" }, {'\\', 3, 56,"\\" }, + { '{', 3, 60, "{" }, { '[', 3, 61, "[" }, + {'\'', 3, 71, "'" }, { '*', 3, 72, "*" }, + { ',', 4, 47, "," }, { ';', 4, 48, ";" }, + { '.', 4, 52, "." }, { ':', 4, 53, ":" }, + { '-', 4, 57, "-" }, { '_', 4, 58, "_" }, + {'\0', 0, 0, "" } + } + }; + + static struct curkey { + char *curkeymsg[3]; + int curkeyrow; + int curkeycol; + char *curkeysymbol; + char *curkeyname; + } curkeytab [] = { + + /* A Reset, A Set, VT52 */ + + {{"\033[A","\033OA","\033A"}, 0, 56, "UP", "Up arrow" }, + {{"\033[B","\033OB","\033B"}, 0, 61, "DN", "Down arrow" }, + {{"\033[D","\033OD","\033D"}, 0, 66, "LT", "Left arrow" }, + {{"\033[C","\033OC","\033C"}, 0, 71, "RT", "Right arrow"}, + {{"", "", "" }, 0, 0, "", "" } + }; + + static struct fnkey { + char *fnkeymsg[4]; + int fnkeyrow; + int fnkeycol; + char *fnkeysymbol; + char *fnkeyname; + } fnkeytab [] = { + + /* ANSI-num,ANSI-app,VT52-nu,VT52-ap, r, c, symb name */ + + {{"\033OP","\033OP","\033P","\033P" }, 6, 59, "PF1", "PF1" }, + {{"\033OQ","\033OQ","\033Q","\033Q" }, 6, 63, "PF2", "PF2" }, + {{"\033OR","\033OR","\033R","\033R" }, 6, 67, "PF3", "PF3" }, + {{"\033OS","\033OS","\033S","\033S" }, 6, 71, "PF4", "PF4" }, + {{"7", "\033Ow","7", "\033?w"}, 7, 59, " 7 ", "Numeric 7" }, + {{"8", "\033Ox","8", "\033?x"}, 7, 63, " 8 ", "Numeric 8" }, + {{"9", "\033Oy","9", "\033?y"}, 7, 67, " 9 ", "Numeric 9" }, + {{"-", "\033Om","-", "\033?m"}, 7, 71, " - ", "Minus" }, + {{"4", "\033Ot","4", "\033?t"}, 8, 59, " 4 ", "Numeric 4" }, + {{"5", "\033Ou","5", "\033?u"}, 8, 63, " 5 ", "Numeric 5" }, + {{"6", "\033Ov","6", "\033?v"}, 8, 67, " 6 ", "Numeric 6" }, + {{",", "\033Ol",",", "\033?l"}, 8, 71, " , ", "Comma" }, + {{"1", "\033Oq","1", "\033?q"}, 9, 59, " 1 ", "Numeric 1" }, + {{"2", "\033Or","2", "\033?r"}, 9, 63, " 2 ", "Numeric 2" }, + {{"3", "\033Os","3", "\033?s"}, 9, 67, " 3 ", "Numeric 3" }, + {{"0", "\033Op","0", "\033?p"},10, 59," O ","Numeric 0"}, + {{".", "\033On",".", "\033?n"},10, 67, " . ", "Point" }, + {{"\015", "\033OM","\015", "\033?M"},10, 71, "ENT", "ENTER" }, + {{"","","",""}, 0, 0, "", "" } + }; + + static struct ckey { + int ccount; + char *csymbol; + } ckeytab [] = { + { 0, "NUL (CTRL-@ or CTRL-Space)" }, + { 0, "SOH (CTRL-A)" }, + { 0, "STX (CTRL-B)" }, + { 0, "ETX (CTRL-C)" }, + { 0, "EOT (CTRL-D)" }, + { 0, "ENQ (CTRL-E)" }, + { 0, "ACK (CTRL-F)" }, + { 0, "BEL (CTRL-G)" }, + { 0, "BS (CTRL-H) (BACK SPACE)" }, + { 0, "HT (CTRL-I) (TAB)" }, + { 0, "LF (CTRL-J) (LINE FEED)" }, + { 0, "VT (CTRL-K)" }, + { 0, "FF (CTRL-L)" }, + { 0, "CR (CTRL-M) (RETURN)" }, + { 0, "SO (CTRL-N)" }, + { 0, "SI (CTRL-O)" }, + { 0, "DLE (CTRL-P)" }, + { 0, "DC1 (CTRL-Q) (X-On)" }, + { 0, "DC2 (CTRL-R)" }, + { 0, "DC3 (CTRL-S) (X-Off)" }, + { 0, "DC4 (CTRL-T)" }, + { 0, "NAK (CTRL-U)" }, + { 0, "SYN (CTRL-V)" }, + { 0, "ETB (CTRL-W)" }, + { 0, "CAN (CTRL-X)" }, + { 0, "EM (CTRL-Y)" }, + { 0, "SUB (CTRL-Z)" }, + { 0, "ESC (CTRL-[) (ESCAPE)" }, + { 0, "FS (CTRL-\\ or CTRL-? or CTRL-_)" }, + { 0, "GS (CTRL-])" }, + { 0, "RS (CTRL-^ or CTRL-~ or CTRL-`)" }, + { 0, "US (CTRL-_ or CTRL-?)" } + }; + + static char *keyboardmenu[] = { + "Standard American ASCII layout", + "Swedish national layout D47", + "Swedish national layout E47", + /* add new keyboard layouts here */ + "" + }; + + static char *curkeymodes[3] = { + "ANSI / Cursor key mode RESET", + "ANSI / Cursor key mode SET", + "VT52 Mode" + }; + + static char *fnkeymodes[4] = { + "ANSI Numeric mode", + "ANSI Application mode", + "VT52 Numeric mode", + "VT52 Application mode" + }; + + ledmsg[0] = "L1 L2 L3 L4"; ledseq[0] = "1;2;3;4"; + ledmsg[1] = " L2 L3 L4"; ledseq[1] = "1;0;4;3;2"; + ledmsg[2] = " L2 L3"; ledseq[2] = "1;4;;2;3"; + ledmsg[3] = "L1 L2"; ledseq[3] = ";;2;1"; + ledmsg[4] = "L1"; ledseq[4] = "1"; + ledmsg[5] = ""; ledseq[5] = ""; + +#ifdef UNIX + fflush(stdout); +#endif + ed(2); + cup(10,1); + println("These LEDs (\"lamps\") on the keyboard should be on:"); + for (i = 0; i <= 5; i++) { + cup(10,52); el(0); printf("%s", ledmsg[i]); + decll("0"); + decll(ledseq[i]); + cup(12,1); holdit(); + } + + ed(2); + cup(10,1); + println("Test of the AUTO REPEAT feature"); + println(""); + println("Hold down an alphanumeric key for a while, then push RETURN."); + printf("%s", "Auto Repeat OFF: "); + rm("?8"); + inputline(arptstring); + if (strlen(arptstring) == 0) println("No characters read!??"); + else if (strlen(arptstring) == 1) println("OK."); + else println("Too many characters read."); + println(""); + println("Hold down an alphanumeric key for a while, then push RETURN."); + printf("%s", "Auto Repeat ON: "); + sm("?8"); + inputline(arptstring); + if (strlen(arptstring) == 0) println("No characters read!??"); + else if (strlen(arptstring) == 1) println("Not enough characters read."); + else println("OK."); + println(""); + holdit(); + + ed(2); + cup(5,10); + println("Choose keyboard layout:"); + kblayout = menu(keyboardmenu); + if (kblayout) { + kblayout--; + for (j = 0; natkeytab[kblayout][j].natc != '\0'; j++) { + for (i = 0; keytab[i].c != '\0'; i++) { + if (keytab[i].row == natkeytab[kblayout][j].natrow && + keytab[i].col == natkeytab[kblayout][j].natcol) { + keytab[i].c = natkeytab[kblayout][j].natc; + keytab[i].symbol = natkeytab[kblayout][j].natsymbol; + break; + } + } + } + } + + ed(2); + for (i = 0; keytab[i].c != '\0'; i++) { + cup(1 + 2 * keytab[i].row, 1 + keytab[i].col); + sgr("7"); + printf("%s", keytab[i].symbol); + sgr(""); + } + cup(22,1); +#ifdef UNIX + sgttyNew.sg_flags &= ~CRMOD; + sgttyNew.sg_flags &= ~ECHO; + stty(0, &sgttyNew); +#endif + inflush(); + printf("Press each key, both shifted and unshifted. Finish with RETURN:"); + do { /* while (kbdc != 13) */ + cup(23,1); kbdc = inchar(); + cup(23,1); el(0); + sprintf(kbds, "%c", kbdc); + chrprint(kbds); + for (i = 0; keytab[i].c != '\0'; i++) { + if (keytab[i].c == kbdc) { + cup(1 + 2 * keytab[i].row, 1 + keytab[i].col); + printf("%s", keytab[i].symbol); + break; + } + } + } while (kbdc != 13); +#ifdef SARG10 + inchar(); /* Local hack: Read LF that TOPS-10 adds to CR */ +#endif + cup(23,1); el(0); + + for (ckeymode = 0; ckeymode <= 2; ckeymode++) { + if (ckeymode) sm("?1"); + else rm("?1"); + for (i = 0; curkeytab[i].curkeysymbol[0] != '\0'; i++) { + cup(1 + 2 * curkeytab[i].curkeyrow, 1 + curkeytab[i].curkeycol); + sgr("7"); + printf("%s", curkeytab[i].curkeysymbol); + sgr(""); + } + cup(20,1); printf("<%s>%20s", curkeymodes[ckeymode], ""); + cup(22,1); el(0); + cup(22,1); printf("%s", "Press each cursor key. Finish with TAB."); + for(;;) { + cup(23,1); + if (ckeymode == 2) rm("?2"); /* VT52 mode */ + curkeystr = instr(); + esc("<"); /* ANSI mode */ + cup(23,1); el(0); + cup(23,1); chrprint(curkeystr); + if (!strcmp(curkeystr,"\t")) break; + for (i = 0; curkeytab[i].curkeysymbol[0] != '\0'; i++) { + if (!strcmp(curkeystr,curkeytab[i].curkeymsg[ckeymode])) { + sgr("7"); + printf(" (%s key) ", curkeytab[i].curkeyname); + sgr(""); + cup(1 + 2 * curkeytab[i].curkeyrow, + 1 + curkeytab[i].curkeycol); + printf("%s", curkeytab[i].curkeysymbol); + break; + } + } + if (i == sizeof(curkeytab) / sizeof(struct curkey) - 1) { + sgr("7"); + printf("%s", " (Unknown cursor key) "); + sgr(""); + } + } + } + + for (fkeymode = 0; fkeymode <= 3; fkeymode++) { + for (i = 0; fnkeytab[i].fnkeysymbol[0] != '\0'; i++) { + cup(1 + 2 * fnkeytab[i].fnkeyrow, 1 + fnkeytab[i].fnkeycol); + sgr("7"); + printf("%s", fnkeytab[i].fnkeysymbol); + sgr(""); + } + cup(20,1); printf("<%s>%20s", fnkeymodes[fkeymode], ""); + cup(22,1); el(0); + cup(22,1); printf("%s", "Press each function key. Finish with TAB."); + for(;;) { + cup(23,1); + if (fkeymode >= 2) rm("?2"); /* VT52 mode */ + if (fkeymode % 2) deckpam(); /* Application mode */ + else deckpnm(); /* Numeric mode */ + fnkeystr = instr(); + esc("<"); /* ANSI mode */ + cup(23,1); el(0); + cup(23,1); chrprint(fnkeystr); + if (!strcmp(fnkeystr,"\t")) break; + for (i = 0; fnkeytab[i].fnkeysymbol[0] != '\0'; i++) { + if (!strcmp(fnkeystr,fnkeytab[i].fnkeymsg[fkeymode])) { + sgr("7"); + printf(" (%s key) ", fnkeytab[i].fnkeyname); + sgr(""); + cup(1 + 2 * fnkeytab[i].fnkeyrow, 1 + fnkeytab[i].fnkeycol); + printf("%s", fnkeytab[i].fnkeysymbol); + break; + } + } + if (i == sizeof(fnkeytab) / sizeof(struct fnkey) - 1) { + sgr("7"); + printf("%s", " (Unknown function key) "); + sgr(""); + } + } + } + +#ifdef UNIX + sgttyNew.sg_flags |= CRMOD; + stty(0, &sgttyNew); +#endif + ed(2); + cup(5,1); + println("Finally, a check of the ANSWERBACK MESSAGE, which can be sent"); + println("by pressing CTRL-BREAK. The answerback message can be loaded"); + println("in SET-UP B by pressing SHIFT-A and typing e.g."); + println(""); + println(" \" H e l l o , w o r l d Return \""); + println(""); + println("(the double-quote characters included). Do that, and then try"); + println("to send an answerback message with CTRL-BREAK. If it works,"); + println("the answerback message should be displayed in reverse mode."); + println("Finish with a single RETURN."); + +#ifdef UNIX + sgttyNew.sg_flags &= ~CRMOD; + stty(0, &sgttyNew); +#endif + do { + cup(17,1); + inflush(); + abmstr = instr(); + cup(17,1); + el(0); + chrprint(abmstr); + } while (strcmp(abmstr,"\r")); + + ed(2); + for (i = 0; i < 32; i++) { + cup(1 + (i % 16), 1 + 40 * (i / 16)); + sgr("7"); + printf("%s", ckeytab[i].csymbol); + sgr("0"); + } + cup(19,1); +#ifdef UNIX + sgttyNew.sg_flags |= CRMOD; + stty(0, &sgttyNew); +#endif + println( + "Push each CTRL-key TWICE. Note that you should be able to send *all*"); + println( + "CTRL-codes twice, including CTRL-S (X-Off) and CTRL-Q (X-Off)!"); + println( + "Finish with DEL (also called DELETE or RUB OUT), or wait 1 minute."); +#ifdef UNIX +#ifdef SIII + sgttyNew.sg_flags &= ~CBREAK; + stty(0, &sgttyNew); +#endif + sgttyNew.sg_flags |= RAW; + stty(0, &sgttyNew); +#endif + ttybin(1); +#ifdef SARG20 + page(0); /* Turn off all character processing at input */ + superbin(1); /* Turn off ^C (among others). Keep your fingers crossed!! */ +#endif + do { + cup(23,1); kbdc = inchar(); + cup(23,1); el(0); + if (kbdc < 32) printf(" %s", ckeytab[kbdc].csymbol); + else { + sprintf(kbds, "%c", kbdc); + chrprint(kbds); + printf("%s", " -- not a CTRL key"); + } + if (kbdc < 32) ckeytab[kbdc].ccount++; + if (ckeytab[kbdc].ccount == 2) { + cup(1 + (kbdc % 16), 1 + 40 * (kbdc / 16)); + printf("%s", ckeytab[kbdc].csymbol); + } + } while (kbdc != '\177'); +#ifdef UNIX + sgttyNew.sg_flags &= ~RAW; + sgttyNew.sg_flags |= ECHO; + stty(0, &sgttyNew); +#ifdef SIII + sgttyNew.sg_flags |= CBREAK; + stty(0, &sgttyNew); +#endif +#endif + ttybin(0); +#ifdef SARG20 + superbin(0); /* Puuuh! We made it!? */ + page(1); /* Back to normal input processing */ + ttybin(1); /* This must be the mode for DEC20 */ +#endif + cup(24,1); + okflag = 1; + for (i = 0; i < 32; i++) if (ckeytab[i].ccount < 2) okflag = 0; + if (okflag) printf("%s", "OK. "); + else printf("%s", "You have not been able to send all CTRL keys! "); + holdit(); +} + +tst_reports() { + /* Test of: + (AnswerBack Message) + SM RM (Set/Reset Mode) - LineFeed / Newline + DSR (Device Status Report) + DA (Device Attributes) + DECREQTPARM (Request Terminal Parameters) + */ + + int parity, nbits, xspeed, rspeed, clkmul, flags; + int i, reportpos; + char *report, *report2; + static char *attributes[][2] = { + { "\033[?1;0c", "No options (vanilla VT100)" }, + { "\033[?1;1c", "VT100 with STP" }, + { "\033[?1;2c", "VT100 with AVO (could be a VT102)" }, + { "\033[?1;3c", "VT100 with STP and AVO" }, + { "\033[?1;4c", "VT100 with GPO" }, + { "\033[?1;5c", "VT100 with STP and GPO" }, + { "\033[?1;6c", "VT100 with AVO and GPO" }, + { "\033[?1;7c", "VT100 with STP, AVO and GPO" }, + { "\033[?1;11c", "VT100 with PP and AVO" }, + { "\033[?1;15c", "VT100 with PP, GPO and AVO" }, + { "\033[?4;2c", "VT132 with AVO" }, + { "\033[?4;3c", "VT132 with AVO and STP" }, + { "\033[?4;6c", "VT132 with GPO and AVO" }, + { "\033[?4;7c", "VT132 with GPO, AVO, and STP" }, + { "\033[?4;11c", "VT132 with PP and AVO" }, + { "\033[?4;15c", "VT132 with PP, GPO and AVO" }, + { "\033[?7c", "VT131" }, + { "\033[?12;5c", "VT125" }, /* VT125 also has ROM version */ + { "\033[?12;7c", "VT125 with AVO" }, /* number, so this won't work */ + { "\033[?5;0c", "VK100 (GIGI)" }, + { "\033[?5c", "VK100 (GIGI)" }, + { "", "" } + }; + +#ifdef UNIX + sgttyNew.sg_flags &= ~ECHO; + stty(0, &sgttyNew); +#endif + cup(5,1); + println("This is a test of the ANSWERBACK MESSAGE. (To load the A.B.M."); + println("see the TEST KEYBOARD part of this program). Below here, the"); + println("current answerback message in your terminal should be"); + println("displayed. Finish this test with RETURN."); + cup(10,1); + inflush(); + printf("%c", 5); /* ENQ */ + report = instr(); + cup(10,1); + chrprint(report); + cup(12,1); + holdit(); + + ed(2); + cup(1,1); + println("Test of LineFeed/NewLine mode."); + cup(3,1); + sm("20"); +#ifdef UNIX + sgttyNew.sg_flags &= ~CRMOD; + stty(0, &sgttyNew); +#endif + printf("NewLine mode set. Push the RETURN key: "); + report = instr(); + cup(4,1); + el(0); + chrprint(report); + if (!strcmp(report, "\015\012")) printf(" -- OK"); + else printf(" -- Not expected"); + cup(6,1); + rm("20"); + printf("NewLine mode reset. Push the RETURN key: "); + report = instr(); + cup(7,1); + el(0); + chrprint(report); + if (!strcmp(report, "\015")) printf(" -- OK"); + else printf(" -- Not expected"); + cup(9,1); +#ifdef UNIX + sgttyNew.sg_flags |= CRMOD; + stty(0, &sgttyNew); +#endif + holdit(); + + ed(2); + cup(1,1); + printf("Test of Device Status Report 5 (report terminal status)."); + cup(2,1); + dsr(5); + report = instr(); + cup(2,1); + el(0); + printf("Report is: "); + chrprint(report); + if (!strcmp(report,"\033[0n")) printf(" -- means \"TERMINAL OK\""); + else if (!strcmp(report,"\033[3n")) printf(" -- means \"TERMINAL OK\""); + else printf(" -- Unknown response!"); + + cup(4,1); + println("Test of Device Status Report 6 (report cursor position)."); + cup(5,1); + dsr(6); + report = instr(); + cup(5,1); + el(0); + printf("Report is: "); + chrprint(report); + if (!strcmp(report,"\033[5;1R")) printf(" -- OK"); + else printf(" -- Unknown response!"); + + cup(7,1); + println("Test of Device Attributes report (what are you)"); + cup(8,1); + da(0); + report = instr(); + cup(8,1); + el(0); + printf("Report is: "); + chrprint(report); + for (i = 0; *attributes[i][0] != '\0'; i++) { + if (!strcmp(report,attributes[i][0])) break; + } + if (*attributes[i][0] == '\0') + printf(" -- Unknown response, refer to the manual"); + else { + printf(" -- means %s", attributes[i][1]); + if (i) { + cup(9,1); + println("Legend: STP = Processor Option"); + println(" AVO = Advanced Video Option"); + println(" GPO = Graphics Processor Option"); + println(" PP = Printer Port"); + } + } + + cup(14,1); + println("Test of the \"Request Terminal Parameters\" feature, argument 0."); + cup(15,1); + decreqtparm(0); + report = instr(); + cup(15,1); + el(0); + printf("Report is: "); + chrprint(report); + if (strlen(report) < 16 + || report[0] != '\033' + || report[1] != '[' + || report[2] != '2' + || report[3] != ';') + println(" -- Bad format"); + else { + reportpos = 4; + parity = scanto(report, &reportpos, ';'); + nbits = scanto(report, &reportpos, ';'); + xspeed = scanto(report, &reportpos, ';'); + rspeed = scanto(report, &reportpos, ';'); + clkmul = scanto(report, &reportpos, ';'); + flags = scanto(report, &reportpos, 'x'); + if (parity == 0 || nbits == 0 || clkmul == 0) println(" -- Bad format"); + else println(" -- OK"); + printf( + "This means: Parity %s, %s bits, xmitspeed %s, recvspeed %s.\n", + lookup(paritytable, parity), + lookup(nbitstable, nbits), + lookup(speedtable, xspeed), + lookup(speedtable, rspeed)); + printf("(CLoCk MULtiplier = %d, STP option flags = %d)\n", clkmul, flags); + } + + cup(19,1); + println("Test of the \"Request Terminal Parameters\" feature, argument 1."); + cup(20,1); + decreqtparm(1); /* Does the same as decreqtparm(0), reports "3" */ + report2 = instr(); + cup(20,1); + el(0); + printf("Report is: "); + chrprint(report2); + if (strlen(report2) < 3 + || report2[2] != '3') + println(" -- Bad format"); + else { + report2[2] = '2'; + if (!strcmp(report,report2)) println(" -- OK"); + else println(" -- Bad format"); + } + cup(24,1); + holdit(); +#ifdef UNIX + sgttyNew.sg_flags |= ECHO; + stty(0, &sgttyNew); +#endif +} + +tst_vt52() { + + static struct rtabl { + char *rcode; + char *rmsg; + } resptable[] = { + { "\033/K", " -- OK (means Standard VT52)" }, + { "\033/Z", " -- OK (means VT100 emulating VT52)" }, + { "", " -- Unknown response"} + }; + + int i,j; + char *response; + + rm("?2"); /* Reset ANSI (VT100) mode, Set VT52 mode */ + esc("H"); /* Cursor home */ + esc("J"); /* Erase to end of screen */ + esc("H"); /* Cursor home */ + for (i = 0; i <= 23; i++) { + for (j = 0; j <= 9; j++) + printf("%s", "FooBar "); + println("Bletch"); + } + esc("H"); /* Cursor home */ + esc("J"); /* Erase to end of screen */ + + vt52cup(7,47); + printf("nothing more."); + for (i = 1; i <= 10; i++) printf("THIS SHOULD GO AWAY! "); + for (i = 1; i <= 5; i++) { + vt52cup(1,1); + printf("%s", "Back scroll (this should go away)"); + esc("I"); /* Reverse LineFeed (with backscroll!) */ + } + vt52cup(12,60); + esc("J"); /* Erase to end of screen */ + for (i = 2; i <= 6; i++) { + vt52cup(i,1); + esc("K"); /* Erase to end of line */ + } + + for (i = 2; i <= 23; i++) { + vt52cup(i,70); printf("%s", "**Foobar"); + } + vt52cup(23,10); + for (i = 23; i >= 2; i--) { + printf("%s", "*"); + printf("%c", 8); /* BS */ + esc("I"); /* Reverse LineFeed (LineStarve) */ + } + vt52cup(1,70); + for (i = 70; i >= 10; i--) { + printf("%s", "*"); + esc("D"); esc("D"); /* Cursor Left */ + } + vt52cup(24,10); + for (i = 10; i <= 70; i++) { + printf("%s", "*"); + printf("%c", 8); /* BS */ + esc("C"); /* Cursor Right */ + } + vt52cup(2,11); + for (i = 2; i <= 23; i++) { + printf("%s", "!"); + printf("%c", 8); /* BS */ + esc("B"); /* Cursor Down */ + } + vt52cup(23,69); + for (i = 23; i >= 2; i--) { + printf("%s", "!"); + printf("%c", 8); /* BS */ + esc("A"); /* Cursor Up */ + } + for (i = 2; i <= 23; i++) { + vt52cup(i,71); + esc("K"); /* Erase to end of line */ + } + + vt52cup(10,16); + printf("%s", "The screen should be cleared, and have a centered"); + vt52cup(11,16); + printf("%s", "rectangle of \"*\"s with \"!\"s on the inside to the"); + vt52cup(12,16); + printf("%s", "left and right. Only this, and"); + vt52cup(13,16); + holdit(); + + esc("H"); /* Cursor home */ + esc("J"); /* Erase to end of screen */ + printf("%s", "This is the normal character set:"); + for (j = 0; j <= 1; j++) { + vt52cup(3 + j, 16); + for (i = 0; i <= 47; i++) + printf("%c", 32 + i + 48 * j); + } + vt52cup(6,1); + printf("%s", "This is the special graphics character set:"); + esc("F"); /* Select Special Graphics character set */ + for (j = 0; j <= 1; j++) { + vt52cup(8 + j, 16); + for (i = 0; i <= 47; i++) + printf("%c", 32 + i + 48 * j); + } + esc("G"); /* Select ASCII character set */ + vt52cup(12,1); + holdit(); + + esc("H"); /* Cursor home */ + esc("J"); /* Erase to end of screen */ + println("Test of terminal response to IDENTIFY command"); + esc("Z"); /* Identify */ + response = instr(); + println(""); + printf("Response was"); + esc("<"); /* Enter ANSI mode (VT100 mode) */ + chrprint(response); + for(i = 0; resptable[i].rcode[0] != '\0'; i++) + if (!strcmp(response, resptable[i].rcode)) + break; + printf("%s", resptable[i].rmsg); + println(""); + println(""); + holdit(); +} + +tst_insdel() { + + /* Test of: + SM/RM(4) (= IRM (Insertion/replacement mode)) + ICH (Insert Character) + DCH (Delete character) + IL (Insert line) + DL (Delete line) + */ + + int i, row, col, sw, dblchr, scr132; + + for(scr132 = 0; scr132 <= 1; scr132++) { + if (scr132) { sm("?3"); sw = 132; } + else { rm("?3"); sw = 80; } + ed(2); + cup(1,1); + for (row=1; row<=24; row++) { + cup(row,1); + for (col=1; col<=sw; col++) + printf("%c", 'A'-1+row); + } + cup(4,1); + printf("Screen accordion test (Insert & Delete Line). "); holdit(); + ri(); el(2); + decstbm( 2,23); + sm("?6"); + cup(1,1); + for (row=1; row<=24; row++) { + il(row); + dl(row); + } + rm("?6"); + decstbm( 0, 0); + cup(2,1); + printf( + "Top line: A's, bottom line: X's, this line, nothing more. "); + holdit(); + cup(2,1); ed(0); + cup(1,2); + printf("B"); + cub(1); + sm("4"); + for (col=2; col<=sw-1; col++) + printf("*"); + rm("4"); + cup(4,1); + printf("Test of 'Insert Mode'. The top line should be 'A*** ... ***B'. "); + holdit(); ri(); el(2); + cup(1,2); + dch(sw-2); + cup(4,1); + printf("Test of 'Delete Character'. The top line should be 'AB'. "); + holdit(); + + for(dblchr = 1; dblchr <= 2; dblchr++) { + ed(2); + for (row=1; row<=24; row++) { + cup(row,1); + if (dblchr == 2) decdwl(); + for (col=1; col<=sw/dblchr; col++) + printf("%c", 'A'-1+row); + cup(row,sw/dblchr-row); + dch(row); + } + cup(4,1); + println("The right column should be staggered "); + printf("by one. "); + holdit(); + } + ed(2); + cup(1,1); + println("If your terminal has the ANSI 'Insert Character' function"); + println("(the VT102 does not), then you should see a line like this"); + println(" A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"); + println("below:"); + println(""); + for (i = 'Z'; i >= 'A'; i--) { + printf("%c\010",i); + ich(2); + } + cup(10,1); + holdit(); + + if (sw == 132) rm("?3"); + } +} + +dch(pn) int pn; { brc(pn, 'P'); } /* Delete character */ +ich(pn) int pn; { brc(pn, '@'); } /* Insert character -- not in VT102 */ +dl(pn) int pn; { brc(pn, 'M'); } /* Delete line */ +il(pn) int pn; { brc(pn, 'L'); } /* Insert line */ + +/* Test of some known VT100 bugs and misfeatures */ + +tst_bugs() { + + int i, menuchoice; + + static char *menutable[] = { + "Exit to main menu", + "Bug A: Smooth scroll to jump scroll", + "Bug B: Scrolling region", + "Bug C: Wide to narrow screen", + "Bug D: Narrow to wide screen", + "Bug E: Cursor move from double- to single-wide line", + "Bug F: Column mode escape sequence", + "Wrap around with cursor addressing", + "Erase right half of double width lines", + "Funny scroll regions", + /* Add more here */ + "" + }; + + static char *hmsg[] = { + "Test of known bugs in the DEC VT100 series. The numbering of some of", + "the bugs (A-F) refers to the article 'VT100 MAGIC' by Sami Tabih in", + "the 'Proceedings of the DEC Users Society' at St. Louis, Missouri, May", + "1983. To understand some of the tests, you have to look at the source", + "code or the article. Of course, a good VT100-compatible terminal", + "should not have these bugs (or have some means of disabling them)! If", + "a bug appears, you might want to RESET the terminal before continuing", + "the test. There is a test of the RESET function in the main menu.", + "" }; + + do { + ed(2); cup(1,1); + for (i = 0; *hmsg[i]; i++) println(hmsg[i]); + println(""); + println(" Choose bug test number:"); + menuchoice = menu(menutable); + switch (menuchoice) { + case 1: bug_a(); break; + case 2: bug_b(); break; + case 3: bug_c(); break; + case 4: bug_d(); break; + case 5: bug_e(); break; + case 6: bug_f(); break; + case 7: bug_w(); break; + case 8: bug_l(); break; + case 9: bug_s(); break; + } + } while (menuchoice); +} + +/* Bug A: Smooth scroll to jump scroll */ + +bug_a() { + int i; + + cup (10, 1); + println("This is a test of the VT100 'Scroll while toggle softscroll'"); + println("bug. The cursor may disappear, or move UP the screen, or"); + println("multiple copies of some lines may appear."); + holdit(); + + /* Invoke the bug */ + + esc ("[24H"); /* Simplified cursor movement */ + rm("?4"); for (i = 1; i <= 20; i++) printf("\n"); + sm("?4"); for (i = 1; i <= 10; i++) printf("\n"); + rm("?4"); for (i = 1; i <= 5; i++) printf("\n"); + + /* That should be enough to show the bug. But we'll try another way: */ + sm ("?4"); /* Set soft scroll */ + nel (); /* "NextLine", move down */ + rm ("?4"); /* Reset soft scroll */ + nel (); /* "NextLine", move down */ + for (i = 1; i <= 10; i++) { /* Show the bug */ + printf ("Softscroll bug test, line %d. ", i); + holdit(); + } + println("That should have been enough to show the bug, if present."); + holdit(); +} + +/* Bug B: Scrolling region */ + +bug_b() { + char c; + + decaln(); + cup( 1,1); el(0); + printf("Line 11 should be double-wide, line 12 should be cleared."); + cup( 2,1); el(0); + printf("Then, the letters A-P should be written at the beginning"); + cup( 3,1); el(0); + printf("of lines 12-24, and the empty line and A-E are scrolled away."); + cup( 4,1); el(0); + printf("If the bug is present, some lines are confused, look at K-P."); + cup(11,1); decdwl(); + decstbm(12,24); + cup(12,1); el(0); printf("Here we go... "); holdit(); + cup(12,1); ri(); /* Bug comes here */ + for (c = 'A'; c <= 'P'; c++) printf("%c\n",c); /* Bug shows here */ + holdit(); + decstbm(0,0); /* No scr. region */ +} + +/* Bug C: Wide to narrow screen */ + +bug_c() { + sm("?3"); /* 132 column mode */ + cup(1,81); + rm("?3"); /* 80 column mode */ + cup(12,5); + printf("Except for this line, the screen should be blank. "); + holdit(); +} + +/* Bug D: Narrow to wide screen */ + +bug_d() { + int i; + char result; + /* Make the bug appear */ + do { + cup(14,1); + + /* The original code in the article says + * PRINT ESC$; "[13;1H"; CHR$(10%); + * but I guess a cup(14,1); would do. + * (To output a pure LF might be tricky). + */ + + sm("?3"); /* Make the bug visible */ + cup(1,9); decdwl(); + println("You should see blinking text at the bottom line."); + cup(3,9); decdwl(); + println("Enter 0 to exit, 1 to try to invoke the bug again."); + cup(24,9); decdwl(); sgr("1;5;7"); + printf("If you can see this then the bug did not appear."); sgr(""); + cup(4,9); decdwl(); + result = inchar(); readnl(); + rm("?3"); + } while (result == '1'); + sm("?4"); /* Syrup scroll */ + cup(23,1); + for (i = 1; i <= 5; i++) + println("If the bug is present, this should make things much worse!"); + holdit(); + rm("?4"); /* Jump scroll */ +} + +/* Bug E: Cursor move from double- to single-wide line */ + +bug_e() { + int i; + static char *rend[2] = { "\033[m", "\033[7m" }; + sm("?3"); + cup(1,1); decdwl(); + println("This test should put an 'X' at line 3 column 100."); + for (i = 1; i <= 12; i++) printf("1234567890%s",rend[i & 1]); + cup(1,1); /* The bug appears when we jump from a dobule-wide line */ + cup(3,100); /* to a single-wide line, column > 66. */ + printf("X"); + cup(4, 66); printf("! !"); + cup(5,1); + printf("--------------------------- The 'X' should NOT be above here -"); + printf("---+------------ but above here -----+"); + cup(10,1); decdwl(); holdit(); + rm("?3"); +} + +/* Bug F: Column mode escape sequence */ + +bug_f() { + int i, row, col; + + /* + * VT100 "toggle origin mode, forget rest" bug. If you try to set + * (or clear) parameters and one of them is the "origin mode" + * ("?6") parameter, parameters that appear after the "?6" + * remain unaffected. This is also true on CIT-101 terminals. + */ + sm ("?5"); /* Set reverse mode */ + sm ("?3"); /* Set 132 column mode */ + println("Test VT100 'Toggle origin mode, forget rest' bug, part 1."); + println("The screen should be in reverse, 132 column mode."); + holdit(); + ed (2); + rm ("?6;5;3"); /* Reset (origin, reverse, 132 col) */ + println("Test VT100 'Toggle origin mode, forget rest' bug, part 2.\n"); + println("The screen should be in non-reverse, 80 column mode."); + holdit(); +} + + /* Bug W: + * The dreaded "wraparound" bug! You CUP to col 80, write a char, + * CUP to another line in col 80, write a char. And the brain-damaged + * terminal thinks that "Hokay, so he's written a char in col 80, so + * I stay in col 80 and wait for next character. Let's see now, here + * comes another character, and I'm still in col 80, so I must make + * a NewLine first." -- It doesn't clear that "still in col 80" flag + * on a CUP. Argh! + */ + +bug_w() { + int row, col; + + cup (16,1); + println(" This illustrates the \"wrap around bug\" which exists on a"); + println(" standard VT100. At the top of the screen there should be"); + println(" a row of +'s, and the rightmost column should be filled"); + println(" with *'s. But if the bug is present, some of the *'s may"); + println(" be placed in other places, e.g. in the leftmost column,"); + println(" and the top line of +'s may be scrolled away."); + + cup(1,1); + for (col = 1; col <= 79; col++) + printf ("+"); + for (row = 1; row <= 24; row++) { + hvp (row, 80); + printf ("*"); + } + cup(24,1); + holdit(); +} + + /* Bug L: + * Check if the right half of double-width lines comes back + * when a line is first set to single-width, filled with stuff, + * set to double-width, and finally reset to single-width. + * + * A VT100 has this misfeature, and many others. Foo! + */ + +bug_l() { + cup(15, 1); + printf("This-is-a-long-line-This-is-a-long-line-"); + printf("This-is-a-long-line-This-is-a-long-line-"); + cup(1, 1); + printf("This is a test of what happens to the right half of double-width"); + println(" lines."); + printf("A common misfeature is that the right half does not come back"); + println(" when a long"); + printf("single-width line is set to double-width and then reset to"); + println(" single-width."); + + cup(5, 1); + println("Now the line below should contain 80 characters in single width."); + holdit(); + cup(15, 1); decdwl(); + cup(8, 1); + println("Now the line below should contain 40 characters in double width."); + holdit(); + cup(15, 1); decswl(); + cup(11, 1); + println("Now the line below should contain 80 characters in single width."); + holdit(); + + /* ...and in 132 column mode */ + + sm("?3"); + ed(2); + cup(15, 1); + printf("This-is-a-long-line-This-is-a-long-line-"); + printf("This-is-a-long-line-This-is-a-long-line-"); + printf("This-is-a-long-line-This-is-a-long-line-"); + printf("ending-here-"); + + cup(1, 1); + printf("This is the same test in 132 column mode."); + + cup(5, 1); + println("Now the line below should contain 132 characters in single width."); + holdit(); + cup(15, 1); decdwl(); + cup(8, 1); + println("Now the line below should contain 66 characters in double width."); + holdit(); + cup(15, 1); decswl(); + cup(11, 1); + println("Now the line below should contain 132 characters in single width."); + holdit(); + rm("?3"); +} + +bug_s() { + int i; + decstbm(20,10); /* 20-10=-10, < 2, so no scroll region. */ + cup(1,1); + for (i=1; i<=20; i++) + printf("This is 20 lines of text (line %d), no scroll region.\n", i); + holdit(); + ed(2); + decstbm(0,1); /* Should be interpreted as decstbm(1,1) = none */ + cup(1,1); + for (i=1; i<=20; i++) + printf("This is 20 lines of text (line %d), no scroll region.\n", i); + holdit(); + decstbm(0,0); /* No scroll region (just in case...) */ +} + +tst_rst() { + + /* + * Test of + * - RIS (Reset to Initial State) + * - DECTST (invoke terminal test) + */ + + cup(10,1); + printf ("The terminal will now be RESET. "); + holdit(); + ris(); +#ifdef UNIX + fflush(stdout); +#endif + zleep(5000); /* Wait 5.0 seconds */ + cup(10,1); + println("The terminal is now RESET. Next, the built-in confidence test"); + printf("%s", "will be invoked. "); + holdit(); + ed(2); + dectst(1); +#ifdef UNIX + fflush(stdout); +#endif + zleep(5000); /* Wait 5.0 seconds */ + cup(10,1); + println("If the built-in confidence test found any errors, a code"); + printf("%s", "is visible above. "); + holdit(); +} + +initterminal(pn) int pn; { + +#ifdef UNIX + if (pn==0) { + fflush(stdout); + gtty(0,&sgttyOrg); + gtty(0,&sgttyNew); + sgttyNew.sg_flags |= CBREAK; + } + else { + fflush(stdout); + inflush(); + sleep(2); + sgttyNew.sg_flags = sgttyOrg.sg_flags | CBREAK; + } + stty(0,&sgttyNew); +#ifdef SIII + close(2); + open("/dev/tty",O_RDWR|O_NDELAY); +#endif +#endif +#ifdef SARG10 + /* Set up neccesary TOPS-10 terminal parameters */ + + trmop(02041, `VT100`); /* tty type vt100 */ + trmop(02002, 0); /* tty no tape */ + trmop(02003, 0); /* tty lc */ + trmop(02005, 1); /* tty tab */ + trmop(02010, 1); /* tty no crlf */ + trmop(02020, 0); /* tty no tape */ + trmop(02021, 1); /* tty page */ + trmop(02025, 0); /* tty blanks */ + trmop(02026, 1); /* tty no alt */ + trmop(02040, 1); /* tty defer */ +#endif +#ifdef SARG20 + ttybin(1); /* set line to binary mode */ +#endif + /* Set up my personal prejudices */ + + esc("<"); /* Enter ANSI mode (if in VT52 mode) */ + rm("?1"); /* cursor keys normal */ + rm("?3"); /* 80 col mode */ + rm("?4"); /* Jump scroll */ + rm("?5"); /* Normal screen */ + rm("?6"); /* Absolute origin mode */ + sm("?7"); /* Wrap around on */ + rm("?8"); /* Auto repeat off */ + decstbm(0,0); /* No scroll region */ + sgr("0"); /* Normal character attributes */ + +} + +bye () { + /* Force my personal prejudices upon the poor luser */ + + esc("<"); /* Enter ANSI mode (if in VT52 mode) */ + rm("?1"); /* cursor keys normal */ + rm("?3"); /* 80 col mode */ + rm("?5"); /* Normal screen */ + rm("?6"); /* Absolute origin mode */ + sm("?7"); /* Wrap around on */ + sm("?8"); /* Auto repeat on */ + decstbm(0,0); /* No scroll region */ + sgr("0"); /* Normal character attributes */ + + /* Say goodbye */ + + ed(2); + cup(12,30); + printf("That's all, folks!\n"); + printf("\n\n\n"); + inflush(); +#ifdef SARG20 + ttybin(0); /* reset line to normal mode */ +#endif +#ifdef UNIX + stty(0,&sgttyOrg); +#endif + exit(); +} + +#ifdef UNIX +onbrk() { + signal(SIGINT, onbrk); + if (reading) + brkrd = 1; + else + longjmp(intrenv, 1); +} + +onterm() { + signal(SIGTERM, onterm); + longjmp(intrenv, 1); +} +#endif + +holdit() { + inflush(); + printf("Push "); + readnl(); +} + +readnl() { +#ifdef UNIX + char ch; + fflush(stdout); + brkrd = 0; + reading = 1; + do { read(0,&ch,1); } while(ch != '\n' && !brkrd); + if (brkrd) + kill(getpid(), SIGTERM); + reading = 0; +#endif +#ifdef SARG10 + while (getchar() != '\n') + ; +#endif +#ifdef SARG20 + while (getchar() != '\n') + ; +#endif +} + +scanto(str, pos, toc) char *str; int *pos; char toc; { + char c; + int result = 0; + + while (toc != (c = str[(*pos)++])) { + if (isdigit(c)) result = result * 10 + c - '0'; + else break; + } + if (c == toc) return(result); + else return(0); +} + +char *lookup(t, k) struct table t[]; int k; { + + int i; + for (i = 0; t[i].key != -1; i++) { + if (t[i].key == k) return(t[i].msg); + } + return("BAD VALUE"); +} + +menu(table) char *table[]; { + + int i, tablesize, choice; + char c; + char storage[80]; + char *s = storage; + println(""); + tablesize = 0; + for (i = 0; *table[i] != '\0'; i++) { + printf(" %d. %s\n", i, table[i]); + tablesize++; + } + tablesize--; + + printf("\n Enter choice number (0 - %d): ", tablesize); + for(;;) { + inputline(s); + choice = 0; + while (c = *s++) choice = 10 * choice + c - '0'; + if (choice >= 0 && choice <= tablesize) { + ed(2); + return (choice); + } + printf(" Bad choice, try again: "); + } +} + +chrprint (s) char *s; { + + int i; + + printf(" "); + sgr("7"); + printf(" "); + for (i = 0; s[i] != '\0'; i++) { + if (s[i] <= ' ' || s[i] == '\177') + printf("<%d> ", s[i]); + else printf("%c ", s[i]); + } + sgr(""); +} diff --git a/usr.sbin/pcvt/vttest/vttest.1 b/usr.sbin/pcvt/vttest/vttest.1 new file mode 100644 index 0000000..c410492 --- /dev/null +++ b/usr.sbin/pcvt/vttest/vttest.1 @@ -0,0 +1,13 @@ +.TH VTTEST 1 "LOCAL" +.SH NAME +vttest \- test VT100-type terminal +.SH SYNOPSIS +.B vttest +.SH DESCRIPTION +.I Vttest +is a program designed to test the functionality of a VT100 terminal +(or emulator thereof). +It tests both display (escape sequence handling) and keyboard. +.PP +The program is menu\-driven and contains full on\-line operating +instructions. -- cgit v1.1