diff options
author | Aaron Campbell <aaron@cvs.openbsd.org> | 1999-11-25 20:24:23 +0000 |
---|---|---|
committer | Aaron Campbell <aaron@cvs.openbsd.org> | 1999-11-25 20:24:23 +0000 |
commit | 87884933e194b16385ca923e0d2c2902e19d1131 (patch) | |
tree | f65aab27ff61566f4f92221db6c2f9970726e9db /sys/arch/i386 | |
parent | fd88579ecbcc1020abc2ed9a28ccd7d8c1548172 (diff) |
Remove the keyboard mouse emulator, HP emulation mode, and PCVT_SHOWKEYS
debugging cruft. Also fix a bug where you were not able to hold down the
scrollback hotkeys.
Diffstat (limited to 'sys/arch/i386')
-rw-r--r-- | sys/arch/i386/isa/pcvt/Util/mcon/Makefile | 5 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/Util/mcon/mcon.1 | 169 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/Util/mcon/mcon.c | 194 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/Util/pcvtdoc/pcvt.4 | 17 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/Util/scon/scon.1 | 28 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/Util/scon/scon.c | 37 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_conf.h | 23 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_drv.c | 346 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_ext.c | 7 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_hdr.h | 108 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_ioctl.h | 19 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_kbd.c | 1775 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_out.c | 839 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_sup.c | 184 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_vtf.c | 7 |
15 files changed, 596 insertions, 3162 deletions
diff --git a/sys/arch/i386/isa/pcvt/Util/mcon/Makefile b/sys/arch/i386/isa/pcvt/Util/mcon/Makefile deleted file mode 100644 index 207c0a81cc1..00000000000 --- a/sys/arch/i386/isa/pcvt/Util/mcon/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $OpenBSD: Makefile,v 1.2 1999/01/13 07:26:06 niklas Exp $ - -PROG= mcon - -.include <bsd.prog.mk> diff --git a/sys/arch/i386/isa/pcvt/Util/mcon/mcon.1 b/sys/arch/i386/isa/pcvt/Util/mcon/mcon.1 deleted file mode 100644 index 451a6d9437c..00000000000 --- a/sys/arch/i386/isa/pcvt/Util/mcon/mcon.1 +++ /dev/null @@ -1,169 +0,0 @@ -.\" $OpenBSD: mcon.1,v 1.7 1999/07/08 22:57:16 deraadt Exp $ -.\" -.\" Copyright (c) 1994, 1995 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.30, Last Edit-Date: [Fri Jun 30 20:14:42 1995] -.\" -.Dd January 3, 1994 -.Dt MCON 1 i386 -.Os -.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/ttyC0 -through -.Pa /dev/ttyC7 , -the mouse emulator would allocate -.Pa /dev/ttyC8 . - -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/ttyC8 -.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 1x , -.Xr pcvt 4 -.Sh HISTORY -The -.Nm -utility appeared in -.Xr pcvt 4 , -release 3.00. -.Sh AUTHOR -The mouse emulator has been contributed by -.if n Joerg Wunsch. -.if t J\(:org Wunsch. diff --git a/sys/arch/i386/isa/pcvt/Util/mcon/mcon.c b/sys/arch/i386/isa/pcvt/Util/mcon/mcon.c deleted file mode 100644 index 1b4286f95b5..00000000000 --- a/sys/arch/i386/isa/pcvt/Util/mcon/mcon.c +++ /dev/null @@ -1,194 +0,0 @@ -/* $OpenBSD: mcon.c,v 1.4 1999/01/13 07:26:06 niklas Exp $ */ - -/* - * Copyright (c) 1994, 1995 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.30, Last Edit-Date: [Fri Jun 30 20:15:02 1995] - */ - -/*---------------------------------------------------------------------------* - * - * 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 <machine/pcvt_ioctl.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/fcntl.h> - -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: " - "mcon [-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/sys/arch/i386/isa/pcvt/Util/pcvtdoc/pcvt.4 b/sys/arch/i386/isa/pcvt/Util/pcvtdoc/pcvt.4 index 165095c832e..13ea43a36de 100644 --- a/sys/arch/i386/isa/pcvt/Util/pcvtdoc/pcvt.4 +++ b/sys/arch/i386/isa/pcvt/Util/pcvtdoc/pcvt.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: pcvt.4,v 1.18 1999/10/16 18:56:37 aaron Exp $ +.\" $OpenBSD: pcvt.4,v 1.19 1999/11/25 20:24:19 aaron Exp $ .\" .\" Copyright (c) 1992, 1995 Hellmuth Michaelis, Brian Dunford-Shore, .\" Joerg Wunsch and Holger Veit. @@ -260,9 +260,9 @@ Default: on .It Em PCVT_24LINESDEF If enabled, the 25-line modi .Po -VT emulation with 25 lines, and HP emulation with 28 lines +VT emulation with 25 lines .Pc -default to 24 lines only to provide a better compatibility to the +defaults to 24 lines only to provide a better compatibility to the original DEV VT220 (TM). Thus it should be possible to use the terminal information for those terminals without further changes. Note that this is a startup option; it is possible to toggle between @@ -651,13 +651,10 @@ struct screeninfo { /* on write, if -1, make this screen */ /* the current screen, else set current*/ /* displayed screen to parameter */ - int pure_vt_mode; /* flag, pure VT mode or HP/VT mode */ - /* on write, if -1, no change */ int screen_size; /* screen size */ /* on write, if -1, no change */ int force_24lines; /* force 24 lines if 25 lines VT mode */ - /* or 28 lines HP mode to get pure */ - /* VT220 screen size */ + /* to get pure VT220 screen size */ /* on write, if -1, no change */ int vga_family; /* if adaptor_type = VGA, this reflects*/ /* the chipset family after a read */ @@ -671,12 +668,6 @@ struct screeninfo { }; .Ed -Its field -.Em pure_vt_mode -may take the values M_HPVT for a mixed VTxxx and HP Mode, with function -key labels and a status line, or M_PUREVT for only VTxxx sequences -recognized, with no labels. - .Bl -tag -width 20n -offset indent -compact .It VGASETCOLMS sets the number of columns for the current screen, diff --git a/sys/arch/i386/isa/pcvt/Util/scon/scon.1 b/sys/arch/i386/isa/pcvt/Util/scon/scon.1 index 37f9387ed11..f503ef40ec3 100644 --- a/sys/arch/i386/isa/pcvt/Util/scon/scon.1 +++ b/sys/arch/i386/isa/pcvt/Util/scon/scon.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: scon.1,v 1.10 1999/10/16 18:56:37 aaron Exp $ +.\" $OpenBSD: scon.1,v 1.11 1999/11/25 20:24:20 aaron Exp $ .\" .\" Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch .\" @@ -46,12 +46,10 @@ .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 o .Op Fl v -.Op Fl V .Op Fl s Ar lines .br .Nm scon @@ -99,7 +97,7 @@ the command line should be applied to. 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 +it is running in 25-lines pure VT 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 @@ -116,13 +114,6 @@ 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 o Toggle .Dq legacy @@ -142,11 +133,8 @@ Modify VGA palette .Pq DAC . The .Fl p -is mutually exclusive with -.Fl s , -.Fl H , -and -.Fl V . +option is mutually exclusive with +.Fl s . Naturally, option .Fl p is available only for VGA boards. Three flavors are available. @@ -202,15 +190,11 @@ Sets 132 columns mode 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, +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 diff --git a/sys/arch/i386/isa/pcvt/Util/scon/scon.c b/sys/arch/i386/isa/pcvt/Util/scon/scon.c index 250439b2525..51d6f670544 100644 --- a/sys/arch/i386/isa/pcvt/Util/scon/scon.c +++ b/sys/arch/i386/isa/pcvt/Util/scon/scon.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scon.c,v 1.16 1999/10/16 18:56:37 aaron Exp $ */ +/* $OpenBSD: scon.c,v 1.17 1999/11/25 20:24:20 aaron Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch @@ -74,8 +74,6 @@ int lflag = -1; int mflag = -1; int oflag = -1; int current = -1; -int pflag = -1; -int hflag = -1; int res = -1; char *device; int dflag = -1; @@ -244,14 +242,6 @@ char *argv[]; fflag = 1; break; - case 'V': - pflag = 1; - break; - - case 'H': - hflag = 1; - break; - case 's': if (!strncmp(optarg, "25", 2)) res = SIZ_25ROWS; @@ -343,11 +333,8 @@ char *argv[]; } } - 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 + if(dflag == -1 && lflag == -1 && current == -1 && + res == -1 && Pflag == 0 && tflag == 0 && fflag == -1 && colms == 0 && mflag == -1 && bflag == -1 && oflag == -1) { lflag = 1; @@ -508,24 +495,6 @@ char *argv[]; 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) diff --git a/sys/arch/i386/isa/pcvt/pcvt_conf.h b/sys/arch/i386/isa/pcvt/pcvt_conf.h index f63b751ef0f..3615beb63f0 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_conf.h +++ b/sys/arch/i386/isa/pcvt/pcvt_conf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pcvt_conf.h,v 1.13 1998/06/30 20:51:07 millert Exp $ */ +/* $OpenBSD: pcvt_conf.h,v 1.14 1999/11/25 20:24:20 aaron Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -163,14 +163,6 @@ /* compatibility (24 lines) by using */ /* the scon utility at runtime */ -#if !defined PCVT_EMU_MOUSE /* ---------- DEFAULT: OFF ------------ */ -# define PCVT_EMU_MOUSE 0 /* emulate a mouse systems mouse via */ -#elif PCVT_EMU_MOUSE != 0 /* the keypad; this is experimental */ -# undef PCVT_EMU_MOUSE /* code intented to be used on note- */ -# define PCVT_EMU_MOUSE 1 /* books in conjunction with XFree86; */ -#endif /* look at the comments in pcvt_kbd.c */ - /* if you are interested in testing it. */ - #if !defined PCVT_META_ESC /* ---------- DEFAULT: OFF ------------ */ # define PCVT_META_ESC 0 /* if ON, send the sequence "ESC key" */ #elif PCVT_META_ESC != 0 /* for a meta-shifted key; if OFF, */ @@ -186,19 +178,6 @@ #endif /* SESSION TO CLUTTER VIDEO MEMORY !!!! */ /* -------------------------------------------------------------------- */ -/* -------------------- DRIVER DEBUGGING ------------------------------ */ -/* -------------------------------------------------------------------- */ - -#if !defined PCVT_SHOWKEYS /* ---------- DEFAULT: OFF ------------ */ -# define PCVT_SHOWKEYS 0 /* this replaces the system load line */ -#elif PCVT_SHOWKEYS != 0 /* on the vt 0 in hp mode with a display*/ -# undef PCVT_SHOWKEYS /* of the most recent keyboard scan- */ -# define PCVT_SHOWKEYS 1 /* and status codes received from the */ -#endif /* keyboard controller chip. */ - /* this is just for some hardcore */ - /* keyboarders .... */ - -/* -------------------------------------------------------------------- */ /* -------------------- DRIVER OPTIONS -------------------------------- */ /* -------------------------------------------------------------------- */ /* it is unlikely that anybody wants to change anything below */ diff --git a/sys/arch/i386/isa/pcvt/pcvt_drv.c b/sys/arch/i386/isa/pcvt/pcvt_drv.c index dd2a0ba8fa4..8a99c350f8e 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_drv.c +++ b/sys/arch/i386/isa/pcvt/pcvt_drv.c @@ -1,16 +1,13 @@ -/* $OpenBSD: pcvt_drv.c,v 1.25 1999/11/20 18:52:00 espie Exp $ */ - +/* $OpenBSD: pcvt_drv.c,v 1.26 1999/11/25 20:24:20 aaron Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. - * * Copyright (c) 1992, 1993 Brian Dunford-Shore and Scott Turner. - * * Copyright (c) 1993 Charles Hannum. * * All rights reserved. * * Parts of this code regarding the NetBSD interface were written - * by Charles Hannum. + * by Charles Hannum. Parts regarding OpenBSD written by Aaron Campbell. * * This code is derived from software contributed to Berkeley by * William Jolitz and Don Ahn. @@ -42,50 +39,10 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * * @(#)pcvt_drv.c, 3.32, Last Edit-Date: [Tue Oct 3 11:19:47 1995] * */ -/*---------------------------------------------------------------------------* - * - * pcvt_drv.c VT220 Driver Main Module / OS - Interface - * --------------------------------------------------------- - * -hm ------------ Release 3.00 -------------- - * -hm integrating NetBSD-current patches - * -hm adding ttrstrt() proto for NetBSD 0.9 - * -hm kernel/console output cursor positioning fixed - * -hm kernel/console output switches optional to screen 0 - * -hm FreeBSD 1.1 porting - * -hm the NetBSD 0.9 compiler detected a nondeclared var which was - * NOT detected by neither the NetBSD-current nor FreeBSD 1.x! - * -hm including Michael's keyboard fifo code - * -hm Joergs patch for FreeBSD tty-malloc code - * -hm adjustments for NetBSD-current - * -hm FreeBSD bugfix from Joerg re timeout/untimeout casts - * -jw including Thomas Gellekum's FreeBSD 1.1.5 patch - * -hm adjusting #if's for NetBSD-current - * -hm applying Joerg's patch for FreeBSD 2.0 - * -hm patch from Onno & Martin for NetBSD-current (post 1.0) - * -hm some adjustments for NetBSD 1.0 - * -hm NetBSD PR #400: screen size report for new session - * -hm patch from Rafael Boni/Lon Willett for NetBSD-current - * -hm bell patch from Thomas Eberhardt for NetBSD - * -hm multiple X server bugfixes from Lon Willett - * -hm patch from joerg - pcdevtotty for FreeBSD pre-2.1 - * -hm delay patch from Martin Husemann after port-i386 ml-discussion - * -jw add some code to provide more FreeBSD pre-2.1 support - * -hm patches from Michael for NetBSD-current (Apr/21/95) support - * -hm merged in changes from FreeBSD 2.0.5-RELEASE - * -hm NetBSD-current patches from John Kohl - * -hm ---------------- Release 3.30 ----------------------- - * -hm patch from Joerg in pcopen() to make mouse emulator work again - * -hm patch from Frank van der Linden for keyboard state per VT - * -hm no TS_ASLEEP anymore in FreeBSD 2.1.0 SNAP 950928 - * -hm ---------------- Release 3.32 ----------------------- - * - *---------------------------------------------------------------------------*/ - #include "vt.h" #if NVT > 0 @@ -93,24 +50,15 @@ #include "pcvt_hdr.h" /* global include */ -#ifdef NOTDEF -unsigned __debug = 0; /*0xffe */; -static __color; -static nrow; -#endif - static void vgapelinit(void); /* read initial VGA DAC palette */ -int getchar(void); void pccnpollc(Dev_t, int); int pcprobe(struct device *, void *, void *); void pcattach(struct device *, struct device *, void *); - int pcprobe(struct device *parent, void *match, void *aux) { - kbd_code_init(); ((struct isa_attach_args *)aux)->ia_iosize = 16; @@ -132,20 +80,16 @@ pcattach(struct device *parent, struct device *self, void *aux) printf(": "); - switch(adaptor_type) - { + switch(adaptor_type) { case MDA_ADAPTOR: printf("mda"); break; - case CGA_ADAPTOR: printf("cga"); break; - case EGA_ADAPTOR: printf("ega"); break; - case VGA_ADAPTOR: printf("%s, ", (char *)vga_string(vga_type)); if(can_do_132col) @@ -154,7 +98,6 @@ pcattach(struct device *parent, struct device *self, void *aux) printf("80 col"); vgapelinit(); break; - default: printf("unknown"); break; @@ -167,16 +110,13 @@ pcattach(struct device *parent, struct device *self, void *aux) printf(", %d scr, ", totalscreens); - switch(keyboard_type) - { + switch(keyboard_type) { case KB_AT: printf("at-"); break; - case KB_MFII: printf("mf2-"); break; - default: printf("unknown "); break; @@ -189,17 +129,12 @@ pcattach(struct device *parent, struct device *self, void *aux) break; } - for(i = 0; i < totalscreens; i++) - { + for (i = 0; i < totalscreens; i++) { vs[i].vs_tty = ttymalloc(); vs[i].vs_tty->t_dev = makedev(maj, i); tty_attach(vs[i].vs_tty); } -#if PCVT_EMU_MOUSE - pc_tty[totalscreens] = ttymalloc(); /* the mouse emulator tty */ -#endif /* PCVT_EMU_MOUSE */ - pcconsp = vs[0].vs_tty; async_update(); @@ -223,11 +158,6 @@ get_pccons(Dev_t dev) { register int i = minor(dev); -#if PCVT_EMU_MOUSE - if(i == totalscreens) - return(pc_tty[i]); -#endif /* PCVT_EMU_MOUSE */ - if(i >= PCVT_NSCREENS) return(NULL); @@ -247,37 +177,18 @@ pcopen(Dev_t dev, int flag, int mode, struct proc *p) int winsz = 0; int i = minor(dev); -#if PCVT_EMU_MOUSE - if(i == totalscreens) - vsx = 0; - else -#endif /* PCVT_EMU_MOUSE */ - vsx = &vs[i]; if((tp = get_pccons(dev)) == NULL) return ENXIO; -#if PCVT_EMU_MOUSE - if(i == totalscreens) - { - if(mouse.opened == 0) - mouse.buttons = mouse.extendedseen = - mouse.breakseen = mouse.lastmove.tv_sec = 0; - mouse.minor = i; - mouse.opened++; - } - else -#endif /* PCVT_EMU_MOUSE */ - vsx->openf++; tp->t_oproc = pcstart; tp->t_param = pcparam; tp->t_dev = dev; - if ((tp->t_state & TS_ISOPEN) == 0) - { + if ((tp->t_state & TS_ISOPEN) == 0) { tp->t_state |= TS_WOPEN; ttychars(tp); tp->t_iflag = TTYDEF_IFLAG; @@ -299,13 +210,7 @@ pcopen(Dev_t dev, int flag, int mode, struct proc *p) retval = ((*linesw[tp->t_line].l_open)(dev, tp)); - if(winsz == 1 -#if PCVT_EMU_MOUSE - && vsx /* the mouse device has no vsx */ -#endif /* PCVT_EMU_MOUSE */ - ) - { - + if (winsz == 1) { /* * The line discipline has clobbered t_winsize if TS_ISOPEN * was clear. (NetBSD PR #400 from Bill Sommerfeld) @@ -333,12 +238,6 @@ pcclose(Dev_t dev, int flag, int mode, struct proc *p) register struct video_state *vsx; int i = minor(dev); -#if PCVT_EMU_MOUSE - if(i == totalscreens) - vsx = 0; - else -#endif /* PCVT_EMU_MOUSE */ - vsx = &vs[i]; if((tp = get_pccons(dev)) == NULL) @@ -347,21 +246,8 @@ pcclose(Dev_t dev, int flag, int mode, struct proc *p) (*linesw[tp->t_line].l_close)(tp, flag); ttyclose(tp); -#if PCVT_EMU_MOUSE - if(i == totalscreens) - mouse.opened = 0; - else -#endif /* PCVT_EMU_MOUSE */ - vsx->openf = 0; -#if PCVT_EMU_MOUSE - - if(i == totalscreens) - return (0); - -#endif /* PCVT_EMU_MOUSE */ - reset_usl_modes(vsx); return(0); @@ -401,7 +287,7 @@ pctty(Dev_t dev) } int -pcioctl(Dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) +pcioctl(Dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) { register int error; register struct tty *tp; @@ -415,100 +301,15 @@ pcioctl(Dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) * appropriate variables arrays */ -#if PCVT_EMU_MOUSE - if(minor(dev) == totalscreens) - { - if((error = mouse_ioctl(dev, cmd, data)) >= 0) - return error; - goto do_standard; - } -#endif /* PCVT_EMU_MOUSE */ - - if((error = usl_vt_ioctl(dev, cmd, data, flag, p)) >= 0) return (error == PCVT_ERESTART) ? ERESTART : error; -#ifdef XSERVER - /* - * just for compatibility: - * XFree86 < 2.0 and SuperProbe still might use it - * - * NB: THIS IS A HACK! Do not use it unless you explicitly need. - * Especially, since the vty is not put into process-controlled - * mode (this would require the application to co-operate), any - * attempts to switch vtys while this kind of X mode is active - * may cause serious trouble. - */ - switch(cmd) - { - case CONSOLE_X_MODE_ON: - { - int i; - - if((error = usl_vt_ioctl(dev, KDENABIO, 0, flag, p)) > 0) - return error; - - i = KD_GRAPHICS; - if((error = usl_vt_ioctl(dev, KDSETMODE, (caddr_t)&i, flag, p)) - > 0) - return error; - - i = K_RAW; - error = usl_vt_ioctl(dev, KDSKBMODE, (caddr_t)&i, flag, p); - ttyflush(tp, FREAD); - return error; - } - - case CONSOLE_X_MODE_OFF: - { - int i; - - (void)usl_vt_ioctl(dev, KDDISABIO, 0, flag, p); - - i = KD_TEXT; - (void)usl_vt_ioctl(dev, KDSETMODE, (caddr_t)&i, flag, p); - - i = K_XLATE; - (void)usl_vt_ioctl(dev, KDSKBMODE, (caddr_t)&i, flag, p); - ttyflush(tp, FREAD); - return 0; - } - - - case CONSOLE_X_BELL: - - /* - * If `data' is non-null, the first int value denotes - * the pitch, the second a duration. Otherwise, behaves - * like BEL. - */ - - if (data) - { - sysbeep(((int *)data)[0], - ((int *)data)[1] * hz / 1000); - } - else - { - sysbeep(PCVT_SYSBEEPF / 1493, hz / 4); - } - return (0); - - default: /* fall through */ ; - } - -#endif /* XSERVER */ - if((error = kbdioctl(dev,cmd,data,flag)) >= 0) return error; if((error = vgaioctl(dev,cmd,data,flag)) >= 0) return error; -#if PCVT_EMU_MOUSE -do_standard: -#endif /* PCVT_EMU_MOUSE */ - if((error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p)) >= 0) return (error); @@ -523,6 +324,7 @@ pcmmap(Dev_t dev, int offset, int nprot) { if ((u_int)offset > 0x20000) return -1; + return i386_btop((0xa0000 + offset)); } @@ -543,12 +345,13 @@ u_char pcvt_kbd_fifo[PCVT_KBD_FIFO_SZ]; int pcvt_kbd_wptr = 0; int pcvt_kbd_rptr = 0; short pcvt_kbd_count= 0; -static u_char pcvt_timeout_scheduled = 0; +static u_char pcvt_timeout_scheduled; -static void pcvt_timeout (void *arg) +static void +pcvt_timeout(void *arg) { + int s; u_char *cp; - int s; pcvt_timeout_scheduled = 0; @@ -556,23 +359,20 @@ static void pcvt_timeout (void *arg) pcvt_scrnsv_reset(); #endif /* PCVT_SCREENSAVER */ - while (pcvt_kbd_count) - { - if (((cp = sgetc(1)) != 0) && - (vs[current_video_screen].openf)) - { - + while (pcvt_kbd_count) { + if ((cp = sgetc(1)) && (vs[current_video_screen].openf)) { #if PCVT_NULLCHARS - if(*cp == '\0') - { + if(*cp == '\0') { /* pass a NULL character */ - (*linesw[pcconsp->t_line].l_rint)('\0', pcconsp); + (*linesw[pcconsp->t_line].l_rint)('\0', + pcconsp); } /* XXX */ else #endif /* PCVT_NULLCHARS */ while (*cp) - (*linesw[pcconsp->t_line].l_rint)(*cp++ & 0xff, pcconsp); + (*linesw[pcconsp->t_line].l_rint)(*cp++ & 0xff, + pcconsp); } s = spltty(); @@ -605,16 +405,14 @@ pcintr(void *arg) #endif /* PCVT_SCREENSAVER */ #if PCVT_KBD_FIFO - if (kbd_polling) - { + if (kbd_polling) { if(sgetc(1) == 0) return -1; else return 1; } - while (inb(CONTROLLER_CTRL) & STATUS_OUTPBF) /* check 8042 buffer */ - { + while (inb(CONTROLLER_CTRL) & STATUS_OUTPBF) { /* check 8042 buffer */ ret = 1; /* got something */ PCVT_KBD_DELAY(); /* 7 us delay */ @@ -622,11 +420,8 @@ pcintr(void *arg) dt = inb(CONTROLLER_DATA); /* get it 8042 data */ if (pcvt_kbd_count >= PCVT_KBD_FIFO_SZ) /* fifo overflow ? */ - { log (LOG_WARNING, "pcvt: keyboard buffer overflow\n"); - } - else - { + else { pcvt_kbd_fifo[pcvt_kbd_wptr++] = dt; /* data -> fifo */ s = spltty(); /* XXX necessary ? */ @@ -638,13 +433,11 @@ pcintr(void *arg) } } - if (ret == 1) /* got data from keyboard ? */ - { - if (!pcvt_timeout_scheduled) /* if not already active .. */ - { + if (ret == 1) { /* got data from keyboard ? */ + if (!pcvt_timeout_scheduled) { /* if not already active .. */ s = spltty(); pcvt_timeout_scheduled = 1; /* flag active */ - timeout((TIMEOUT_FUNC_T)pcvt_timeout, (caddr_t) 0, 1); /* fire off */ + timeout((TIMEOUT_FUNC_T)pcvt_timeout, (caddr_t) 0, 1); splx(s); } } @@ -662,8 +455,7 @@ pcintr(void *arg) return 1; #if PCVT_NULLCHARS - if(*cp == '\0') - { + if(*cp == '\0') { /* pass a NULL character */ (*linesw[pcconsp->t_line].l_rint)('\0', pcconsp); return 1; @@ -689,9 +481,7 @@ pcstart(register struct tty *tp) if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP)) goto out; - if (tp->t_outq.c_cc == 0 && - tp->t_wsel.si_selpid == 0) - { + if (tp->t_outq.c_cc == 0 && tp->t_wsel.si_selpid == 0) { async_update(); goto low; } @@ -705,8 +495,7 @@ pcstart(register struct tty *tp) * expensive and we don't want our serial ports to overflow. */ - while ((len = q_to_b(&tp->t_outq, buf, PCVT_PCBURST)) != 0) - { + while ((len = q_to_b(&tp->t_outq, buf, PCVT_PCBURST)) != 0) { if (vs[minor(tp->t_dev)].scrolling) sgetc(31337); sput(&buf[0], 0, len, minor(tp->t_dev)); @@ -719,11 +508,9 @@ pcstart(register struct tty *tp) tp->t_state |= TS_TIMEOUT; timeout(ttrstrt, tp, 1); - if (tp->t_outq.c_cc <= tp->t_lowat) - { + if (tp->t_outq.c_cc <= tp->t_lowat) { low: - if (tp->t_state&TS_ASLEEP) - { + if (tp->t_state&TS_ASLEEP) { tp->t_state &= ~TS_ASLEEP; wakeup((caddr_t)&tp->t_outq); } @@ -743,7 +530,6 @@ pcstop(struct tty *tp, int flag) /*---------------------------------------------------------------------------* * /dev/console *---------------------------------------------------------------------------*/ - void pccnprobe(struct consdev *cp) { @@ -751,14 +537,12 @@ pccnprobe(struct consdev *cp) /* locate the major number */ - for (maj = 0; maj < nchrdev; maj++) - { + for (maj = 0; maj < nchrdev; maj++) { if ((u_int)cdevsw[maj].d_open == (u_int)pcopen) break; } - if (maj == nchrdev) - { + if (maj == nchrdev) { /* we are not in cdevsw[], give up */ panic("pcvt is not in cdevsw[]"); } @@ -783,9 +567,7 @@ pccnputc(Dev_t dev, U_char c) #if PCVT_SW0CNOUTP if(current_video_screen != 0) - { switch_screen(0, 0); - } #endif /* PCVT_SW0CNOUTP */ @@ -823,8 +605,6 @@ pccngetc(Dev_t dev) void pccnpollc(Dev_t dev, int on) { - struct vt_softc *sc = NULL; /* XXX not used */ - kbd_polling = on; if (!on) { register int s; @@ -835,9 +615,7 @@ pccnpollc(Dev_t dev, int on) * won't get any further interrupts. */ s = spltty(); - - pcintr(sc); - + pcintr(NULL); splx(s); } } @@ -859,61 +637,6 @@ pcparam(struct tty *tp, struct termios *t) return(0); } -/* special characters */ -#define bs 8 -#define lf 10 -#define cr 13 -#define cntlc 3 -#define del 0177 -#define cntld 4 - -int -getchar(void) -{ - u_char thechar; - int x; - - kbd_polling = 1; - - x = splhigh(); - - sput(">", 1, 1, 0); - - async_update(); - - thechar = *(sgetc(0)); - - kbd_polling = 0; - - splx(x); - - switch (thechar) - { - default: - if (thechar >= ' ') - sput(&thechar, 1, 1, 0); - return(thechar); - - case cr: - case lf: - sput("\r\n", 1, 2, 0); - return(lf); - - case bs: - case del: - sput("\b \b", 1, 3, 0); - return(thechar); - - case cntlc: - sput("^C\r\n", 1, 4, 0) ; - cpu_reset(); - - case cntld: - sput("^D\r\n", 1, 4, 0) ; - return(0); - } -} - /*----------------------------------------------------------------------* * read initial VGA palette (as stored by VGA ROM BIOS) into * palette save area @@ -936,4 +659,3 @@ vgapelinit(void) #endif /* NVT > 0 */ -/*-------------------------- E O F -------------------------------------*/ diff --git a/sys/arch/i386/isa/pcvt/pcvt_ext.c b/sys/arch/i386/isa/pcvt/pcvt_ext.c index adc4cdc4669..bd41a5ceb2d 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_ext.c +++ b/sys/arch/i386/isa/pcvt/pcvt_ext.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcvt_ext.c,v 1.23 1999/11/20 18:52:00 espie Exp $ */ +/* $OpenBSD: pcvt_ext.c,v 1.24 1999/11/25 20:24:21 aaron Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -2387,13 +2387,12 @@ switch_screen(int n, int oldgrafx, int newgrafx) if(!newgrafx) { update_led(); /* update led's */ - update_hp(vsp); /* update fkey labels, if present */ /* if we switch to a vt with force 24 lines mode and */ /* pure VT emulation and 25 rows charset, then we have */ /* to clear the last line on display ... */ - if(vsp->force24 && (vsp->vt_pure_mode == M_PUREVT) && + if(vsp->force24 && (vgacs[vsp->vga_charset].screen_size == SIZ_25ROWS)) { fillw(' ', (caddr_t) @@ -2562,7 +2561,7 @@ vgapage(int new_screen) * VT_USL ioctl handling *---------------------------------------------------------------------------*/ int -usl_vt_ioctl(Dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) +usl_vt_ioctl(Dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) { int i, j, error, opri, mode; struct vt_mode newmode; diff --git a/sys/arch/i386/isa/pcvt/pcvt_hdr.h b/sys/arch/i386/isa/pcvt/pcvt_hdr.h index 1d3ecfa2073..122f8a7f6d6 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_hdr.h +++ b/sys/arch/i386/isa/pcvt/pcvt_hdr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pcvt_hdr.h,v 1.28 1999/11/20 18:52:00 espie Exp $ */ +/* $OpenBSD: pcvt_hdr.h,v 1.29 1999/11/25 20:24:21 aaron Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -452,19 +452,6 @@ #define VGA_PMSK 0x3F /* palette mask, 64 distinct values */ #define NVGAPEL 256 /* number of palette entries */ -/*---------------------------------------------------------------------------* - * function key labels - *---------------------------------------------------------------------------*/ - -#define LABEL_LEN 9 /* length of one label */ -#define LABEL_MID 8 /* mid-part (row/col) */ - -#define LABEL_ROWH ((4*LABEL_LEN)+1) -#define LABEL_ROWL ((4*LABEL_LEN)+2) -#define LABEL_COLU ((4*LABEL_LEN)+4) -#define LABEL_COLH ((4*LABEL_LEN)+5) -#define LABEL_COLL ((4*LABEL_LEN)+6) - /* tab setting */ #define MAXTAB 132 /* no of possible tab stops */ @@ -514,30 +501,6 @@ #define DSCS_LENGTH 3 /* descriptor length */ #define MAXSIXEL 8 /* sixels forever ! */ -/* sub-states for HP-terminal emulator */ - -#define SHP_INIT 0 - -/* esc & f family */ - -#define SHP_AND_F 1 -#define SHP_AND_Fa 2 -#define SHP_AND_Fak 3 -#define SHP_AND_Fak1 4 -#define SHP_AND_Fakd 5 -#define SHP_AND_FakdL 6 -#define SHP_AND_FakdLl 7 -#define SHP_AND_FakdLls 8 - -/* esc & j family */ - -#define SHP_AND_J 9 -#define SHP_AND_JL 10 - -/* esc & every-thing-else */ - -#define SHP_AND_ETE 11 - /* additionals for function key labels */ #define MAX_LABEL 16 @@ -598,11 +561,6 @@ #define D_G2_96 5 /* designated as G2 for 96-char charsets */ #define D_G3_96 6 /* designated as G3 for 96-char charsets */ -/* which fkey-labels */ - -#define SYS_FKL 0 /* in hp mode, sys-fkls are active */ -#define USR_FKL 1 /* in hp mode, user-fkls are active */ - /* initial default scrollback buffer size (in pages) */ #define SCROLLBACK_PAGES 8 @@ -623,16 +581,8 @@ EXTERN u_char pcdisp_special; /* are we printing special chars */ EXTERN u_short kern_attr; /* kernel messages char attributes */ EXTERN u_short user_attr; /* character attributes */ -#if !PCVT_EMU_MOUSE - EXTERN struct tty *pc_tty[PCVT_NSCREENS]; -#else /* PCVT_EMU_MOUSE */ - -EXTERN struct tty *pc_tty[PCVT_NSCREENS + 1]; - -#endif /* PCVT_EMU_MOUSE */ - struct sixels { u_char lower[MAXSIXEL]; /* lower half of char */ u_char upper[MAXSIXEL]; /* upper half of char */ @@ -694,14 +644,9 @@ typedef struct video_state { u_short *sc_GL; /* save GL ptr */ u_short *sc_GR; /* save GR ptr */ u_char sc_sel; /* selective erase state */ - u_char ufkl[8][17]; /* user fkey-labels */ - u_char sfkl[8][17]; /* system fkey-labels */ - u_char labels_on; /* display fkey labels etc. on/off */ - u_char which_fkl; /* which fkey labels are active */ char tab_stops[MAXTAB]; /* table of active tab stops */ u_char parmi; /* parameter index */ u_char parms[MAXPARMS]; /* parameter array */ - u_char hp_state; /* hp escape sequence state machine */ u_char attribute; /* attribute normal, tx only, local */ u_char key; /* fkey label no */ u_char l_len; /* buffer length's */ @@ -712,7 +657,6 @@ typedef struct video_state { u_char s_buf[MAX_STRING+1]; u_char m_buf[MAX_STATUS+1]; u_char openf; /* we are opened ! */ - u_char vt_pure_mode; /* no fkey labels, row/col, status */ u_char cursor_start; /* Start of cursor */ u_char cursor_end; /* End of cursor */ u_char cursor_on; /* cursor switched on */ @@ -787,17 +731,6 @@ struct vga_char_state { EXTERN struct vga_char_state vgacs[NVGAFONTS]; /* Character set states */ -#if PCVT_EMU_MOUSE -struct mousestat { - struct timeval lastmove; /* last time the pointer moved */ - u_char opened; /* someone would like to use a mouse */ - u_char minor; /* minor device number */ - u_char buttons; /* current "buttons" pressed */ - u_char extendedseen; /* 0xe0 has been seen, do not use next key */ - u_char breakseen; /* key break has been seen for a sticky btn */ -}; -#endif /* PCVT_EMU_MOUSE */ - #ifdef WAS_EXTERN struct vt_softc { @@ -833,11 +766,6 @@ u_short *Crtat; /* screen start address */ u_short *Scrollbuffer; /* scrollback buffer */ u_short scrollback_pages; /* size of scrollback buffer (pages) */ -#if PCVT_EMU_MOUSE -struct mousestat mouse = {{0}}; -struct mousedefs mousedef = {0x3b, 0x3c, 0x3d, 0, 250000}; -#endif /* PCVT_EMU_MOUSE */ /* F1, F2, F3, false, 0.25 sec */ - video_state *vsp = &vs[0]; /* ptr to current screen parms */ int vt_switch_pending = 0; /* if > 0, a vt switch is */ @@ -862,10 +790,6 @@ u_char keyboard_type = KB_UNKNOWN; /* type of keyboard */ u_char keyboard_is_initialized = 0; /* for ddb sanity */ u_char kbd_polling = 0; /* keyboard is being polled */ -#if PCVT_SHOWKEYS -u_char keyboard_show = 0; /* normal display */ -#endif /* PCVT_SHOWKEYS */ - u_char cursor_pos_valid = 0; /* sput left a valid position*/ u_char critical_scroll = 0; /* inside scrolling up */ @@ -961,11 +885,6 @@ extern u_char vga_type; extern struct tty *pcconsp; extern video_state *vsp; -#if PCVT_EMU_MOUSE -extern struct mousestat mouse; -extern struct mousedefs mousedef; -#endif /* PCVT_EMU_MOUSE */ - extern int vt_switch_pending; extern u_int addr_6845; extern u_short *Crtat; @@ -993,10 +912,6 @@ extern u_char kbd_polling; extern u_short *Scrollbuffer; extern u_short scrollback_pages; -#if PCVT_SHOWKEYS -extern u_char keyboard_show; -#endif /* PCVT_SHOWKEYS */ - u_char cursor_pos_valid; u_char critical_scroll; @@ -1033,7 +948,7 @@ int pcopen ( Dev_t dev, int flag, int mode, struct proc *p ); int pcclose ( Dev_t dev, int flag, int mode, struct proc *p ); int pcread ( Dev_t dev, struct uio *uio, int flag ); int pcwrite ( Dev_t dev, struct uio *uio, int flag ); -int pcioctl ( Dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p ); +int pcioctl ( Dev_t dev, int cmd, caddr_t data, int flag, struct proc *p ); int pcmmap ( Dev_t dev, int offset, int nprot ); struct tty * @@ -1049,16 +964,12 @@ void pcstart ( struct tty *tp ); void pcstop ( struct tty *tp, int flag ); void switch_screen ( int n, int oldgrafx, int newgrafx ); -int usl_vt_ioctl (Dev_t dev, u_long cmd,caddr_t data,int flag,struct proc *); +int usl_vt_ioctl (Dev_t dev,int cmd,caddr_t data,int flag,struct proc *); int vt_activate ( int newscreen ); int vgapage ( int n ); void get_usl_keymap( keymap_t *map ); void reset_usl_modes (struct video_state *vsx); -#if PCVT_EMU_MOUSE -int mouse_ioctl ( Dev_t dev, int cmd, caddr_t data ); -#endif /* PCVT_EMU_MOUSE */ - #if PCVT_SCREENSAVER void pcvt_scrnsv_reset ( void ); void pcvt_set_scrnsv_tmo ( int ); @@ -1069,16 +980,12 @@ void clr_parms ( struct video_state *svsp ); void cons_highlight ( void ); void cons_normal ( void ); int egavga_test ( void ); -void fkl_off ( struct video_state *svsp ); -void fkl_on ( struct video_state *svsp ); struct tty *get_pccons ( Dev_t dev ); -void init_sfkl ( struct video_state *svsp ); -void init_ufkl ( struct video_state *svsp ); int kbd_cmd ( int val ); void kbd_code_init ( void ); void kbd_code_init1 ( void ); void kbd_setmode(int mode); -int kbdioctl ( Dev_t dev, u_long cmd, caddr_t data, int flag ); +int kbdioctl ( Dev_t dev, int cmd, caddr_t data, int flag ); void loadchar ( int fontset, int character, int char_scanlines, u_char *char_table ); void mda2egaorvga ( void ); @@ -1086,22 +993,17 @@ void roll_up ( struct video_state *svsp, int n ); void select_vga_charset ( int vga_charset ); void set_2ndcharset ( void ); void set_charset ( struct video_state *svsp, int curvgacs ); -void set_emulation_mode ( struct video_state *svsp, int mode ); void set_screen_size ( struct video_state *svsp, int size ); void reallocate_scrollbuffer ( struct video_state *svsp, int pages ); u_char *sgetc ( int noblock ); void sixel_vga ( struct sixels *charsixel, u_char *charvga ); void sput ( u_char *s, U_char attrib, int len, int page ); void sw_cursor ( int onoff ); -void sw_sfkl ( struct video_state *svsp ); -void sw_ufkl ( struct video_state *svsp ); -void swritefkl ( int num, u_char *string, struct video_state *svsp ); void toggl_awm ( struct video_state *svsp ); void toggl_bell ( struct video_state *svsp ); void toggl_columns ( struct video_state *svsp ); void toggl_dspf ( struct video_state *svsp ); void toggl_sevenbit ( struct video_state *svsp ); -void update_hp ( struct video_state *svsp ); void update_led ( void ); void vga10_vga10 ( u_char *invga, u_char *outvga ); void vga10_vga14 ( u_char *invga, u_char *outvga ); @@ -1114,7 +1016,7 @@ void vga_screen_off ( void ); void vga_screen_on ( void ); char *vga_string ( int number ); int vga_test ( void ); -int vgaioctl ( Dev_t dev, u_long cmd, caddr_t data, int flag ); +int vgaioctl ( Dev_t dev, int cmd, caddr_t data, int flag ); void vgapaletteio ( unsigned idx, struct rgb *val, int writeit ); void vt_aln ( struct video_state *svsp ); void vt_clearudk ( struct video_state *svsp ); diff --git a/sys/arch/i386/isa/pcvt/pcvt_ioctl.h b/sys/arch/i386/isa/pcvt/pcvt_ioctl.h index 68285ba0c3e..05e1c47e5cb 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_ioctl.h +++ b/sys/arch/i386/isa/pcvt/pcvt_ioctl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pcvt_ioctl.h,v 1.12 1999/10/16 18:56:36 aaron Exp $ */ +/* $OpenBSD: pcvt_ioctl.h,v 1.13 1999/11/25 20:24:21 aaron Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -198,21 +198,6 @@ struct kbd_ovlkey /* complete definition of a key */ #define KBDRMKEY _IOW('K',19, int) /* remove a key assignment */ #define KBDDEFAULT _IO('K',20) /* remove all key assignments */ -/* mouse emulator definitions */ - -struct mousedefs { - int leftbutton; /* (PC) scan code for "left button" key */ - int middlebutton; /* (PC) scan code for "mid button" key */ - int rightbutton; /* (PC) scan code for "right button" key */ - int stickybuttons; /* if true, the buttons are "sticky" */ - int acceltime; /* timeout in microseconds to start pointer */ - /* movement acceleration */ - /* defaults to: scan(F1), scan(F2), scan(F3), false, 500000 */ -}; - -#define KBDMOUSEGET _IOR('K', 25, struct mousedefs) /* read defs */ -#define KBDMOUSESET _IOW('K', 26, struct mousedefs) /* set defs */ - /*---------------------------------------------------------------------------* * IOCTLs for Video Adapter *---------------------------------------------------------------------------*/ @@ -455,8 +440,6 @@ struct pcvtinfo { /* compile time option values */ #define CONF_CTRL_ALT_DEL 0x00000008 #define CONF_USEKBDSEC 0x00000010 #define CONF_24LINESDEF 0x00000020 -#define CONF_EMU_MOUSE 0x00000040 -#define CONF_SHOWKEYS 0x00000080 #define CONF_KEYBDID 0x00000100 #define CONF_SIGWINCH 0x00000200 #define CONF_NULLCHARS 0x00000400 diff --git a/sys/arch/i386/isa/pcvt/pcvt_kbd.c b/sys/arch/i386/isa/pcvt/pcvt_kbd.c index 03d2ede8a0e..60a8b8a9200 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_kbd.c +++ b/sys/arch/i386/isa/pcvt/pcvt_kbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcvt_kbd.c,v 1.28 1999/11/20 18:52:00 espie Exp $ */ +/* $OpenBSD: pcvt_kbd.c,v 1.29 1999/11/25 20:24:21 aaron Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -74,7 +74,7 @@ *---------------------------------------------------------------------------*/ #include "vt.h" -#if NVT > 0 +/* #if NVT > 0 */ #include "pcvt_hdr.h" /* global include */ @@ -96,7 +96,6 @@ static inline int kbd_wait_output(void); static inline int kbd_wait_input(void); int kbd_response(void); - static void doreset ( void ); static void ovlinit ( int force ); static void settpmrate ( int rate ); @@ -122,58 +121,20 @@ static void scrollback_restore_screen ( void ); extern int kbd_reset; -#if PCVT_SHOWKEYS -u_char rawkeybuf[80]; -#endif - #include "pcvt_kbd.h" /* tables etc */ -#if PCVT_SHOWKEYS -/*---------------------------------------------------------------------------* - * keyboard debugging: put kbd communication char into some buffer - *---------------------------------------------------------------------------*/ -static void showkey (char delim, u_char val) -{ - int rki; - - for(rki = 3; rki < 80; rki++) /* shift left buffer */ - rawkeybuf[rki-3] = rawkeybuf[rki]; - - rawkeybuf[77] = delim; /* delimiter */ - - rki = (val & 0xf0) >> 4; /* ms nibble */ - - if(rki <= 9) - rki = rki + '0'; - else - rki = rki - 10 + 'A'; - - rawkeybuf[78] = rki; - - rki = val & 0x0f; /* ls nibble */ - - if(rki <= 9) - rki = rki + '0'; - else - rki = rki - 10 + 'A'; - - rawkeybuf[79] = rki; -} -#endif /* PCVT_SHOWKEYS */ - /*---------------------------------------------------------------------------* * function to switch to another virtual screen *---------------------------------------------------------------------------*/ static void do_vgapage(int page) { - if(critical_scroll) /* executing critical region ? */ + if (critical_scroll) /* executing critical region ? */ switch_page = page; /* yes, auto switch later */ else vgapage(page); /* no, switch now */ } - /* * This code from Lon Willett enclosed in #if PCVT_UPDLED_LOSES_INTR is * disabled because it crashes FreeBSD 1.1.5.1 at boot time. @@ -214,11 +175,10 @@ static void check_for_lost_intr (void *arg) { lost_intr_timeout_queued = 0; - if (inb(CONTROLLER_CTRL) & STATUS_OUTPBF) - { - int opri = spltty (); - (void) pcrint (); - splx (opri); + if (inb(CONTROLLER_CTRL) & STATUS_OUTPBF) { + int opri = spltty(); + (void)pcrint(); + splx(opri); } } @@ -230,24 +190,19 @@ check_for_lost_intr (void *arg) void update_led(void) { - #if !PCVT_NO_LED_UPDATE - /* Don't update LED's unless necessary. */ int opri, new_ledstate, response1, response2; opri = spltty(); - new_ledstate = ((vsp->scroll_lock) | - (vsp->num_lock * 2) | + new_ledstate = ((vsp->scroll_lock) | (vsp->num_lock * 2) | (vsp->caps_lock * 4)); - if (new_ledstate != ledstate) - { + if (new_ledstate != ledstate) { ledstate = LEDSTATE_UPDATE_PENDING; - if (kbd_cmd(KEYB_C_LEDS) != 0) - { + if (kbd_cmd(KEYB_C_LEDS) != 0) { printf("Keyboard LED command timeout\n"); splx(opri); return; @@ -315,15 +270,13 @@ settpmrate(int rate) tpmrate = rate & 0x7f; if (kbd_cmd(KEYB_C_TYPEM) != 0) { printf("Keyboard TYPEMATIC command timeout\n"); - splx(opri); - return; + goto fail; } response1 = kbd_response(); /* wait for ACK */ if (kbd_cmd(tpmrate) != 0) { printf("Keyboard TYPEMATIC data timeout\n"); - splx(opri); - return; + goto fail; } response2 = kbd_response(); /* wait for ACK */ @@ -332,7 +285,9 @@ settpmrate(int rate) "Keyboard TYPEMATIC command not ACKed (responses %#x %#x)\n", response1, response2); } +fail: splx(opri); + return; } /*---------------------------------------------------------------------------* @@ -373,7 +328,6 @@ kbd_wait_input() static int kbc_8042cmd(int val) { - if (!kbd_wait_output()) return (-1); outb(CONTROLLER_CTRL, val); @@ -387,15 +341,10 @@ kbc_8042cmd(int val) int kbd_cmd(int val) { - if (!kbd_wait_output()) return (-1); outb(CONTROLLER_DATA, val); -#if PCVT_SHOWKEYS - showkey ('>', val); -#endif /* PCVT_SHOWKEYS */ - return (0); } @@ -412,10 +361,6 @@ kbd_response(void) return (-1); ch = inb(CONTROLLER_DATA); -#if PCVT_SHOWKEYS - showkey ('<', ch); -#endif /* PCVT_SHOWKEYS */ - return ch; } @@ -425,18 +370,15 @@ kbd_response(void) void kbd_setmode(int mode) { -#if PCVT_SCANSET > 1 /* switch only if we are running */ - /* keyboard scancode 2 */ - +#if PCVT_SCANSET > 1 /* switch only if we are running scancode 2 */ int cmd; - #if PCVT_USEKBDSEC - cmd = COMMAND_SYSFLG | COMMAND_IRQEN; + cmd = COMMAND_SYSFLG | COMMAND_IRQEN; #else cmd = COMMAND_INHOVR | COMMAND_SYSFLG | COMMAND_IRQEN; #endif - if(mode == K_RAW) /* switch to scancode 1 ? */ + if (mode == K_RAW) /* switch to scancode 1 ? */ cmd |= COMMAND_PCSCAN; /* yes, setup command */ kbc_8042cmd(CONTR_WRITE); @@ -444,7 +386,7 @@ kbd_setmode(int mode) #endif /* PCVT_SCANSET > 1 */ - if(mode == K_RAW) + if (mode == K_RAW) shift_down = meta_down = altgr_down = ctrl_down = 0; } @@ -465,7 +407,7 @@ void doreset(void) unsigned int wait_retries, seen_negative_response; /* Enable interrupts and keyboard, etc. */ - if(kbc_8042cmd(CONTR_WRITE) != 0) + if (kbc_8042cmd(CONTR_WRITE) != 0) printf("pcvt: doreset() - timeout controller write command\n"); #if PCVT_USEKBDSEC /* security enabled */ @@ -487,7 +429,7 @@ void doreset(void) #endif /* PCVT_USEKBDSEC */ - if(kbd_cmd(KBDINITCMD) != 0) + if (kbd_cmd(KBDINITCMD) != 0) printf("pcvt: doreset() - timeout writing keyboard init command\n"); /* @@ -505,36 +447,30 @@ void doreset(void) } /* Start keyboard reset */ - opri = spltty(); - if(kbd_cmd(KEYB_C_RESET) != 0) - printf("pcvt: doreset() - timeout for keyboard reset command\n"); + if (kbd_cmd(KEYB_C_RESET) != 0) + printf("pcvt: doreset() - keyboard reset command timeout\n"); /* Wait for the first response to reset and handle retries */ - while((response = kbd_response()) != KEYB_R_ACK) - { - if(response < 0) - { - if(!again) /* print message only once ! */ + while ((response = kbd_response()) != KEYB_R_ACK) { + if (response < 0) { + if (!again) /* print message only once ! */ printf("pcvt: doreset() - response != ack and response < 0 [one time only msg]\n"); response = KEYB_R_RESEND; } - if(response == KEYB_R_RESEND) - { - if(!again) /* print message only once ! */ + if (response == KEYB_R_RESEND) { + if (!again) /* print message only once ! */ printf("pcvt: doreset() - got KEYB_R_RESEND response ... [one time only msg]\n"); - if(++again > PCVT_NONRESP_KEYB_TRY) - { + if (++again > PCVT_NONRESP_KEYB_TRY) { printf("pcvt: doreset() - Caution - no PC keyboard detected!\n"); keyboard_type = KB_UNKNOWN; splx(opri); return; } - if((kbd_cmd(KEYB_C_RESET) != 0) && (once == 0)) - { + if ((kbd_cmd(KEYB_C_RESET) != 0) && (once == 0)) { once++; /* print message only once ! */ printf("pcvt: doreset() - timeout for loop keyboard reset command [one time only msg]\n"); } @@ -545,8 +481,7 @@ void doreset(void) wait_retries = seen_negative_response = 0; - while((response = kbd_response()) != KEYB_R_SELFOK) - { + while ((response = kbd_response()) != KEYB_R_SELFOK) { /* * Let's be a little more tolerant here... * Receiving a -1 could indicate that the keyboard @@ -554,11 +489,10 @@ void doreset(void) * Such cases have been noticed with e.g. Alps Membrane. */ - if(response < 0) + if (response < 0) seen_negative_response = 1; - if(seen_negative_response && (wait_retries >= 10)) - { + if (seen_negative_response && (wait_retries >= 10)) { printf("pcvt: doreset() - response != OK and response < 0\n"); /* @@ -581,8 +515,7 @@ void doreset(void) kbc_8042cmd(CONTR_READ); response = kbd_response(); - if (!(response & COMMAND_PCSCAN)) - { + if (!(response & COMMAND_PCSCAN)) { if (kbd_cmd(KEYB_C_SCANSET) != 0) printf("pcvt: doreset() - keyboard SCANSET command timeout\n"); else if (kbd_cmd(1) != 0) @@ -592,7 +525,6 @@ void doreset(void) } #endif - splx(opri); #if PCVT_KEYBDID @@ -601,17 +533,13 @@ query_kbd_id: opri = spltty(); - if(kbd_cmd(KEYB_C_ID) != 0) - { + if (kbd_cmd(KEYB_C_ID) != 0) { printf("pcvt: doreset() - timeout for keyboard ID command\n"); keyboard_type = KB_UNKNOWN; } - else - { - + else { r_entry: - if((response = kbd_response()) == KEYB_R_MF2ID1) - { + if ((response = kbd_response()) == KEYB_R_MF2ID1) { switch ((response = kbd_response())) { case KEYB_R_RESEND: /* @@ -628,34 +556,27 @@ r_entry: case KEYB_R_MF2ID2TP2: keyboard_type = KB_MFII; break; + default: printf("\npcvt: doreset() - kbdid, response 2 = [%d]\n", response); keyboard_type = KB_UNKNOWN; break; } } - else if(response == KEYB_R_ACK) - { + else if (response == KEYB_R_ACK) goto r_entry; - } - else if(response == -1) - { + else if (response == -1) keyboard_type = KB_AT; - } - else - { - printf("\npcvt: doreset() - kbdid, response 1 = [%d]\n", response); + else { + printf("\npcvt: doreset() - kbdid, response 1 = [%d]\n", + response); } } - splx(opri); #else /* PCVT_KEYBDID */ - keyboard_type = KB_MFII; /* force it .. */ - #endif /* PCVT_KEYBDID */ - } /*---------------------------------------------------------------------------* @@ -689,15 +610,13 @@ void ovlinit(int force) { int i; - if(force || ovlinitflag==0) - { - if(ovlinitflag == 0 && + if (force || ovlinitflag == 0) { + if (ovlinitflag == 0 && (ovltbl = (Ovl_tbl *)malloc(sizeof(Ovl_tbl) * OVLTBL_SIZE, M_DEVBUF, M_WAITOK)) == NULL) panic("pcvt_kbd: malloc of Ovl_tbl failed"); - for(i=0; i<OVLTBL_SIZE; i++) - { + for(i = 0; i < OVLTBL_SIZE; i++) { ovltbl[i].keynum = ovltbl[i].type = 0; ovltbl[i].unshift[0] = @@ -721,59 +640,51 @@ void ovlinit(int force) static int getokeydef(unsigned key, Ovl_tbl *thisdef) { - if(key == 0 || key > MAXKEYNUM) + if (key == 0 || key > MAXKEYNUM) return EINVAL; thisdef->keynum = key; thisdef->type = key2ascii[key].type; - if(key2ascii[key].unshift.subtype == STR) - { + if (key2ascii[key].unshift.subtype == STR) { bcopy((u_char *)(key2ascii[key].unshift.what.string), - thisdef->unshift, CODE_SIZE); + thisdef->unshift, CODE_SIZE); thisdef->subu = KBD_SUBT_STR; } - else - { + else { bcopy("", thisdef->unshift, CODE_SIZE); thisdef->subu = KBD_SUBT_FNC; } - if(key2ascii[key].shift.subtype == STR) - { + if (key2ascii[key].shift.subtype == STR) { bcopy((u_char *)(key2ascii[key].shift.what.string), - thisdef->shift, CODE_SIZE); + thisdef->shift, CODE_SIZE); thisdef->subs = KBD_SUBT_STR; } - else - { - bcopy("",thisdef->shift,CODE_SIZE); + else { + bcopy("", thisdef->shift,CODE_SIZE); thisdef->subs = KBD_SUBT_FNC; } - if(key2ascii[key].ctrl.subtype == STR) - { + if (key2ascii[key].ctrl.subtype == STR) { bcopy((u_char *)(key2ascii[key].ctrl.what.string), - thisdef->ctrl, CODE_SIZE); + thisdef->ctrl, CODE_SIZE); thisdef->subc = KBD_SUBT_STR; } - else - { + else { bcopy("",thisdef->ctrl,CODE_SIZE); thisdef->subc = KBD_SUBT_FNC; } /* deliver at least anything for ALTGR settings ... */ - if(key2ascii[key].unshift.subtype == STR) - { + if (key2ascii[key].unshift.subtype == STR) { bcopy((u_char *)(key2ascii[key].unshift.what.string), - thisdef->altgr, CODE_SIZE); + thisdef->altgr, CODE_SIZE); thisdef->suba = KBD_SUBT_STR; } - else - { - bcopy("",thisdef->altgr, CODE_SIZE); + else { + bcopy("", thisdef->altgr, CODE_SIZE); thisdef->suba = KBD_SUBT_FNC; } return 0; @@ -787,10 +698,10 @@ getckeydef(unsigned key, Ovl_tbl *thisdef) { u_short type = key2ascii[key].type; - if(key>MAXKEYNUM) + if (key > MAXKEYNUM) return EINVAL; - if(type & KBD_OVERLOAD) + if (type & KBD_OVERLOAD) *thisdef = ovltbl[key2ascii[key].ovlindex]; else getokeydef(key,thisdef); @@ -805,6 +716,7 @@ getckeydef(unsigned key, Ovl_tbl *thisdef) static u_char * xlatkey2ascii(U_short key) { + int n; static u_char capchar[2] = {0, 0}; #if PCVT_META_ESC static u_char metachar[3] = {0x1b, 0, 0}; @@ -812,26 +724,23 @@ xlatkey2ascii(U_short key) static u_char metachar[2] = {0, 0}; #endif static Ovl_tbl thisdef; - int n; - - static u_char altgr_shft_key[KBDMAXOVLKEYSIZE]; + static u_char altgr_shft_key[KBDMAXOVLKEYSIZE]; void (*fnc)(void); - if(key==0) /* ignore the NON-KEY */ + /* ignore the NON-KEY */ + if (key == 0) return 0; - getckeydef(key&0x7F, &thisdef); /* get the current ASCII value */ + /* get the current ASCII value */ + getckeydef(key & 0x7F, &thisdef); thisdef.type &= KBD_MASK; - if(key&0x80) /* special handling of ALT-KEYPAD */ - { + if (key & 0x80) { /* special handling of ALT-KEYPAD */ /* is the ALT Key released? */ - if(thisdef.type==KBD_META || thisdef.type==KBD_ALTGR) - { - if(altkpflag) /* have we been in altkp mode? */ - { + if (thisdef.type == KBD_META || thisdef.type == KBD_ALTGR) { + if (altkpflag) { /* have we been in altkp mode? */ capchar[0] = altkpval; altkpflag = 0; altkpval = 0; @@ -841,209 +750,182 @@ xlatkey2ascii(U_short key) return 0; } - switch(thisdef.type) /* convert the keys */ - { - case KBD_BREAK: - case KBD_ASCII: - case KBD_FUNC: - fnc = NULL; - more_chars = NULL; - - if(altgr_down) - { - if(shift_down) /* XXX this is hack to support simple - AltGr + Shift remapping. This should work - for KOI-8 keymap style */ - { - altgr_shft_key[0] = *(u_char*)thisdef.altgr+040; - more_chars = (u_char*)altgr_shft_key; - } - else more_chars = (u_char *)thisdef.altgr; - } - else if(!ctrl_down && (shift_down || vsp->shift_lock)) - { - if(key2ascii[key].shift.subtype == STR) - more_chars = (u_char *)thisdef.shift; - else - fnc = key2ascii[key].shift.what.func; - } - - else if(ctrl_down) - { - if(key2ascii[key].ctrl.subtype == STR) - more_chars = (u_char *)thisdef.ctrl; - else - fnc = key2ascii[key].ctrl.what.func; - } + switch (thisdef.type) { /* convert the keys */ + case KBD_BREAK: + case KBD_ASCII: + case KBD_FUNC: + fnc = NULL; + more_chars = NULL; + if (altgr_down) { + /* XXX this is hack to support simple AltGr + Shift + * remapping. This should work for KOI-8 keymap style. + */ + if (shift_down) { + altgr_shft_key[0] = *(u_char*)thisdef.altgr+040; + more_chars = (u_char*)altgr_shft_key; + } + else + more_chars = (u_char *)thisdef.altgr; + } + else if (!ctrl_down && (shift_down || vsp->shift_lock)) { + if (key2ascii[key].shift.subtype == STR) + more_chars = (u_char *)thisdef.shift; else - { - if(key2ascii[key].unshift.subtype == STR) - more_chars = (u_char *)thisdef.unshift; - else - fnc = key2ascii[key].unshift.what.func; - } + fnc = key2ascii[key].shift.what.func; + } + else if (ctrl_down) { + if (key2ascii[key].ctrl.subtype == STR) + more_chars = (u_char *)thisdef.ctrl; + else + fnc = key2ascii[key].ctrl.what.func; + } + else { + if (key2ascii[key].unshift.subtype == STR) + more_chars = (u_char *)thisdef.unshift; + else + fnc = key2ascii[key].unshift.what.func; + } - if(fnc) - (*fnc)(); /* execute function */ + if (fnc) + (*fnc)(); /* execute function */ - if((more_chars != NULL) && (more_chars[1] == 0)) - { - if(vsp->caps_lock && more_chars[0] >= 'a' - && more_chars[0] <= 'z') - { - capchar[0] = *more_chars - ('a'-'A'); - more_chars = capchar; - } - if(meta_down) - { + if ((more_chars != NULL) && (more_chars[1] == 0)) { + if (vsp->caps_lock && more_chars[0] >= 'a' + && more_chars[0] <= 'z') { + capchar[0] = *more_chars - ('a' - 'A'); + more_chars = capchar; + } + if (meta_down) { #if PCVT_META_ESC - metachar[1] = *more_chars; + metachar[1] = *more_chars; #else - metachar[0] = *more_chars | 0x80; + metachar[0] = *more_chars | 0x80; #endif - more_chars = metachar; - } - } - return(more_chars); - - case KBD_KP: - fnc = NULL; - more_chars = NULL; - - if(meta_down) - { - switch(key) - { - case 95: /* / */ - altkpflag = 0; - more_chars = - (u_char *)"\033OQ"; - return(more_chars); - - case 100: /* * */ - altkpflag = 0; - more_chars = - (u_char *)"\033OR"; - return(more_chars); - - case 105: /* - */ - altkpflag = 0; - more_chars = - (u_char *)"\033OS"; - return(more_chars); - } + more_chars = metachar; } + } + return (more_chars); - if(meta_down || altgr_down) - { - if((n = keypad2num[key-91]) >= 0) - { - if(!altkpflag) - { - /* start ALT-KP mode */ - altkpflag = 1; - altkpval = 0; - } - altkpval *= 10; - altkpval += n; - } - else - altkpflag = 0; - return 0; - } + case KBD_KP: + fnc = NULL; + more_chars = NULL; - if(!(vsp->num_lock)) - { - if(key2ascii[key].shift.subtype == STR) - more_chars = (u_char *)thisdef.shift; - else - fnc = key2ascii[key].shift.what.func; - } - else - { - if(key2ascii[key].unshift.subtype == STR) - more_chars = (u_char *)thisdef.unshift; - else - fnc = key2ascii[key].unshift.what.func; - } + if (meta_down) { + switch (key) { + case 95: /* / */ + altkpflag = 0; + more_chars = (u_char *)"\033OQ"; + return (more_chars); - if(fnc) - (*fnc)(); /* execute function */ - return(more_chars); + case 100: /* * */ + altkpflag = 0; + more_chars = (u_char *)"\033OR"; + return (more_chars); - case KBD_CURSOR: - fnc = NULL; - more_chars = NULL; + case 105: /* - */ + altkpflag = 0; + more_chars = (u_char *)"\033OS"; + return (more_chars); + } + } - if(vsp->ckm) - { - if(key2ascii[key].shift.subtype == STR) - more_chars = (u_char *)thisdef.shift; - else - fnc = key2ascii[key].shift.what.func; + if (meta_down || altgr_down) { + if ((n = keypad2num[key-91]) >= 0) { + if (!altkpflag) { + /* start ALT-KP mode */ + altkpflag = 1; + altkpval = 0; + } + altkpval *= 10; + altkpval += n; } else - { - if(key2ascii[key].unshift.subtype == STR) - more_chars = (u_char *)thisdef.unshift; - else - fnc = key2ascii[key].unshift.what.func; - } + altkpflag = 0; + return 0; + } - if(fnc) - (*fnc)(); /* execute function */ - return(more_chars); + if (!vsp->num_lock) { + if (key2ascii[key].shift.subtype == STR) + more_chars = (u_char *)thisdef.shift; + else + fnc = key2ascii[key].shift.what.func; + } + else { + if (key2ascii[key].unshift.subtype == STR) + more_chars = (u_char *)thisdef.unshift; + else + fnc = key2ascii[key].unshift.what.func; + } - case KBD_NUM: /* special kp-num handling */ - more_chars = NULL; + if (fnc) + (*fnc)(); /* execute function */ - if(meta_down) - { - more_chars = (u_char *)"\033OP"; /* PF1 */ - } - else - { - vsp->num_lock ^= 1; - update_led(); - } - return(more_chars); + return (more_chars); - case KBD_RETURN: - more_chars = NULL; + case KBD_CURSOR: + fnc = NULL; + more_chars = NULL; - if(!(vsp->num_lock)) - { + if (vsp->ckm) { + if (key2ascii[key].shift.subtype == STR) more_chars = (u_char *)thisdef.shift; - } else - { + fnc = key2ascii[key].shift.what.func; + } + else { + if (key2ascii[key].unshift.subtype == STR) more_chars = (u_char *)thisdef.unshift; - } - if(vsp->lnm && (*more_chars == '\r')) - { - more_chars = (u_char *)"\r\n"; /* CR LF */ - } - if(meta_down) - { + else + fnc = key2ascii[key].unshift.what.func; + } + + if (fnc) + (*fnc)(); /* execute function */ + + return (more_chars); + + case KBD_NUM: /* special kp-num handling */ + more_chars = NULL; + + if (meta_down) + more_chars = (u_char *)"\033OP"; /* PF1 */ + else { + vsp->num_lock ^= 1; + update_led(); + } + return (more_chars); + + case KBD_RETURN: + more_chars = NULL; + + if (!vsp->num_lock) + more_chars = (u_char *)thisdef.shift; + else + more_chars = (u_char *)thisdef.unshift; + + if (vsp->lnm && (*more_chars == '\r')) + more_chars = (u_char *)"\r\n"; /* CR LF */ + + if (meta_down) { #if PCVT_META_ESC - metachar[1] = *more_chars; + metachar[1] = *more_chars; #else - metachar[0] = *more_chars | 0x80; + metachar[0] = *more_chars | 0x80; #endif - more_chars = metachar; - } - return(more_chars); - - case KBD_META: /* these keys are */ - case KBD_ALTGR: /* handled directly */ - case KBD_SCROLL: /* by the keyboard */ - case KBD_CAPS: /* handler - they are */ - case KBD_SHFTLOCK: /* ignored here */ - case KBD_CTL: - case KBD_NONE: - default: - return 0; + more_chars = metachar; + } + return (more_chars); + + case KBD_META: /* these keys are */ + case KBD_ALTGR: /* handled directly */ + case KBD_SCROLL: /* by the keyboard */ + case KBD_CAPS: /* handler - they are */ + case KBD_SHFTLOCK: /* ignored here */ + case KBD_CTL: + case KBD_NONE: + default: + return 0; } } @@ -1062,19 +944,17 @@ extern short pcvt_kbd_count; u_char * sgetc(int noblock) { - u_char *cp; - u_char dt; - u_char key; - u_short type; - #if PCVT_KBD_FIFO int s; #endif + u_char *cp, dt, key; + u_short type; + static u_char kbd_lastkey = 0; /* last keystroke */ +#ifdef XSERVER + static char keybuf[2] = {0}; /* the second 0 is a delimiter! */ +#endif /* XSERVER */ - static u_char kbd_lastkey = 0; /* last keystroke */ - - static struct - { + static struct { u_char extended: 1; /* extended prefix seen */ u_char ext1: 1; /* extended prefix 1 seen */ u_char breakseen: 1; /* break code seen */ @@ -1083,10 +963,6 @@ sgetc(int noblock) u_char sysrq: 1; /* sysrq pressed */ } kbd_status = {0}; -#ifdef XSERVER - static char keybuf[2] = {0}; /* the second 0 is a delimiter! */ -#endif /* XSERVER */ - loop: #ifdef XSERVER @@ -1102,15 +978,12 @@ loop: /* the keyboard fifo or from the 8042 keyboard controller */ if ((( noblock) && (pcvt_kbd_count)) || - ((!noblock) && (inb(CONTROLLER_CTRL) & STATUS_OUTPBF))) - { - if (!noblock) /* source = 8042 */ - { + ((!noblock) && (inb(CONTROLLER_CTRL) & STATUS_OUTPBF))) { + if (!noblock) { /* source = 8042 */ PCVT_KBD_DELAY(); /* 7 us delay */ dt = inb(CONTROLLER_DATA); /* get from obuf */ } - else /* source = keyboard fifo */ - { + else { /* source = keyboard fifo */ dt = pcvt_kbd_fifo[pcvt_kbd_rptr++]; s = spltty(); pcvt_kbd_count--; @@ -1122,12 +995,9 @@ loop: #else /* !PCVT_KB_FIFO */ /* see if there is data from the keyboard available from the 8042 */ - - if (inb(CONTROLLER_CTRL) & STATUS_OUTPBF) - { + if (inb(CONTROLLER_CTRL) & STATUS_OUTPBF) { PCVT_KBD_DELAY(); /* 7 us delay */ dt = inb(CONTROLLER_DATA); /* yes, get data */ - #endif /* !PCVT_KBD_FIFO */ /* @@ -1137,238 +1007,8 @@ loop: * execute pcvt internal functions caused by keys (such * as screen flipping). */ - - if (vsp->kbd_state == K_RAW) - { + if (vsp->kbd_state == K_RAW) { keybuf[0] = dt; - -#if PCVT_EMU_MOUSE - /* - * The (mouse systems) mouse emulator. The mouse - * device allocates the first device node that is - * not used by a virtual terminal. (E.g., you have - * eight vtys, /dev/ttyv0 thru /dev/ttyv7, so the - * mouse emulator were /dev/ttyv8.) - * Currently the emulator only works if the keyboard - * is in raw (PC scan code) mode. This is the typic- - * al case when running the X server. - * It is activated if the num locks LED is active - * for the current vty, and if the mouse device - * has been opened by at least one process. It - * grabs the numerical keypad events (but only - * the "non-extended", so the separate arrow keys - * continue to work), and three keys for the "mouse - * buttons", preferrably F1 thru F3. Any of the - * eight directions (N, NE, E, SE, S, SW, W, NW) - * is supported, and frequent key presses (less - * than e.g. half a second between key presses) - * cause the emulator to accelerate the pointer - * movement by 6, while single presses result in - * single moves, so each point can be reached. - */ - /* - * NB: the following code is spagghetti. - * Only eat it with lotta tomato ketchup and - * Parmesan cheese:-) - */ - /* - * look whether we will have to steal the keys - * and cook them into mouse events - */ - if(vsp->num_lock && mouse.opened) - { - int button, accel, i; - enum mouse_dir - { - MOUSE_NW, MOUSE_N, MOUSE_NE, - MOUSE_W, MOUSE_0, MOUSE_E, - MOUSE_SW, MOUSE_S, MOUSE_SE - } - move; - struct timeval now; - /* from sys/kern/kern_time.c */ - extern void timevalsub - (struct timeval *, struct timeval *); - dev_t dummy = makedev(0, mouse.minor); - struct tty *mousetty = get_pccons(dummy); - /* - * strings to send for each mouse event, - * indexed by the movement direction and - * the "accelerator" value (TRUE for frequent - * key presses); note that the first byte - * of each string is actually overwritten - * by the current button value before sending - * the string - */ - static u_char mousestrings[2][MOUSE_SE+1][5] = - { - { - /* first, the non-accelerated strings*/ - {0x87, -1, 1, 0, 0}, /* NW */ - {0x87, 0, 1, 0, 0}, /* N */ - {0x87, 1, 1, 0, 0}, /* NE */ - {0x87, -1, 0, 0, 0}, /* W */ - {0x87, 0, 0, 0, 0}, /* 0 */ - {0x87, 1, 0, 0, 0}, /* E */ - {0x87, -1, -1, 0, 0}, /* SW */ - {0x87, 0, -1, 0, 0}, /* S */ - {0x87, 1, -1, 0, 0} /* SE */ - }, - { - /* now, 6 steps at once */ - {0x87, -4, 4, 0, 0}, /* NW */ - {0x87, 0, 6, 0, 0}, /* N */ - {0x87, 4, 4, 0, 0}, /* NE */ - {0x87, -6, 0, 0, 0}, /* W */ - {0x87, 0, 0, 0, 0}, /* 0 */ - {0x87, 6, 0, 0, 0}, /* E */ - {0x87, -4, -4, 0, 0}, /* SW */ - {0x87, 0, -6, 0, 0}, /* S */ - {0x87, 4, -4, 0, 0} /* SE */ - } - }; - - if(dt == 0xe0) - { - /* ignore extended scan codes */ - mouse.extendedseen = 1; - goto no_mouse_event; - } - if(mouse.extendedseen) - { - mouse.extendedseen = 0; - goto no_mouse_event; - } - mouse.extendedseen = 0; - - /* - * Note that we cannot use a switch here - * since we want to have the keycodes in - * a variable - */ - if((dt & 0x7f) == mousedef.leftbutton) { - button = 4; - goto do_button; - } - else if((dt & 0x7f) == mousedef.middlebutton) { - button = 2; - goto do_button; - } - else if((dt & 0x7f) == mousedef.rightbutton) { - button = 1; - do_button: - - /* - * i would really like to give - * some acustical support - * (pling/plong); i am not sure - * whether it is safe to call - * sysbeep from within an intr - * service, since it calls - * timeout in turn which mani- - * pulates the spl mask - jw - */ - -# define PLING sysbeep(PCVT_SYSBEEPF / 1500, 2) -# define PLONG sysbeep(PCVT_SYSBEEPF / 1200, 2) - - if(mousedef.stickybuttons) - { - if(dt & 0x80) { - mouse.breakseen = 1; - return (u_char *)0; - } - else if(mouse.buttons == button - && !mouse.breakseen) { - /* ignore repeats */ - return (u_char *)0; - } - else - mouse.breakseen = 0; - if(mouse.buttons == button) { - /* release it */ - mouse.buttons = 0; - PLONG; - } else { - /* - * eventually, release - * any other button, - * and stick this one - */ - mouse.buttons = button; - PLING; - } - } - else - { - if(dt & 0x80) { - mouse.buttons &= - ~button; - PLONG; - } - else if((mouse.buttons - & button) == 0) { - mouse.buttons |= - button; - PLING; - } - /*else: ignore same btn press*/ - } - move = MOUSE_0; - accel = 0; - } -# undef PLING -# undef PLONG - else switch(dt & 0x7f) - { - /* the arrow keys - KP 1 thru KP 9 */ - case 0x47: move = MOUSE_NW; goto do_move; - case 0x48: move = MOUSE_N; goto do_move; - case 0x49: move = MOUSE_NE; goto do_move; - case 0x4b: move = MOUSE_W; goto do_move; - case 0x4c: move = MOUSE_0; goto do_move; - case 0x4d: move = MOUSE_E; goto do_move; - case 0x4f: move = MOUSE_SW; goto do_move; - case 0x50: move = MOUSE_S; goto do_move; - case 0x51: move = MOUSE_SE; - do_move: - if(dt & 0x80) - /* - * arrow key break events are - * of no importance for us - */ - return (u_char *)0; - /* - * see whether the last move did - * happen "recently", i.e. before - * less than half a second - */ - now = time; - - timersub(&now,&mouse.lastmove,&now); - - mouse.lastmove = time; - accel = (now.tv_sec == 0 - && now.tv_usec - < mousedef.acceltime); - break; - - default: /* not a mouse-emulating key */ - goto no_mouse_event; - } - mousestrings[accel][move][0] = - 0x80 + (~mouse.buttons & 7); - /* finally, send the string */ - for(i = 0; i < 5; i++) - (*linesw[mousetty->t_line].l_rint) - (mousestrings[accel][move][i], - mousetty); - return (u_char *)0; /* not a kbd event */ - } -no_mouse_event: - -#endif /* PCVT_EMU_MOUSE */ - return ((u_char *)keybuf); } } @@ -1381,15 +1021,12 @@ no_mouse_event: /* the keyboard fifo or from the 8042 keyboard controller */ if ((( noblock) && (pcvt_kbd_count)) || - ((!noblock) && (inb(CONTROLLER_CTRL) & STATUS_OUTPBF))) - { - if (!noblock) /* source = 8042 */ - { + ((!noblock) && (inb(CONTROLLER_CTRL) & STATUS_OUTPBF))) { + if (!noblock) { /* source = 8042 */ PCVT_KBD_DELAY(); /* 7 us delay */ dt = inb(CONTROLLER_DATA); } - else /* source = keyboard fifo */ - { + else { /* source = keyboard fifo */ dt = pcvt_kbd_fifo[pcvt_kbd_rptr++]; /* yes, get it ! */ s = spltty(); pcvt_kbd_count--; @@ -1402,9 +1039,7 @@ no_mouse_event: #else /* !PCVT_KBD_FIFO */ /* see if there is data from the keyboard available from the 8042 */ - - if(inb(CONTROLLER_CTRL) & STATUS_OUTPBF) - { + if (inb(CONTROLLER_CTRL) & STATUS_OUTPBF) { PCVT_KBD_DELAY(); /* 7 us delay */ dt = inb(CONTROLLER_DATA); /* yes, get data ! */ } @@ -1413,89 +1048,77 @@ no_mouse_event: #endif /* !XSERVER */ - else - { - if(noblock) + else { + if (noblock) return NULL; else goto loop; } -#if PCVT_SHOWKEYS - showkey (' ', dt); -#endif /* PCVT_SHOWKEYS */ - /* lets look what we got */ - switch(dt) - { - case KEYB_R_OVERRUN0: /* keyboard buffer overflow */ - + switch (dt) { + case KEYB_R_OVERRUN0: /* keyboard buffer overflow */ #if PCVT_SCANSET == 2 - case KEYB_R_SELFOK: /* keyboard selftest ok */ + case KEYB_R_SELFOK: /* keyboard selftest ok */ #endif /* PCVT_SCANSET == 2 */ - - case KEYB_R_ECHO: /* keyboard response to KEYB_C_ECHO */ - case KEYB_R_ACK: /* acknowledge after command has rx'd*/ - case KEYB_R_SELFBAD: /* keyboard selftest FAILED */ - case KEYB_R_DIAGBAD: /* keyboard self diagnostic failure */ - case KEYB_R_RESEND: /* keyboard wants us to resend cmnd */ - case KEYB_R_OVERRUN1: /* keyboard buffer overflow */ - break; - - case KEYB_R_EXT1: /* keyboard extended scancode pfx 2 */ - kbd_status.ext1 = 1; - /* FALLTHROUGH */ - case KEYB_R_EXT0: /* keyboard extended scancode pfx 1 */ - kbd_status.extended = 1; - break; + case KEYB_R_ECHO: /* keyboard response to KEYB_C_ECHO */ + case KEYB_R_ACK: /* acknowledge after command has rx'd*/ + case KEYB_R_SELFBAD: /* keyboard selftest FAILED */ + case KEYB_R_DIAGBAD: /* keyboard self diagnostic failure */ + case KEYB_R_RESEND: /* keyboard wants us to resend cmnd */ + case KEYB_R_OVERRUN1: /* keyboard buffer overflow */ + break; + + case KEYB_R_EXT1: /* keyboard extended scancode pfx 2 */ + kbd_status.ext1 = 1; + /* FALLTHROUGH */ + + case KEYB_R_EXT0: /* keyboard extended scancode pfx 1 */ + kbd_status.extended = 1; + break; #if PCVT_SCANSET == 2 - case KEYB_R_BREAKPFX: /* break code prefix for set 2 and 3 */ - kbd_status.breakseen = 1; - break; + case KEYB_R_BREAKPFX: /* break code prefix for set 2 and 3 */ + kbd_status.breakseen = 1; + break; #endif /* PCVT_SCANSET == 2 */ - default: - goto regular; /* regular key */ + default: + goto regular; /* regular key */ } - if(noblock) + if (noblock) return NULL; else goto loop; /* got a normal scan key */ regular: - #if PCVT_SCANSET == 1 kbd_status.breakseen = dt & 0x80 ? 1 : 0; dt &= 0x7f; #endif /* PCVT_SCANSET == 1 */ /* make a keycode from scan code */ - if(dt >= sizeof scantokey / sizeof(u_char)) + if (dt >= sizeof scantokey / sizeof(u_char)) key = 0; else key = kbd_status.extended ? extscantokey[dt] : scantokey[dt]; - if(kbd_status.ext1 && key == 64) + if (kbd_status.ext1 && key == 64) /* virtual control key */ key = 129; kbd_status.extended = kbd_status.ext1 = 0; - if ((key == 85) && shift_down && kbd_lastkey != 85) - { - if (vsp->scr_offset > vsp->row) - { - if (!vsp->scrolling) - { + if ((key == 85) && shift_down && + (kbd_lastkey != 85 || !kbd_status.breakseen)) { + if (vsp->scr_offset > vsp->row) { + if (!vsp->scrolling) { vsp->scrolling += vsp->row - 1; - if (vsp->Scrollback) - { + if (vsp->Scrollback) { scrollback_save_screen(); - if (vsp->scr_offset == vsp->max_off) - { + if (vsp->scr_offset == vsp->max_off) { bcopy(vsp->Scrollback + vsp->maxcol, vsp->Scrollback, @@ -1525,22 +1148,19 @@ regular: kbd_lastkey = 85; goto loop; } - else if ((key == 86) && shift_down && kbd_lastkey != 86) - { + else if ((key == 86) && shift_down && + (kbd_lastkey != 86 || !kbd_status.breakseen)) { scroll_reset: - if (vsp->scrolling > 0) - { + if (vsp->scrolling > 0) { vsp->scrolling -= vsp->screen_rows - 1; if (vsp->scrolling < 0) vsp->scrolling = 0; - if (vsp->scrolling <= vsp->row) - { + if (vsp->scrolling <= vsp->row) { vsp->scrolling = 0; scrollback_restore_screen(); } - else - { + else { if (vsp->scrolling + 2 < vsp->screen_rows) fillw(user_attr | ' ', (caddr_t)vsp->Crtat, @@ -1554,12 +1174,9 @@ scroll_reset: } } - if (vsp->scrolling == 0) - { + if (vsp->scrolling == 0) { if (vsp->cursor_on) - { sw_cursor(1); - } } if (noblock == 31337) @@ -1567,38 +1184,34 @@ scroll_reset: if (key != 86) goto regular; - else - { + else { kbd_lastkey = 86; goto loop; } } else if (vsp->scrolling && key != 128 && key != 44 && key != 85 && - key != 86) - { + key != 86) { vsp->scrolling = 1; goto scroll_reset; } - if(kbd_reset && (key == 76) && ctrl_down && (meta_down||altgr_down)) { + if (kbd_reset && (key == 76) && ctrl_down && (meta_down||altgr_down)) { printf("\nconsole halt requested: going down.\n"); kbd_reset = 0; psignal(initproc, SIGUSR1); } #if NDDB > 0 || defined(DDB) /* Check for cntl-alt-esc */ - - if((key == 110) && ctrl_down && (meta_down || altgr_down)) - { + if ((key == 110) && ctrl_down && (meta_down || altgr_down)) { static u_char in_Debugger; - if(!in_Debugger) - { + if (!in_Debugger) { in_Debugger = 1; if (db_console) Debugger(); in_Debugger = 0; - if(noblock) + + if (noblock) return NULL; else goto loop; @@ -1607,8 +1220,7 @@ scroll_reset: #endif /* NDDB > 0 || defined(DDB) */ /* look for keys with special handling */ - if(key == 128) - { + if (key == 128) { /* * virtual shift; sent around PrtScr, and around the arrow * keys if the NumLck LED is on @@ -1616,33 +1228,30 @@ scroll_reset: kbd_status.vshift = !kbd_status.breakseen; key = 0; /* no key */ } - else if(key == 129) - { + else if (key == 129) { /* * virtual control - the most ugly thingie at all * the Pause key sends: * <virtual control make> <numlock make> <virtual control * break> <numlock break> */ - if(!kbd_status.breakseen) + if (!kbd_status.breakseen) kbd_status.vcontrol = 1; /* else: let the numlock hook clear this */ key = 0; /* no key */ } - else if(key == 90) - { + else if (key == 90) { /* NumLock, look whether this is rather a Pause */ - if(kbd_status.vcontrol) + if (kbd_status.vcontrol) key = 126; /* * if this is the final break code of a Pause key, * clear the virtual control status, too */ - if(kbd_status.vcontrol && kbd_status.breakseen) + if (kbd_status.vcontrol && kbd_status.breakseen) kbd_status.vcontrol = 0; } - else if(key == 127) - { + else if (key == 127) { /* * a SysRq; some keyboards are brain-dead enough to * repeat the SysRq key make code by sending PrtScr @@ -1651,22 +1260,20 @@ scroll_reset: */ kbd_status.sysrq = !kbd_status.breakseen; } - else if(key == 124) - { + else if (key == 124) { /* * PrtScr; look whether this is really PrtScr or rather * a silly repeat of a SysRq key */ - if(kbd_status.sysrq) + if (kbd_status.sysrq) /* ignore the garbage */ key = 0; } /* in NOREPEAT MODE ignore the key if it was the same as before */ - if(!kbrepflag && key == kbd_lastkey && !kbd_status.breakseen) - { - if(noblock) + if (!kbrepflag && key == kbd_lastkey && !kbd_status.breakseen) { + if (noblock) return NULL; else goto loop; @@ -1674,65 +1281,56 @@ scroll_reset: type = key2ascii[key].type; - if(type & KBD_OVERLOAD) + if (type & KBD_OVERLOAD) type = ovltbl[key2ascii[key].ovlindex].type; type &= KBD_MASK; - switch(type) - { - case KBD_SHFTLOCK: - if(!kbd_status.breakseen && key != kbd_lastkey) - { - vsp->shift_lock ^= 1; - } - break; + switch (type) { + case KBD_SHFTLOCK: + if (!kbd_status.breakseen && key != kbd_lastkey) + vsp->shift_lock ^= 1; + break; - case KBD_CAPS: - if(!kbd_status.breakseen && key != kbd_lastkey) - { - vsp->caps_lock ^= 1; - update_led(); - } - break; + case KBD_CAPS: + if (!kbd_status.breakseen && key != kbd_lastkey) { + vsp->caps_lock ^= 1; + update_led(); + } + break; - case KBD_SCROLL: - if(!kbd_status.breakseen && key != kbd_lastkey) - { - vsp->scroll_lock ^= 1; - update_led(); - - if(!(vsp->scroll_lock)) - { - /* someone may be sleeping */ - wakeup((caddr_t)&(vsp->scroll_lock)); - } - } - break; + case KBD_SCROLL: + if (!kbd_status.breakseen && key != kbd_lastkey) { + vsp->scroll_lock ^= 1; + update_led(); - case KBD_SHIFT: - shift_down = kbd_status.breakseen ? 0 : 1; - break; + if (!(vsp->scroll_lock)) + wakeup((caddr_t)&(vsp->scroll_lock)); + } + break; - case KBD_META: - meta_down = kbd_status.breakseen ? 0 : 0x80; - break; + case KBD_SHIFT: + shift_down = kbd_status.breakseen ? 0 : 1; + break; - case KBD_ALTGR: - altgr_down = kbd_status.breakseen ? 0 : 1; - break; + case KBD_META: + meta_down = kbd_status.breakseen ? 0 : 0x80; + break; - case KBD_CTL: - ctrl_down = kbd_status.breakseen ? 0 : 1; - break; + case KBD_ALTGR: + altgr_down = kbd_status.breakseen ? 0 : 1; + break; - case KBD_NONE: - default: - break; /* deliver a key */ + case KBD_CTL: + ctrl_down = kbd_status.breakseen ? 0 : 1; + break; + + case KBD_NONE: + default: + break; /* deliver a key */ } - if(kbd_status.breakseen) - { + if (kbd_status.breakseen) { key |= 0x80; kbd_status.breakseen = 0; kbd_lastkey = 0; /* -hv- I know this is a bug with */ @@ -1742,7 +1340,7 @@ scroll_reset: cp = xlatkey2ascii(key); /* have a key */ - if(cp == NULL && !noblock) + if (cp == NULL && !noblock) goto loop; return cp; @@ -1768,11 +1366,10 @@ rmkeydef(int key) { register Ovl_tbl *ref; - if(key==0 || key > MAXKEYNUM) + if (key == 0 || key > MAXKEYNUM) return EINVAL; - if(key2ascii[key].type & KBD_OVERLOAD) - { + if (key2ascii[key].type & KBD_OVERLOAD) { ref = &ovltbl[key2ascii[key].ovlindex]; ref->keynum = 0; ref->type = 0; @@ -1793,7 +1390,7 @@ setkeydef(Ovl_tbl *data) { int i; - if( data->keynum > MAXKEYNUM || + if ( data->keynum > MAXKEYNUM || (data->type & KBD_MASK) == KBD_BREAK || (data->type & KBD_MASK) > KBD_SHFTLOCK) return EINVAL; @@ -1812,17 +1409,14 @@ setkeydef(Ovl_tbl *data) /* if key already overloaded, use that slot else find free slot */ - if(key2ascii[data->keynum].type & KBD_OVERLOAD) - { + if (key2ascii[data->keynum].type & KBD_OVERLOAD) i = key2ascii[data->keynum].ovlindex; - } - else - { - for(i=0; i<OVLTBL_SIZE; i++) - if(ovltbl[i].keynum==0) + else { + for (i = 0; i < OVLTBL_SIZE; i++) + if (ovltbl[i].keynum==0) break; - if(i==OVLTBL_SIZE) + if (i == OVLTBL_SIZE) return ENOSPC; /* no space, abuse of ENOSPC(!) */ } @@ -1838,105 +1432,77 @@ setkeydef(Ovl_tbl *data) * keyboard ioctl's entry *---------------------------------------------------------------------------*/ int -kbdioctl(Dev_t dev, u_long cmd, caddr_t data, int flag) +kbdioctl(Dev_t dev, int cmd, caddr_t data, int flag) { int key; - switch(cmd) - { - case KBDRESET: - doreset(); - ovlinit(1); - settpmrate(KBD_TPD500|KBD_TPM100); - setlockkeys(0); - break; + switch (cmd) { + case KBDRESET: + doreset(); + ovlinit(1); + settpmrate(KBD_TPD500 | KBD_TPM100); + setlockkeys(0); + break; - case KBDGTPMAT: - *(int *)data = tpmrate; - break; + case KBDGTPMAT: + *(int *)data = tpmrate; + break; - case KBDSTPMAT: - settpmrate(*(int *)data); - break; + case KBDSTPMAT: + settpmrate(*(int *)data); + break; - case KBDGREPSW: - *(int *)data = kbrepflag; - break; + case KBDGREPSW: + *(int *)data = kbrepflag; + break; - case KBDSREPSW: - kbrepflag = (*(int *)data) & 1; - break; + case KBDSREPSW: + kbrepflag = (*(int *)data) & 1; + break; - case KBDGLOCK: - *(int *)data = ( (vsp->scroll_lock) | - (vsp->num_lock * 2) | - (vsp->caps_lock * 4)); - break; + case KBDGLOCK: + *(int *)data = ( (vsp->scroll_lock) | (vsp->num_lock * 2) | + (vsp->caps_lock * 4)); + break; - case KBDSLOCK: - setlockkeys(*(int *)data); - break; + case KBDSLOCK: + setlockkeys(*(int *)data); + break; - case KBDGCKEY: - key = ((Ovl_tbl *)data)->keynum; - return getckeydef(key,(Ovl_tbl *)data); + case KBDGCKEY: + key = ((Ovl_tbl *)data)->keynum; + return getckeydef(key,(Ovl_tbl *)data); - case KBDSCKEY: - key = ((Ovl_tbl *)data)->keynum; - return setkeydef((Ovl_tbl *)data); + case KBDSCKEY: + key = ((Ovl_tbl *)data)->keynum; + return setkeydef((Ovl_tbl *)data); - case KBDGOKEY: - key = ((Ovl_tbl *)data)->keynum; - return getokeydef(key,(Ovl_tbl *)data); + case KBDGOKEY: + key = ((Ovl_tbl *)data)->keynum; + return getokeydef(key,(Ovl_tbl *)data); - case KBDRMKEY: - key = *(int *)data; - return rmkeydef(key); + case KBDRMKEY: + key = *(int *)data; + return rmkeydef(key); - case KBDDEFAULT: - ovlinit(1); - break; + case KBDDEFAULT: + ovlinit(1); + break; - default: - /* proceed with vga ioctls */ - return -1; + default: + /* proceed with vga ioctls */ + return -1; } return 0; } -#if PCVT_EMU_MOUSE -/*--------------------------------------------------------------------------* - * mouse emulator ioctl - *--------------------------------------------------------------------------*/ -int -mouse_ioctl(Dev_t dev, int cmd, caddr_t data) -{ - struct mousedefs *def = (struct mousedefs *)data; - - switch(cmd) - { - case KBDMOUSEGET: - *def = mousedef; - break; - - case KBDMOUSESET: - mousedef = *def; - break; - - default: - return -1; - } - return 0; -} -#endif /* PCVT_EMU_MOUSE */ - /*---------------------------------------------------------------------------* * convert ISO-8859 style keycode into IBM 437 *---------------------------------------------------------------------------*/ static inline u_char iso2ibm(u_char c) { - if(c < 0x80) + if (c < 0x80) return c; return iso2ibm437[c - 0x80]; } @@ -1953,20 +1519,19 @@ get_usl_keymap(keymap_t *map) map->n_keys = 0x59; /* that many keys we know about */ - for(i = 1; i < N_KEYNUMS; i++) - { + for(i = 1; i < N_KEYNUMS; i++) { Ovl_tbl kdef; u_char c; int j; int idx = key2scan1[i]; - if(idx == 0 || idx >= map->n_keys) + if (idx == 0 || idx >= map->n_keys) continue; getckeydef(i, &kdef); kdef.type &= KBD_MASK; - switch(kdef.type) - { + + switch (kdef.type) { case KBD_ASCII: case KBD_RETURN: map->key[idx].map[0] = iso2ibm(kdef.unshift[0]); @@ -1983,35 +1548,41 @@ get_usl_keymap(keymap_t *map) * this should at least work for ISO8859 letters, * but also for (e.g.) russian KOI-8 style */ - if((c & 0x7f) >= 0x40) + if ((c & 0x7f) >= 0x40) map->key[idx].map[5] = iso2ibm(c ^ 0x20); break; case KBD_FUNC: /* we are only interested in F1 thru F12 here */ - if(i >= 112 && i <= 123) { + if (i >= 112 && i <= 123) { map->key[idx].map[0] = i - 112 + 27; map->key[idx].spcl = 0x80; } break; case KBD_SHIFT: - c = i == 44? 2 /* lSh */: 3 /* rSh */; goto special; + c = i == 44 ? 2 /* lSh */ : 3 /* rSh */; + goto special; case KBD_CAPS: - c = 4; goto special; + c = 4; + goto special; case KBD_NUM: - c = 5; goto special; + c = 5; + goto special; case KBD_SCROLL: - c = 6; goto special; + c = 6; + goto special; case KBD_META: - c = 7; goto special; + c = 7; + goto special; case KBD_CTL: - c = 9; goto special; + c = 9; + goto special; special: for(j = 0; j < NUM_STATES; j++) map->key[idx].map[j] = c; @@ -2052,20 +1623,10 @@ vt_keyappl(struct video_state *svsp) static void fkey1(void) { - if(!meta_down) - { - if((vsp->vt_pure_mode == M_HPVT) - && (vsp->which_fkl == SYS_FKL)) - toggl_columns(vsp); - else - more_chars = (u_char *)"\033[17~"; /* F6 */ - } + if (!meta_down) + more_chars = (u_char *)"\033[17~"; /* F6 */ else - { - if(vsp->vt_pure_mode == M_PUREVT - || (vsp->which_fkl == USR_FKL)) - more_chars = (u_char *)"\033[26~"; /* F14 */ - } + more_chars = (u_char *)"\033[26~"; /* F14 */ } /*---------------------------------------------------------------------------* @@ -2074,20 +1635,10 @@ fkey1(void) static void fkey2(void) { - if(!meta_down) - { - if((vsp->vt_pure_mode == M_HPVT) - && (vsp->which_fkl == SYS_FKL)) - vt_ris(vsp); - else - more_chars = (u_char *)"\033[18~"; /* F7 */ - } + if (!meta_down) + more_chars = (u_char *)"\033[18~"; /* F7 */ else - { - if(vsp->vt_pure_mode == M_PUREVT - || (vsp->which_fkl == USR_FKL)) - more_chars = (u_char *)"\033[28~"; /* HELP */ - } + more_chars = (u_char *)"\033[28~"; /* HELP */ } /*---------------------------------------------------------------------------* @@ -2096,20 +1647,10 @@ fkey2(void) static void fkey3(void) { - if(!meta_down) - { - if((vsp->vt_pure_mode == M_HPVT) - && (vsp->which_fkl == SYS_FKL)) - toggl_24l(vsp); - else - more_chars = (u_char *)"\033[19~"; /* F8 */ - } + if (!meta_down) + more_chars = (u_char *)"\033[19~"; /* F8 */ else - { - if(vsp->vt_pure_mode == M_PUREVT - || (vsp->which_fkl == USR_FKL)) - more_chars = (u_char *)"\033[29~"; /* DO */ - } + more_chars = (u_char *)"\033[29~"; /* DO */ } /*---------------------------------------------------------------------------* @@ -2118,28 +1659,10 @@ fkey3(void) static void fkey4(void) { - if(!meta_down) - { - -#if PCVT_SHOWKEYS - if((vsp->vt_pure_mode == M_HPVT) - && (vsp->which_fkl == SYS_FKL)) - toggl_kbddbg(vsp); - else - more_chars = (u_char *)"\033[20~"; /* F9 */ -#else - if(vsp->vt_pure_mode == M_PUREVT - || (vsp->which_fkl == USR_FKL)) - more_chars = (u_char *)"\033[20~"; /* F9 */ -#endif /* PCVT_SHOWKEYS */ - - } + if (!meta_down) + more_chars = (u_char *)"\033[20~"; /* F9 */ else - { - if(vsp->vt_pure_mode == M_PUREVT - || (vsp->which_fkl == USR_FKL)) - more_chars = (u_char *)"\033[31~"; /* F17 */ - } + more_chars = (u_char *)"\033[31~"; /* F17 */ } /*---------------------------------------------------------------------------* @@ -2148,20 +1671,10 @@ fkey4(void) static void fkey5(void) { - if(!meta_down) - { - if((vsp->vt_pure_mode == M_HPVT) - && (vsp->which_fkl == SYS_FKL)) - toggl_bell(vsp); - else - more_chars = (u_char *)"\033[21~"; /* F10 */ - } + if (!meta_down) + more_chars = (u_char *)"\033[21~"; /* F10 */ else - { - if(vsp->vt_pure_mode == M_PUREVT - || (vsp->which_fkl == USR_FKL)) - more_chars = (u_char *)"\033[32~"; /* F18 */ - } + more_chars = (u_char *)"\033[32~"; /* F18 */ } /*---------------------------------------------------------------------------* @@ -2170,20 +1683,10 @@ fkey5(void) static void fkey6(void) { - if(!meta_down) - { - if((vsp->vt_pure_mode == M_HPVT) - && (vsp->which_fkl == SYS_FKL)) - toggl_sevenbit(vsp); - else - more_chars = (u_char *)"\033[23~"; /* F11 */ - } + if (!meta_down) + more_chars = (u_char *)"\033[23~"; /* F11 */ else - { - if(vsp->vt_pure_mode == M_PUREVT - || (vsp->which_fkl == USR_FKL)) - more_chars = (u_char *)"\033[33~"; /* F19 */ - } + more_chars = (u_char *)"\033[33~"; /* F19 */ } /*---------------------------------------------------------------------------* @@ -2192,20 +1695,10 @@ fkey6(void) static void fkey7(void) { - if(!meta_down) - { - if((vsp->vt_pure_mode == M_HPVT) - && (vsp->which_fkl == SYS_FKL)) - toggl_dspf(vsp); - else - more_chars = (u_char *)"\033[24~"; /* F12 */ - } + if (!meta_down) + more_chars = (u_char *)"\033[24~"; /* F12 */ else - { - if(vsp->vt_pure_mode == M_PUREVT - || (vsp->which_fkl == USR_FKL)) - more_chars = (u_char *)"\033[34~"; /* F20 */ - } + more_chars = (u_char *)"\033[34~"; /* F20 */ } /*---------------------------------------------------------------------------* @@ -2214,20 +1707,10 @@ fkey7(void) static void fkey8(void) { - if(!meta_down) - { - if((vsp->vt_pure_mode == M_HPVT) - && (vsp->which_fkl == SYS_FKL)) - toggl_awm(vsp); - else - more_chars = (u_char *)"\033[25~"; /* F13 */ - } + if (!meta_down) + more_chars = (u_char *)"\033[25~"; /* F13 */ else - { - if(vsp->vt_pure_mode == M_PUREVT - || (vsp->which_fkl == USR_FKL)) - more_chars = (u_char *)"\033[35~"; /* F21 ??!! */ - } + more_chars = (u_char *)"\033[35~"; /* F21 ??!! */ } /*---------------------------------------------------------------------------* @@ -2236,20 +1719,10 @@ fkey8(void) static void fkey9(void) { - if(meta_down) - { - if(vsp->vt_pure_mode == M_PUREVT) - return; - - if(vsp->labels_on) /* toggle label display on/off */ - fkl_off(vsp); - else - fkl_on(vsp); - } + if (meta_down) + return; else - { do_vgapage(0); - } } /*---------------------------------------------------------------------------* @@ -2258,20 +1731,8 @@ fkey9(void) static void fkey10(void) { - if(meta_down) - { - if(vsp->vt_pure_mode != M_PUREVT && vsp->labels_on) - { - if(vsp->which_fkl == USR_FKL) - sw_sfkl(vsp); - else if(vsp->which_fkl == SYS_FKL) - sw_ufkl(vsp); - } - } - else - { + if (!meta_down) do_vgapage(1); - } } /*---------------------------------------------------------------------------* @@ -2280,17 +1741,7 @@ fkey10(void) static void fkey11(void) { - if(meta_down) - { - if(vsp->vt_pure_mode == M_PUREVT) - set_emulation_mode(vsp, M_HPVT); - else if(vsp->vt_pure_mode == M_HPVT) - set_emulation_mode(vsp, M_PUREVT); - } - else - { - do_vgapage(2); - } + do_vgapage(2); } /*---------------------------------------------------------------------------* @@ -2299,15 +1750,13 @@ fkey11(void) static void fkey12(void) { - if(meta_down) - { - if(current_video_screen + 1 > totalscreens-1) + if (meta_down) { + if (current_video_screen + 1 > totalscreens-1) do_vgapage(0); else do_vgapage(current_video_screen + 1); } - else - { + else { do_vgapage(3); } } @@ -2318,15 +1767,13 @@ fkey12(void) static void sfkey1(void) { - if(!meta_down) - { - if(vsp->ukt.length[0]) /* entry available ? */ + if (!meta_down) { + if (vsp->ukt.length[0]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[0]]); } - else - { - if(vsp->ukt.length[9]) /* entry available ? */ + else { + if (vsp->ukt.length[9]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[9]]); } @@ -2338,15 +1785,13 @@ sfkey1(void) static void sfkey2(void) { - if(!meta_down) - { - if(vsp->ukt.length[1]) /* entry available ? */ + if (!meta_down) { + if (vsp->ukt.length[1]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[1]]); } - else - { - if(vsp->ukt.length[11]) /* entry available ? */ + else { + if (vsp->ukt.length[11]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[11]]); } @@ -2358,15 +1803,13 @@ sfkey2(void) static void sfkey3(void) { - if(!meta_down) - { - if(vsp->ukt.length[2]) /* entry available ? */ + if (!meta_down) { + if (vsp->ukt.length[2]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[2]]); } - else - { - if(vsp->ukt.length[12]) /* entry available ? */ + else { + if (vsp->ukt.length[12]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[12]]); } @@ -2378,15 +1821,13 @@ sfkey3(void) static void sfkey4(void) { - if(!meta_down) - { - if(vsp->ukt.length[3]) /* entry available ? */ + if (!meta_down) { + if (vsp->ukt.length[3]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[3]]); } - else - { - if(vsp->ukt.length[13]) /* entry available ? */ + else { + if (vsp->ukt.length[13]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[13]]); } @@ -2398,15 +1839,13 @@ sfkey4(void) static void sfkey5(void) { - if(!meta_down) - { - if(vsp->ukt.length[4]) /* entry available ? */ + if (!meta_down) { + if (vsp->ukt.length[4]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[4]]); } - else - { - if(vsp->ukt.length[14]) /* entry available ? */ + else { + if (vsp->ukt.length[14]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[14]]); } @@ -2418,15 +1857,13 @@ sfkey5(void) static void sfkey6(void) { - if(!meta_down) - { - if(vsp->ukt.length[6]) /* entry available ? */ + if (!meta_down) { + if (vsp->ukt.length[6]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[6]]); } - else - { - if(vsp->ukt.length[15]) /* entry available ? */ + else { + if (vsp->ukt.length[15]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[15]]); } @@ -2438,15 +1875,13 @@ sfkey6(void) static void sfkey7(void) { - if(!meta_down) - { - if(vsp->ukt.length[7]) /* entry available ? */ + if (!meta_down) { + if (vsp->ukt.length[7]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[7]]); } - else - { - if(vsp->ukt.length[16]) /* entry available ? */ + else { + if (vsp->ukt.length[16]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[16]]); } @@ -2458,15 +1893,13 @@ sfkey7(void) static void sfkey8(void) { - if(!meta_down) - { - if(vsp->ukt.length[8]) /* entry available ? */ + if (!meta_down) { + if (vsp->ukt.length[8]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[8]]); } - else - { - if(vsp->ukt.length[17]) /* entry available ? */ + else { + if (vsp->ukt.length[17]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[17]]); } @@ -2509,7 +1942,7 @@ sfkey12(void) static void cfkey1(void) { - if(meta_down) + if (meta_down) do_vgapage(0); } @@ -2519,7 +1952,7 @@ cfkey1(void) static void cfkey2(void) { - if(meta_down) + if (meta_down) do_vgapage(1); } @@ -2529,7 +1962,7 @@ cfkey2(void) static void cfkey3(void) { - if(meta_down) + if (meta_down) do_vgapage(2); } @@ -2539,7 +1972,7 @@ cfkey3(void) static void cfkey4(void) { - if(meta_down) + if (meta_down) do_vgapage(3); } @@ -2549,7 +1982,7 @@ cfkey4(void) static void cfkey5(void) { - if(meta_down) + if (meta_down) do_vgapage(4); } @@ -2559,7 +1992,7 @@ cfkey5(void) static void cfkey6(void) { - if(meta_down) + if (meta_down) do_vgapage(5); } @@ -2569,7 +2002,7 @@ cfkey6(void) static void cfkey7(void) { - if(meta_down) + if (meta_down) do_vgapage(6); } @@ -2579,7 +2012,7 @@ cfkey7(void) static void cfkey8(void) { - if(meta_down) + if (meta_down) do_vgapage(7); } @@ -2589,7 +2022,7 @@ cfkey8(void) static void cfkey9(void) { - if(meta_down) + if (meta_down) do_vgapage(8); } @@ -2599,7 +2032,7 @@ cfkey9(void) static void cfkey10(void) { - if(meta_down) + if (meta_down) do_vgapage(9); } @@ -2609,7 +2042,7 @@ cfkey10(void) static void cfkey11(void) { - if(meta_down) + if (meta_down) do_vgapage(10); } @@ -2619,7 +2052,7 @@ cfkey11(void) static void cfkey12(void) { - if(meta_down) + if (meta_down) do_vgapage(11); } @@ -2631,7 +2064,7 @@ cfkey12(void) static void fkey1(void) { - if(meta_down) + if (meta_down) more_chars = (u_char *)"\033[23~"; /* F11 */ else do_vgapage(0); @@ -2643,7 +2076,7 @@ fkey1(void) static void fkey2(void) { - if(meta_down) + if (meta_down) more_chars = (u_char *)"\033[24~"; /* F12 */ else do_vgapage(1); @@ -2655,7 +2088,7 @@ fkey2(void) static void fkey3(void) { - if(meta_down) + if (meta_down) more_chars = (u_char *)"\033[25~"; /* F13 */ else do_vgapage(2); @@ -2667,7 +2100,7 @@ fkey3(void) static void fkey4(void) { - if(meta_down) + if (meta_down) more_chars = (u_char *)"\033[26~"; /* F14 */ else do_vgapage(3); @@ -2679,11 +2112,10 @@ fkey4(void) static void fkey5(void) { - if(meta_down) + if (meta_down) more_chars = (u_char *)"\033[28~"; /* Help */ - else - { - if((current_video_screen + 1) > totalscreens-1) + else { + if ((current_video_screen + 1) > totalscreens-1) do_vgapage(0); else do_vgapage(current_video_screen + 1); @@ -2696,7 +2128,7 @@ fkey5(void) static void fkey6(void) { - if(meta_down) + if (meta_down) more_chars = (u_char *)"\033[29~"; /* DO */ else more_chars = (u_char *)"\033[17~"; /* F6 */ @@ -2708,7 +2140,7 @@ fkey6(void) static void fkey7(void) { - if(meta_down) + if (meta_down) more_chars = (u_char *)"\033[31~"; /* F17 */ else more_chars = (u_char *)"\033[18~"; /* F7 */ @@ -2720,7 +2152,7 @@ fkey7(void) static void fkey8(void) { - if(meta_down) + if (meta_down) more_chars = (u_char *)"\033[32~"; /* F18 */ else more_chars = (u_char *)"\033[19~"; /* F8 */ @@ -2732,7 +2164,7 @@ fkey8(void) static void fkey9(void) { - if(meta_down) + if (meta_down) more_chars = (u_char *)"\033[33~"; /* F19 */ else more_chars = (u_char *)"\033[20~"; /* F9 */ @@ -2744,7 +2176,7 @@ fkey9(void) static void fkey10(void) { - if(meta_down) + if (meta_down) more_chars = (u_char *)"\033[34~"; /* F20 */ else more_chars = (u_char *)"\033[21~"; /* F10 */ @@ -2756,7 +2188,7 @@ fkey10(void) static void fkey11(void) { - if(meta_down) + if (meta_down) more_chars = (u_char *)"\0x8FP"; /* PF1 */ else more_chars = (u_char *)"\033[23~"; /* F11 */ @@ -2768,7 +2200,7 @@ fkey11(void) static void fkey12(void) { - if(meta_down) + if (meta_down) more_chars = (u_char *)"\0x8FQ"; /* PF2 */ else more_chars = (u_char *)"\033[24~"; /* F12 */ @@ -2780,18 +2212,15 @@ fkey12(void) static void sfkey1(void) { - if(meta_down) - { - if(vsp->ukt.length[6]) /* entry available ? */ + if (meta_down) { + if (vsp->ukt.length[6]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[6]]); else more_chars = (u_char *)"\033[23~"; /* F11 */ } else - { do_vgapage(4); - } } /*---------------------------------------------------------------------------* @@ -2800,18 +2229,15 @@ sfkey1(void) static void sfkey2(void) { - if(meta_down) - { - if(vsp->ukt.length[7]) /* entry available ? */ + if (meta_down) { + if (vsp->ukt.length[7]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[7]]); else more_chars = (u_char *)"\033[24~"; /* F12 */ } else - { do_vgapage(5); - } } /*---------------------------------------------------------------------------* @@ -2820,18 +2246,15 @@ sfkey2(void) static void sfkey3(void) { - if(meta_down) - { - if(vsp->ukt.length[8]) /* entry available ? */ + if (meta_down) { + if (vsp->ukt.length[8]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[8]]); else more_chars = (u_char *)"\033[25~"; /* F13 */ } else - { do_vgapage(6); - } } /*---------------------------------------------------------------------------* @@ -2840,18 +2263,15 @@ sfkey3(void) static void sfkey4(void) { - if(meta_down) - { - if(vsp->ukt.length[9]) /* entry available ? */ + if (meta_down) { + if (vsp->ukt.length[9]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[9]]); else more_chars = (u_char *)"\033[26~"; /* F14 */ } else - { do_vgapage(7); - } } /*---------------------------------------------------------------------------* @@ -2860,17 +2280,15 @@ sfkey4(void) static void sfkey5(void) { - if(meta_down) - { - if(vsp->ukt.length[11]) /* entry available ? */ + if (meta_down) { + if (vsp->ukt.length[11]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[11]]); else more_chars = (u_char *)"\033[28~"; /* Help */ } - else - { - if(current_video_screen <= 0) + else { + if (current_video_screen <= 0) do_vgapage(totalscreens-1); else do_vgapage(current_video_screen - 1); @@ -2883,15 +2301,14 @@ sfkey5(void) static void sfkey6(void) { - if(!meta_down) - { - if(vsp->ukt.length[0]) /* entry available ? */ + if (!meta_down) { + if (vsp->ukt.length[0]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[0]]); else more_chars = (u_char *)"\033[17~"; /* F6 */ } - else if(vsp->ukt.length[12]) /* entry available ? */ + else if (vsp->ukt.length[12]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[12]]); else @@ -2904,15 +2321,14 @@ sfkey6(void) static void sfkey7(void) { - if(!meta_down) - { - if(vsp->ukt.length[1]) /* entry available ? */ + if (!meta_down) { + if (vsp->ukt.length[1]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[1]]); else more_chars = (u_char *)"\033[18~"; /* F7 */ } - else if(vsp->ukt.length[14]) /* entry available ? */ + else if (vsp->ukt.length[14]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[14]]); else @@ -2925,15 +2341,14 @@ sfkey7(void) static void sfkey8(void) { - if(!meta_down) - { - if(vsp->ukt.length[2]) /* entry available ? */ + if (!meta_down) { + if (vsp->ukt.length[2]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[2]]); else more_chars = (u_char *)"\033[19~"; /* F8 */ } - else if(vsp->ukt.length[14]) /* entry available ? */ + else if (vsp->ukt.length[14]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[15]]); else @@ -2946,15 +2361,14 @@ sfkey8(void) static void sfkey9(void) { - if(!meta_down) - { - if(vsp->ukt.length[3]) /* entry available ? */ + if (!meta_down) { + if (vsp->ukt.length[3]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[3]]); else more_chars = (u_char *)"\033[20~"; /* F9 */ } - else if(vsp->ukt.length[16]) /* entry available ? */ + else if (vsp->ukt.length[16]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[16]]); else @@ -2967,15 +2381,14 @@ sfkey9(void) static void sfkey10(void) { - if(!meta_down) - { - if(vsp->ukt.length[4]) /* entry available ? */ + if (!meta_down) { + if (vsp->ukt.length[4]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[4]]); else more_chars = (u_char *)"\033[21~"; /* F10 */ } - else if(vsp->ukt.length[17]) /* entry available ? */ + else if (vsp->ukt.length[17]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[17]]); else @@ -2988,9 +2401,8 @@ sfkey10(void) static void sfkey11(void) { - if(!meta_down) - { - if(vsp->ukt.length[6]) /* entry available ? */ + if (!meta_down) { + if (vsp->ukt.length[6]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[6]]); else @@ -3004,9 +2416,8 @@ sfkey11(void) static void sfkey12(void) { - if(!meta_down) - { - if(vsp->ukt.length[7]) /* entry available ? */ + if (!meta_down) { + if (vsp->ukt.length[7]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[7]]); else @@ -3014,139 +2425,6 @@ sfkey12(void) } } -/*---------------------------------------------------------------------------* - * function bound to control function key 1 - *---------------------------------------------------------------------------*/ -static void -cfkey1(void) -{ - if(vsp->which_fkl == SYS_FKL) - toggl_columns(vsp); -} - -/*---------------------------------------------------------------------------* - * function bound to control function key 2 - *---------------------------------------------------------------------------*/ -static void -cfkey2(void) -{ - if(vsp->which_fkl == SYS_FKL) - vt_ris(vsp); -} - -/*---------------------------------------------------------------------------* - * function bound to control function key 3 - *---------------------------------------------------------------------------*/ -static void -cfkey3(void) -{ - if(vsp->which_fkl == SYS_FKL) - toggl_24l(vsp); -} - -/*---------------------------------------------------------------------------* - * function bound to control function key 4 - *---------------------------------------------------------------------------*/ -static void -cfkey4(void) -{ - -#if PCVT_SHOWKEYS - if(vsp->which_fkl == SYS_FKL) - toggl_kbddbg(vsp); -#endif /* PCVT_SHOWKEYS */ - -} - -/*---------------------------------------------------------------------------* - * function bound to control function key 5 - *---------------------------------------------------------------------------*/ -static void -cfkey5(void) -{ - if(vsp->which_fkl == SYS_FKL) - toggl_bell(vsp); -} - -/*---------------------------------------------------------------------------* - * function bound to control function key 6 - *---------------------------------------------------------------------------*/ -static void -cfkey6(void) -{ - if(vsp->which_fkl == SYS_FKL) - toggl_sevenbit(vsp); -} - -/*---------------------------------------------------------------------------* - * function bound to control function key 7 - *---------------------------------------------------------------------------*/ -static void -cfkey7(void) -{ - if(vsp->which_fkl == SYS_FKL) - toggl_dspf(vsp); -} - -/*---------------------------------------------------------------------------* - * function bound to control function key 8 - *---------------------------------------------------------------------------*/ -static void -cfkey8(void) -{ - if(vsp->which_fkl == SYS_FKL) - toggl_awm(vsp); -} - -/*---------------------------------------------------------------------------* - * function bound to control function key 9 - *---------------------------------------------------------------------------*/ -static void -cfkey9(void) -{ - if(vsp->labels_on) /* toggle label display on/off */ - fkl_off(vsp); - else - fkl_on(vsp); -} - -/*---------------------------------------------------------------------------* - * function bound to control function key 10 - *---------------------------------------------------------------------------*/ -static void -cfkey10(void) -{ - if(vsp->labels_on) /* toggle user/system fkey labels */ - { - if(vsp->which_fkl == USR_FKL) - sw_sfkl(vsp); - else if(vsp->which_fkl == SYS_FKL) - sw_ufkl(vsp); - } -} - -/*---------------------------------------------------------------------------* - * function bound to control function key 11 - *---------------------------------------------------------------------------*/ -static void -cfkey11(void) -{ - if(vsp->vt_pure_mode == M_PUREVT) - set_emulation_mode(vsp, M_HPVT); - else if(vsp->vt_pure_mode == M_HPVT) - set_emulation_mode(vsp, M_PUREVT); -} - -/*---------------------------------------------------------------------------* - * function bound to control function key 12 - *---------------------------------------------------------------------------*/ -static void -cfkey12(void) -{ -} - -#endif /* PCVT_VT220KEYB */ - #endif /* NVT > 0 */ static void @@ -3162,8 +2440,7 @@ scrollback_save_screen(void) scrnsv_size = s; - if (!(scrollback_savedscreen = (u_short *)malloc(s, M_TEMP, M_NOWAIT))) - { + if (!(scrollback_savedscreen = (u_short *)malloc(s, M_TEMP, M_NOWAIT))){ splx(x); return; } diff --git a/sys/arch/i386/isa/pcvt/pcvt_out.c b/sys/arch/i386/isa/pcvt/pcvt_out.c index 3e72ce3e291..499c169b11f 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_out.c +++ b/sys/arch/i386/isa/pcvt/pcvt_out.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcvt_out.c,v 1.15 1999/11/16 21:57:49 aaron Exp $ */ +/* $OpenBSD: pcvt_out.c,v 1.16 1999/11/25 20:24:22 aaron Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -75,9 +75,6 @@ #include "pcvt_hdr.h" /* global include */ static void check_scroll ( struct video_state *svsp ); -static void hp_entry ( U_char ch, struct video_state *svsp ); -static void wrfkl ( int num, u_char *string, struct video_state *svsp ); -static void writefkl ( int num, u_char *string, struct video_state *svsp ); static __inline void write_char (struct video_state *, u_short, u_short ch); static int check_scrollback ( struct video_state *svsp ); @@ -97,51 +94,32 @@ u_short attrib, ch; return; } - if ((ch >= 0x20) && (ch <= 0x7f)) /* use GL if ch >= 0x20 */ - { + if ((ch >= 0x20) && (ch <= 0x7f)) { /* use GL if ch >= 0x20 */ if(!svsp->ss) /* single shift G2/G3 -> GL ? */ - { *video = attrib | svsp->GL[ch-0x20]; - } - else - { + else { *video = attrib | svsp->Gs[ch-0x20]; svsp->ss = 0; } } - else - { + else { svsp->ss = 0; - if(ch >= 0x80) /* display controls C1 */ - { + if(ch >= 0x80) { /* display controls C1 */ if(ch >= 0xA0) /* use GR if ch >= 0xA0 */ - { *video = attrib | svsp->GR[ch-0xA0]; - } - else - { + else { if(vgacs[svsp->vga_charset].secondloaded) - { *video = attrib | ((ch-0x60) | CSH); - } - else /* use normal ibm charset for - control display */ - { + else /* use normal ibm charset */ *video = attrib | ch; - } } } - else /* display controls C0 */ - { + else { /* display controls C0 */ if(vgacs[svsp->vga_charset].secondloaded) - { *video = attrib | (ch | CSH); - } else /* use normal ibm charset for control display*/ - { *video = attrib | ch; - } } } } @@ -489,20 +467,6 @@ sput (u_char *s, U_char kernel, int len, int page) svsp->state = STATE_HASH; break; - case '&': /* ESC & family (HP) */ - if(svsp->vt_pure_mode == - M_HPVT) - { - svsp->state = - STATE_AMPSND; - svsp->hp_state = - SHP_INIT; - } - else - svsp->state = - STATE_INIT; - break; - case '(': /* ESC ( family */ svsp->state = STATE_BROPN; break; @@ -955,10 +919,6 @@ sput (u_char *s, U_char kernel, int len, int page) } break; - case STATE_AMPSND: - hp_entry(ch,svsp); - break; - case STATE_DCS: vt_dcsentry(ch,svsp); break; @@ -1156,16 +1116,6 @@ vt_coldinit(void) svsp->m_awm = 1; /* enable auto wrap mode */ svsp->m_om = 0; /* origin mode = absolute */ svsp->sc_flag = 0; /* init saved cursor flag */ - svsp->which_fkl = SYS_FKL; /* display system fkey-labels */ - svsp->labels_on = 1; /* if in HP-mode, display */ - /* fkey-labels */ - svsp->attribute = 0; /* HP mode init */ - svsp->key = 0; /* HP mode init */ - svsp->l_len = 0; /* HP mode init */ - svsp->s_len = 0; /* HP mode init */ - svsp->m_len = 0; /* HP mode init */ - svsp->i = 0; /* HP mode init */ - svsp->vt_pure_mode = M_PUREVT; /* initial mode: pure VT220*/ svsp->vga_charset = CH_SET0; /* use bios default charset */ #if PCVT_24LINESDEF /* true compatibility */ @@ -1221,8 +1171,6 @@ vt_coldinit(void) svsp->GR = svsp->G2; /* GR = G2 */ svsp->whichi = 0; /* char set designate init */ svsp->which[0] = '\0'; /* char set designate init */ - svsp->hp_state = SHP_INIT; /* init HP mode state machine*/ - svsp->dcs_state = DCS_INIT; /* init DCS mode state machine*/ svsp->ss = 0; /* init single shift 2/3 */ svsp->Gs = NULL; /* Gs single shift 2/3 */ svsp->maxcol = SCR_COL80; /* 80 columns now (MUST!!!) */ @@ -1502,440 +1450,6 @@ check_scrollback(struct video_state *svsp) } /*---------------------------------------------------------------------------* - * write to one user function key label - *---------------------------------------------------------------------------*/ -static void -writefkl(int num, u_char *string, struct video_state *svsp) -{ - if((num < 0) || (num > 7)) /* range ok ? */ - return; - - strncpy(svsp->ufkl[num], string, 16); /* save string in static array */ - - if(svsp->which_fkl == USR_FKL) - wrfkl(num,string,svsp); -} - -/*---------------------------------------------------------------------------* - * write to one system function key label - *---------------------------------------------------------------------------*/ -void -swritefkl(int num, u_char *string, struct video_state *svsp) -{ - if((num < 0) || (num > 7)) /* range ok ? */ - return; - - strncpy(svsp->sfkl[num], string, 16); /* save string in static array */ - - if(svsp->which_fkl == SYS_FKL) - wrfkl(num,string,svsp); -} - -/*---------------------------------------------------------------------------* - * write function key label onto screen - *---------------------------------------------------------------------------*/ -static void -wrfkl(int num, u_char *string, struct video_state *svsp) -{ - register u_short *p; - register u_short *p1; - register int cnt = 0; - - if(!svsp->labels_on || (svsp->vt_pure_mode == M_PUREVT)) - return; - - p = (svsp->Crtat - + (svsp->screen_rows * svsp->maxcol)); /* screen_rows+1 line */ - - if(svsp->maxcol == SCR_COL80) - { - if(num < 4) /* labels 1 .. 4 */ - p += (num * LABEL_LEN); - else /* labels 5 .. 8 */ - p += ((num * LABEL_LEN) + LABEL_MID + 1); - } - else - { - if(num < 4) /* labels 1 .. 4 */ - p += (num * (LABEL_LEN + 6)); - else /* labels 5 .. 8 */ - p += ((num * (LABEL_LEN + 6)) + LABEL_MID + 11); - - } - p1 = p + svsp->maxcol; /* second label line */ - - while((*string != '\0') && (cnt < 8)) - { - *p = ((0x70 << 8) + (*string & 0xff)); - p++; - string++; - cnt++; - } - while(cnt < 8) - { - *p = ((0x70 << 8) + ' '); - p++; - cnt++; - } - - while((*string != '\0') && (cnt < 16)) - { - *p1 = ((0x70 << 8) + (*string & 0xff)); - p1++; - string++; - cnt++; - } - while(cnt < 16) - { - *p1 = ((0x70 << 8) + ' '); - p1++; - cnt++; - } -} - -/*---------------------------------------------------------------------------* - * remove (=blank) function key labels, row/col and status line - *---------------------------------------------------------------------------*/ -void -fkl_off(struct video_state *svsp) -{ - register u_short *p; - register int num; - register int size; - - svsp->labels_on = 0; - - if((vgacs[svsp->vga_charset].screen_size==SIZ_28ROWS) && svsp->force24) - size = 4; - else - size = 3; - - p = (svsp->Crtat + (svsp->screen_rows * svsp->maxcol)); - - for(num = 0; num < (size * svsp->maxcol); num++) - *p++ = ' '; -} - -/*---------------------------------------------------------------------------* - * (re-) display function key labels, row/col and status line - *---------------------------------------------------------------------------*/ -void -fkl_on(struct video_state *svsp) -{ - svsp->labels_on = 1; - - if(svsp->which_fkl == SYS_FKL) - sw_sfkl(svsp); - else if(svsp->which_fkl == USR_FKL) - sw_ufkl(svsp); -} - -/*---------------------------------------------------------------------------* - * set emulation mode, switch between pure VTxxx mode and HP/VTxxx mode - *---------------------------------------------------------------------------*/ -void -set_emulation_mode(struct video_state *svsp, int mode) -{ - if(svsp->vt_pure_mode == mode) - return; - - clr_parms(svsp); /* escape parameter init */ - svsp->state = STATE_INIT; /* initial state */ - svsp->scrr_beg = 0; /* start of scrolling region */ - svsp->sc_flag = 0; /* invalidate saved cursor position */ - svsp->transparent = 0; /* disable control code processing */ - - if(mode == M_HPVT) /* vt-pure -> hp/vt-mode */ - { - svsp->screen_rows = svsp->screen_rowsize - 3; - if (svsp->force24 && svsp->screen_rows == 25) - svsp->screen_rows = 24; - - if (svsp->row >= svsp->screen_rows) { - /* Scroll up */ - int nscroll = svsp->row + 1 - svsp->screen_rows; - bcopy (svsp->Crtat + nscroll * svsp->maxcol, - svsp->Crtat, - svsp->screen_rows * svsp->maxcol * CHR); - svsp->row -= nscroll; - svsp->cur_offset -= nscroll * svsp->maxcol; - } - - svsp->vt_pure_mode = M_HPVT; - - if (svsp->vs_tty) - svsp->vs_tty->t_winsize.ws_row = svsp->screen_rows; - - svsp->scrr_len = svsp->screen_rows; - svsp->scrr_end = svsp->scrr_len - 1; - - update_hp(svsp); - } - else if(mode == M_PUREVT) /* hp/vt-mode -> vt-pure */ - { - fillw(user_attr | ' ', - (caddr_t)(svsp->Crtat + svsp->screen_rows * svsp->maxcol), - (svsp->screen_rowsize - svsp->screen_rows) - * svsp->maxcol); - - svsp->vt_pure_mode = M_PUREVT; - - svsp->screen_rows = svsp->screen_rowsize; - if (svsp->force24 && svsp->screen_rows == 25) - svsp->screen_rows = 24; - - if (svsp->vs_tty) - svsp->vs_tty->t_winsize.ws_row = svsp->screen_rows; - - svsp->scrr_len = svsp->screen_rows; - svsp->scrr_end = svsp->scrr_len - 1; - } - -#if PCVT_SIGWINCH - if (svsp->vs_tty && svsp->vs_tty->t_pgrp) - pgsignal(svsp->vs_tty->t_pgrp, SIGWINCH, 1); -#endif /* PCVT_SIGWINCH */ - -} - -/*---------------------------------------------------------------------------* - * initialize user function key labels - *---------------------------------------------------------------------------*/ -void -init_ufkl(struct video_state *svsp) -{ - writefkl(0,(u_char *)" f1",svsp); /* init fkey labels */ - writefkl(1,(u_char *)" f2",svsp); - writefkl(2,(u_char *)" f3",svsp); - writefkl(3,(u_char *)" f4",svsp); - writefkl(4,(u_char *)" f5",svsp); - writefkl(5,(u_char *)" f6",svsp); - writefkl(6,(u_char *)" f7",svsp); - writefkl(7,(u_char *)" f8",svsp); -} - -/*---------------------------------------------------------------------------* - * initialize system user function key labels - *---------------------------------------------------------------------------*/ -void -init_sfkl(struct video_state *svsp) -{ - /* 1234567812345678 */ - if(can_do_132col) - /* 1234567812345678 */ - swritefkl(0,(u_char *)"132 COLUMNS ",svsp); - else - swritefkl(0,(u_char *)" ",svsp); - - /* 1234567812345678 */ - swritefkl(1,(u_char *)"SOFT-RSTTERMINAL",svsp); - - if(svsp->force24) - swritefkl(2,(u_char *)"FORCE24 ENABLE *",svsp); - else - swritefkl(2,(u_char *)"FORCE24 ENABLE ",svsp); - -#if PCVT_SHOWKEYS /* 1234567812345678 */ - if(svsp == &vs[0]) - swritefkl(3,(u_char *)"KEYBSCANDISPLAY ",svsp); - else - swritefkl(3,(u_char *)" ",svsp); -#else - swritefkl(3,(u_char *)" ",svsp); -#endif /* PCVT_SHOWKEYS */ - - /* 1234567812345678 */ - if(svsp->bell_on) - swritefkl(4,(u_char *)"BELL ENABLE *",svsp); - else - swritefkl(4,(u_char *)"BELL ENABLE ",svsp); - - if(svsp->sevenbit) - swritefkl(5,(u_char *)"8-BIT ENABLE ",svsp); - else - swritefkl(5,(u_char *)"8-BIT ENABLE *",svsp); - - swritefkl(6,(u_char *)"DISPLAY FUNCTNS ",svsp); - - swritefkl(7,(u_char *)"AUTOWRAPENABLE *",svsp); - /* 1234567812345678 */ -} - -/*---------------------------------------------------------------------------* - * switch display to user function key labels - *---------------------------------------------------------------------------*/ -void -sw_ufkl(struct video_state *svsp) -{ - int i; - svsp->which_fkl = USR_FKL; - for(i = 0; i < 8; i++) - wrfkl(i,svsp->ufkl[i],svsp); -} - -/*---------------------------------------------------------------------------* - * switch display to system function key labels - *---------------------------------------------------------------------------*/ -void -sw_sfkl(struct video_state *svsp) -{ - int i; - svsp->which_fkl = SYS_FKL; - for(i = 0; i < 8; i++) - wrfkl(i,svsp->sfkl[i],svsp); -} - -/*---------------------------------------------------------------------------* - * toggle force 24 lines - *---------------------------------------------------------------------------*/ -void -toggl_24l(struct video_state *svsp) -{ - if(svsp->which_fkl == SYS_FKL) - { - if(svsp->force24) - { - svsp->force24 = 0; - swritefkl(2,(u_char *)"FORCE24 ENABLE ",svsp); - } - else - { - svsp->force24 = 1; - swritefkl(2,(u_char *)"FORCE24 ENABLE *",svsp); - } - set_screen_size(svsp, vgacs[(svsp->vga_charset)].screen_size); - } -} - -#if PCVT_SHOWKEYS -/*---------------------------------------------------------------------------* - * toggle keyboard scancode display - *---------------------------------------------------------------------------*/ -void -toggl_kbddbg(struct video_state *svsp) -{ - if((svsp->which_fkl == SYS_FKL) && (svsp == &vs[0])) - { - if(keyboard_show) - { - keyboard_show = 0; - swritefkl(3,(u_char *)"KEYBSCANDISPLAY ",svsp); - } - else - { - keyboard_show = 1; - swritefkl(3,(u_char *)"KEYBSCANDISPLAY*",svsp); - } - } -} -#endif /* PCVT_SHOWKEYS */ - -/*---------------------------------------------------------------------------* - * toggle display functions - *---------------------------------------------------------------------------*/ -void -toggl_dspf(struct video_state *svsp) -{ - if(svsp->which_fkl == SYS_FKL) - { - if(svsp->dis_fnc) - { - svsp->dis_fnc = 0; - swritefkl(6,(u_char *)"DISPLAY FUNCTNS ",svsp); - } - else - { - svsp->dis_fnc = 1; - swritefkl(6,(u_char *)"DISPLAY FUNCTNS*",svsp); - } - } -} - -/*---------------------------------------------------------------------------* - * auto wrap on/off - *---------------------------------------------------------------------------*/ -void -toggl_awm(struct video_state *svsp) -{ - if(svsp->which_fkl == SYS_FKL) - { - if(svsp->m_awm) - { - svsp->m_awm = 0; - swritefkl(7,(u_char *)"AUTOWRAPENABLE ",svsp); - } - else - { - svsp->m_awm = 1; - swritefkl(7,(u_char *)"AUTOWRAPENABLE *",svsp); - } - } -} - -/*---------------------------------------------------------------------------* - * bell on/off - *---------------------------------------------------------------------------*/ -void -toggl_bell(struct video_state *svsp) -{ - if(svsp->which_fkl == SYS_FKL) - { - if(svsp->bell_on) - { - svsp->bell_on = 0; - swritefkl(4,(u_char *)"BELL ENABLE ",svsp); - } - else - { - svsp->bell_on = 1; - swritefkl(4,(u_char *)"BELL ENABLE *",svsp); - } - } -} - -/*---------------------------------------------------------------------------* - * 7/8 bit usage - *---------------------------------------------------------------------------*/ -void -toggl_sevenbit(struct video_state *svsp) -{ - if(svsp->which_fkl == SYS_FKL) - { - if(svsp->sevenbit) - { - svsp->sevenbit = 0; - swritefkl(5,(u_char *)"8-BIT ENABLE *",svsp); - } - else - { - svsp->sevenbit = 1; - swritefkl(5,(u_char *)"8-BIT ENABLE ",svsp); - } - } -} - -/*---------------------------------------------------------------------------* - * 80 / 132 columns - *---------------------------------------------------------------------------*/ -void -toggl_columns(struct video_state *svsp) -{ - if(svsp->which_fkl == SYS_FKL) - { - if(svsp->maxcol == SCR_COL132) - { - if(vt_col(svsp, SCR_COL80)) - svsp->maxcol = 80; - } - else - { - if(vt_col(svsp, SCR_COL132)) - svsp->maxcol = 132; - } - } -} - -/*---------------------------------------------------------------------------* * toggle vga 80/132 column operation *---------------------------------------------------------------------------*/ int @@ -1944,11 +1458,6 @@ vt_col(struct video_state *svsp, int cols) if(vga_col(svsp, cols) == 0) return(0); - if(cols == SCR_COL80) - swritefkl(0,(u_char *)"132 COLUMNS ",svsp); - else - swritefkl(0,(u_char *)"132 COLUMNS*",svsp); - fillw(user_attr | ' ', (caddr_t)(svsp->Crtat), svsp->maxcol * svsp->screen_rowsize); @@ -1966,8 +1475,6 @@ vt_col(struct video_state *svsp, int cols) svsp->selchar = 0; /* selective attr off */ vt_initsel(svsp); /* re-init sel attr */ - update_hp(svsp); /* update labels, row/col, page ind */ - /* Update winsize struct to reflect screen size */ if(svsp->vs_tty) @@ -1989,40 +1496,6 @@ vt_col(struct video_state *svsp, int cols) } /*---------------------------------------------------------------------------* - * update HP stuff on screen - *---------------------------------------------------------------------------*/ -void -update_hp(struct video_state *svsp) -{ - if(svsp->vt_pure_mode != M_HPVT) - return; - - fillw (user_attr | ' ', - (caddr_t)(svsp->Crtat + svsp->screen_rows * svsp->maxcol), - (svsp->screen_rowsize - svsp->screen_rows) * svsp->maxcol); - - if (!svsp->labels_on) - return; - - /* update fkey labels */ - - fkl_off(svsp); - fkl_on(svsp); - - if(vsp == svsp) - { - /* update current displayed screen indicator */ - - *((svsp->Crtat + ((svsp->screen_rows + 2) * svsp->maxcol)) - + svsp->maxcol - 3) = user_attr | '['; - *((svsp->Crtat + ((svsp->screen_rows + 2) * svsp->maxcol)) - + svsp->maxcol - 2) = user_attr | (current_video_screen + '0'); - *((svsp->Crtat + ((svsp->screen_rows + 2) * svsp->maxcol)) - + svsp->maxcol - 1) = user_attr | ']'; - } -} - -/*---------------------------------------------------------------------------* * initialize ANSI escape sequence parameter buffers *---------------------------------------------------------------------------*/ void @@ -2034,302 +1507,6 @@ clr_parms(struct video_state *svsp) svsp->parmi = 0; } - -/*---------------------------------------------------------------------------* - * - * partial HP 2392 ANSI mode Emulator - * ================================== - * - * this part tooks over the emulation of some escape sequences - * needed to handle the function key labels - * - * They are modeled after the corresponding escape sequences - * introduced with the HP2392 terminals from Hewlett-Packard. - * - * see: - * "HP2392A, Display Terminal Reference Manual", - * HP Manual Part Number 02390-90001 - * and: - * Reference Manual Supplement - * "2392A Display Terminal Option 049, ANSI Operation" - * HP Manual Part Number 02390-90023EN - * - *---------------------------------------------------------------------------*/ - -static void -hp_entry(U_char ch, struct video_state *svsp) -{ - switch(svsp->hp_state) - { - case SHP_INIT: - switch(ch) - { - case 'f': - svsp->hp_state = SHP_AND_F; - svsp->attribute = 0; - svsp->key = 0; - svsp->l_len = 0; - svsp->s_len = 0; - svsp->i = 0; - break; - - case 'j': - svsp->m_len = 0; - svsp->hp_state = SHP_AND_J; - break; - - case 's': - svsp->hp_state = SHP_AND_ETE; - break; - - default: - svsp->hp_state = SHP_INIT; - svsp->state = STATE_INIT; - break; - } - break; - - case SHP_AND_F: - if((ch >= '0') && (ch <= '8')) - { - svsp->attribute = ch; - svsp->hp_state = SHP_AND_Fa; - } - else - { - svsp->hp_state = SHP_INIT; - svsp->state = STATE_INIT; - } - break; - - case SHP_AND_Fa: - if(ch == 'a') - svsp->hp_state = SHP_AND_Fak; - else if(ch == 'k') - { - svsp->key = svsp->attribute; - svsp->hp_state = SHP_AND_Fakd; - } - else - { - svsp->hp_state = SHP_INIT; - svsp->state = STATE_INIT; - } - break; - - case SHP_AND_Fak: - if((ch >= '1') && (ch <= '8')) - { - svsp->key = ch; - svsp->hp_state = SHP_AND_Fak1; - } - else - { - svsp->hp_state = SHP_INIT; - svsp->state = STATE_INIT; - } - break; - - case SHP_AND_Fak1: - if(ch == 'k') - svsp->hp_state = SHP_AND_Fakd; - else - { - svsp->hp_state = SHP_INIT; - svsp->state = STATE_INIT; - } - break; - - case SHP_AND_Fakd: - if(svsp->l_len > 16) - { - svsp->hp_state = SHP_INIT; - svsp->state = STATE_INIT; - } - else if(ch >= '0' && ch <= '9') - { - svsp->l_len *= 10; - svsp->l_len += (ch -'0'); - } - else if(ch == 'd') - svsp->hp_state = SHP_AND_FakdL; - else - { - svsp->hp_state = SHP_INIT; - svsp->state = STATE_INIT; - } - break; - - case SHP_AND_FakdL: - if(svsp->s_len > 80) - { - svsp->hp_state = SHP_INIT; - svsp->state = STATE_INIT; - } - else if(ch >= '0' && ch <= '9') - { - svsp->s_len *= 10; - svsp->s_len += (ch -'0'); - } - else if(ch == 'L') - { - svsp->hp_state = SHP_AND_FakdLl; - svsp->transparent = 1; - } - else - { - svsp->hp_state = SHP_INIT; - svsp->state = STATE_INIT; - } - break; - - case SHP_AND_FakdLl: - svsp->l_buf[svsp->i] = ch; - if(svsp->i >= svsp->l_len-1) - { - svsp->hp_state = SHP_AND_FakdLls; - svsp->i = 0; - if(svsp->s_len == 0) - { - svsp->state = STATE_INIT; - svsp->hp_state = SHP_INIT; - svsp->transparent = 0; - svsp->i = 0; - svsp->l_buf[svsp->l_len] = '\0'; - svsp->s_buf[svsp->s_len] = '\0'; - writefkl((svsp->key - '0' -1), - svsp->l_buf, svsp); - } - } - else - svsp->i++; - break; - - case SHP_AND_FakdLls: - svsp->s_buf[svsp->i] = ch; - if(svsp->i >= svsp->s_len-1) - { - svsp->state = STATE_INIT; - svsp->hp_state = SHP_INIT; - svsp->transparent = 0; - svsp->i = 0; - svsp->l_buf[svsp->l_len] = '\0'; - svsp->s_buf[svsp->s_len] = '\0'; - writefkl((svsp->key - '0' -1), svsp->l_buf, - svsp); - } - else - svsp->i++; - break; - - case SHP_AND_J: - switch(ch) - { - case '@': /* enable user keys, remove */ - /* all labels & status from */ - /* screen */ - svsp->hp_state = SHP_INIT; - svsp->state = STATE_INIT; - fkl_off(svsp); - break; - - case 'A': /* enable & display "modes" */ - svsp->hp_state = SHP_INIT; - svsp->state = STATE_INIT; - fkl_on(svsp); - sw_sfkl(svsp); - break; - - case 'B': /* enable & display "user" */ - svsp->hp_state = SHP_INIT; - svsp->state = STATE_INIT; - fkl_on(svsp); - sw_ufkl(svsp); - break; - - case 'C': /* remove (clear) status line*/ - /* and restore current labels*/ - svsp->hp_state = SHP_INIT; - svsp->state = STATE_INIT; - fkl_on(svsp); - break; - - case 'R': /* enable usr/menu keys */ - /* and fkey label modes */ - svsp->hp_state = SHP_INIT; - svsp->state = STATE_INIT; - break; - - case 'S': /* disable usr/menu keys */ - /* and fkey label modes */ - svsp->hp_state = SHP_INIT; - svsp->state = STATE_INIT; - break; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': /* parameters for esc & j xx L mm */ - svsp->m_len *= 10; - svsp->m_len += (ch -'0'); - break; - - case 'L': - svsp->hp_state = SHP_AND_JL; - svsp->i = 0; - svsp->transparent = 1; - break; - - default: - svsp->hp_state = SHP_INIT; - svsp->state = STATE_INIT; - break; - - } - break; - - - case SHP_AND_JL: - svsp->m_buf[svsp->i] = ch; - if(svsp->i >= svsp->m_len-1) - { - svsp->state = STATE_INIT; - svsp->hp_state = SHP_INIT; - svsp->transparent = 0; - svsp->i = 0; - svsp->m_buf[svsp->m_len] = '\0'; - /* display status line */ - /* needs to be implemented */ - /* see 2392 man, 3-14 */ - - } - else - svsp->i++; - break; - - case SHP_AND_ETE: /* eat chars until uppercase */ - if(ch >= '@' && ch <= 'Z') - { - svsp->hp_state = SHP_INIT; - svsp->state = STATE_INIT; - svsp->transparent = 0; - } - break; - - default: - svsp->hp_state = SHP_INIT; - svsp->state = STATE_INIT; - svsp->transparent = 0; - break; - } -} - #endif /* NVT > 0 */ /* ------------------------- E O F ------------------------------------------*/ diff --git a/sys/arch/i386/isa/pcvt/pcvt_sup.c b/sys/arch/i386/isa/pcvt/pcvt_sup.c index ddaba8d60ae..fe1b797e7b9 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_sup.c +++ b/sys/arch/i386/isa/pcvt/pcvt_sup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcvt_sup.c,v 1.12 1999/11/20 18:52:00 espie Exp $ */ +/* $OpenBSD: pcvt_sup.c,v 1.13 1999/11/25 20:24:22 aaron Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -109,7 +109,7 @@ static u_short getrand ( void ); * execute vga ioctls *---------------------------------------------------------------------------*/ int -vgaioctl(Dev_t dev, u_long cmd, caddr_t data, int flag) +vgaioctl(Dev_t dev, int cmd, caddr_t data, int flag) { if(minor(dev) >= PCVT_NSCREENS) return -1; @@ -307,12 +307,6 @@ vgapcvtinfo(struct pcvtinfo *data) #if PCVT_24LINESDEF | CONF_24LINESDEF #endif -#if PCVT_EMU_MOUSE - | CONF_EMU_MOUSE -#endif -#if PCVT_SHOWKEYS - | CONF_SHOWKEYS -#endif #if PCVT_KEYBDID | CONF_KEYBDID #endif @@ -612,7 +606,6 @@ vid_getscreen(struct screeninfo *data, Dev_t dev) /* screen size */ data->screen_size = vgacs[(vs[device].vga_charset)].screen_size; /* pure VT mode or HP/VT mode */ - data->pure_vt_mode = vs[device].vt_pure_mode; data->vga_family = vga_family; /* manufacturer, family */ data->vga_type = vga_type; /* detected chipset type */ data->vga_132 = can_do_132col; /* 132 column support */ @@ -656,35 +649,20 @@ vid_setscreen(struct screeninfo *data, Dev_t dev) if(screen != current_video_screen) return; /* XXX should say "EAGAIN" here */ - if((data->screen_size != -1) || (data->force_24lines != -1)) - { + if((data->screen_size != -1) || (data->force_24lines != -1)) { if(data->screen_size == -1) data->screen_size = vgacs[(vs[screen].vga_charset)].screen_size; if(data->force_24lines != -1) - { vs[screen].force24 = data->force_24lines; - if(vs[screen].force24) - { - swritefkl(2,(u_char *)"FORCE24 ENABLE *", - &vs[screen]); - } - else - { - swritefkl(2,(u_char *)"FORCE24 ENABLE ", - &vs[screen]); - } - } - if((data->screen_size == SIZ_25ROWS) || (data->screen_size == SIZ_28ROWS) || (data->screen_size == SIZ_35ROWS) || (data->screen_size == SIZ_40ROWS) || (data->screen_size == SIZ_43ROWS) || - (data->screen_size == SIZ_50ROWS)) - { + (data->screen_size == SIZ_50ROWS)) { if(data->screen_no == -1) set_screen_size(vsp, data->screen_size); else @@ -692,19 +670,6 @@ vid_setscreen(struct screeninfo *data, Dev_t dev) data->screen_size); } } - - if(data->pure_vt_mode != -1) - { - if((data->pure_vt_mode == M_HPVT) || - (data->pure_vt_mode == M_PUREVT)) - { - if(data->screen_no == -1) - set_emulation_mode(vsp, data->pure_vt_mode); - else - set_emulation_mode(&vs[minor(dev)], - data->pure_vt_mode); - } - } } /*---------------------------------------------------------------------------* @@ -742,15 +707,6 @@ set_screen_size(struct video_state *svsp, int size) svsp->screen_rows; } - /* screen_rows already calculated in set_charset() */ - if(svsp->vt_pure_mode == M_HPVT && svsp->labels_on) - { - if(svsp->which_fkl == SYS_FKL) - sw_sfkl(svsp); - else if(svsp->which_fkl == USR_FKL) - sw_ufkl(svsp); - } - svsp->scrr_len = svsp->screen_rows; svsp->scrr_end = svsp->scrr_len - 1; @@ -956,136 +912,6 @@ async_update() outb(addr_6845+1, (lastpos)); } } - - /*-------------------------------------------------------------------*/ - /* this takes place ONLY on screen 0 if in HP mode, labels on, !X */ - /*-------------------------------------------------------------------*/ - - /* additional processing for HP necessary ? */ - - if((vs[0].vt_pure_mode == M_HPVT) && (vs[0].labels_on)) - { - static volatile u_char buffer[] = - "System Load: 1min: 0.00 5min: 0.00 15min: 0.00"; - register int tmp, i; -#if PCVT_SHOWKEYS - extern u_char rawkeybuf[80]; - - if(keyboard_show) - { - for(i = 0; i < 80; i++) - { - *((vs[0].Crtat+((vs[0].screen_rows+2) - * vs[0].maxcol))+i) = - user_attr | rawkeybuf[i]; - } - } - else - { -#endif /* PCVT_SHOWKEYS */ - - /* display load averages in last line (taken from tty.c) */ - i = 18; -#ifdef NEW_AVERUNNABLE - tmp = (averunnable.ldavg[0] * 100 + FSCALE / 2) - >> FSHIFT; -#else - tmp = (averunnable[0] * 100 + FSCALE / 2) >> FSHIFT; -#endif - - buffer[i++] = - ((((tmp/100)/10) == 0) ? - ' ' : - ((tmp/100)/10) + '0'); - buffer[i++] = ((tmp/100)%10) + '0'; - buffer[i++] = '.'; - buffer[i++] = ((tmp%100)/10) + '0'; - buffer[i++] = ((tmp%100)%10) + '0'; - i += 6; -#ifdef NEW_AVERUNNABLE - tmp = (averunnable.ldavg[1] * 100 + FSCALE / 2) - >> FSHIFT; -#else - tmp = (averunnable[1] * 100 + FSCALE / 2) >> FSHIFT; -#endif - buffer[i++] = ((((tmp/100)/10) == 0) ? - ' ' : - ((tmp/100)/10) + '0'); - buffer[i++] = ((tmp/100)%10) + '0'; - buffer[i++] = '.'; - buffer[i++] = ((tmp%100)/10) + '0'; - buffer[i++] = ((tmp%100)%10) + '0'; - i += 7; -#ifdef NEW_AVERUNNABLE - tmp = (averunnable.ldavg[2] * 100 + FSCALE / 2) - >> FSHIFT; -#else - tmp = (averunnable[2] * 100 + FSCALE / 2) >> FSHIFT; -#endif - buffer[i++] = ((((tmp/100)/10) == 0) ? - ' ' : - ((tmp/100)/10) + '0'); - buffer[i++] = ((tmp/100)%10) + '0'; - buffer[i++] = '.'; - buffer[i++] = ((tmp%100)/10) + '0'; - buffer[i++] = ((tmp%100)%10) + '0'; - buffer[i] = '\0'; - - for(i = 0; buffer[i]; i++) - { - *((vs[0].Crtat + - ((vs[0].screen_rows + 2) * vs[0].maxcol) - ) + i - ) = user_attr | buffer[i]; - } - -#if PCVT_SHOWKEYS - for(; i < 77; i++) - { - *((vs[0].Crtat + - ((vs[0].screen_rows + 2) * vs[0].maxcol) - ) + i - ) = user_attr | ' '; - } - - } -#endif /* PCVT_SHOWKEYS */ - } - - /*-------------------------------------------------------------------*/ - /* this takes place on EVERY screen which is in HP mode, labels on,!X*/ - /*-------------------------------------------------------------------*/ - - if((vsp->vt_pure_mode == M_HPVT) && (vsp->labels_on)) - { - register int col = vsp->col+1; - register u_short *p = vsp->Crtat + - (vsp->screen_rows * vsp->maxcol); - - /* update column display between labels */ - - if(vsp->maxcol == SCR_COL132) - { - p += (SCR_COL132 - SCR_COL80)/2; - - if(col >= 100) - { - *(p + LABEL_COLU) = user_attr | '1'; - col -= 100; - } - else - { - *(p + LABEL_COLU) = user_attr | '0'; - } - } - *(p + LABEL_COLH) = user_attr | ((col/10) + '0'); - *(p + LABEL_COLL) = user_attr | ((col%10) + '0'); - - /* update row display between labels */ - - *(p + LABEL_ROWH) = (user_attr | (((vsp->row+1)/10) + '0')); - *(p + LABEL_ROWL) = (user_attr | (((vsp->row+1)%10) + '0')); - } } /*---------------------------------------------------------------------------* @@ -1108,8 +934,6 @@ set_charset(struct video_state *svsp, int curvgacs) oldrows = svsp->screen_rows; newsize = sizetab[(vgacs[curvgacs].screen_size)]; newrows = newsize; - if (svsp->vt_pure_mode == M_HPVT) - newrows -= 3; if (newrows == 25 && svsp->force24) newrows = 24; if (newrows < oldrows) { diff --git a/sys/arch/i386/isa/pcvt/pcvt_vtf.c b/sys/arch/i386/isa/pcvt/pcvt_vtf.c index 48cce2a1de1..4300c2d7a94 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_vtf.c +++ b/sys/arch/i386/isa/pcvt/pcvt_vtf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcvt_vtf.c,v 1.9 1999/11/16 21:57:49 aaron Exp $ */ +/* $OpenBSD: pcvt_vtf.c,v 1.10 1999/11/25 20:24:22 aaron Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -566,9 +566,6 @@ vt_str(struct video_state *svsp) svsp->selchar = 0; /* selective attribute off */ vt_initsel(svsp); - init_ufkl(svsp); /* init user fkey labels */ - init_sfkl(svsp); /* init system fkey labels */ - update_led(); /* update keyboard LED's */ } @@ -645,7 +642,6 @@ vt_set_dec_priv_qm(struct video_state *svsp) case 7: /* AWM - auto wrap mode */ svsp->m_awm = 1; - swritefkl(7,(u_char *)"AUTOWRAPENABLE *",svsp); break; case 8: /* ARM - auto repeat mode */ @@ -703,7 +699,6 @@ vt_reset_dec_priv_qm(struct video_state *svsp) case 7: /* AWM - auto wrap mode */ svsp->m_awm = 0; - swritefkl(7,(u_char *)"AUTOWRAPENABLE ",svsp); break; case 8: /* ARM - auto repeat mode */ |