diff options
author | Aaron Campbell <aaron@cvs.openbsd.org> | 1999-09-29 22:29:11 +0000 |
---|---|---|
committer | Aaron Campbell <aaron@cvs.openbsd.org> | 1999-09-29 22:29:11 +0000 |
commit | e910229d957f629858fbeb1fd633fe6f329e47eb (patch) | |
tree | b363b3e5a252c85e28ed1ae66df0c3b637221685 /sys | |
parent | 73258f45c7115f42f1616395e5a825ea77e2a056 (diff) |
- Add an ioctl to pcvt that adjusts the size of the scrollback buffer.
- In scon(1), provide a -b option as an interface to this ioctl.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/i386/isa/pcvt/Util/scon/scon.1 | 9 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/Util/scon/scon.c | 27 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_ext.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_hdr.h | 6 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_ioctl.h | 3 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_out.c | 7 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_sup.c | 15 |
7 files changed, 56 insertions, 15 deletions
diff --git a/sys/arch/i386/isa/pcvt/Util/scon/scon.1 b/sys/arch/i386/isa/pcvt/Util/scon/scon.1 index 23f4240dac8..615b2fa98ca 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.8 1999/07/09 13:35:32 aaron Exp $ +.\" $OpenBSD: scon.1,v 1.9 1999/09/29 22:29:10 aaron Exp $ .\" .\" Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch .\" @@ -41,6 +41,7 @@ .Sh SYNOPSIS .Nm scon .Op Fl a +.Op Fl b Ar num .Op Fl c Ar screenno .Op Fl d Ar device .Op Fl f Ar on|off @@ -83,6 +84,10 @@ The options are as follows: .It Fl a Returns a string describing the video adaptor found by pcvt, the string returned could be MDA, HGC, CGA, EGA, VGA or UNKNOWN. +.It Fl b +Set the number of scrollback buffer pages to +.Ar num . +The minimum value is 2, maximum 100. .It Fl c Specify the screen number the current (displayed) screen should be switched to. @@ -206,7 +211,7 @@ Invoking will result in green on gray output for normal text. Note that normal text color is light gray, and not white as one might expect. .Sh BUGS -the +The .Fl c and .Fl d diff --git a/sys/arch/i386/isa/pcvt/Util/scon/scon.c b/sys/arch/i386/isa/pcvt/Util/scon/scon.c index 436cd143764..0795fb956c8 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.12 1999/05/24 15:37:44 aaron Exp $ */ +/* $OpenBSD: scon.c,v 1.13 1999/09/29 22:29:10 aaron Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch @@ -68,6 +68,8 @@ static char *id = #define DEFAULTFD 0 int aflag = -1; +int bflag = -1; +unsigned int scrollback_pages = 8; int lflag = -1; int mflag = -1; int current = -1; @@ -206,13 +208,18 @@ char *argv[]; int c; int fd; - while( (c = getopt(argc, argv, "ac:d:f:HVlms:t:vp:18")) != -1) + while( (c = getopt(argc, argv, "ab:c:d:f:HVlms:t:vp:18")) != -1) { switch(c) { case 'a': aflag = 1; break; + + case 'b': + bflag = 1; + scrollback_pages = atoi(optarg); + break; case 'l': lflag = 1; @@ -336,7 +343,7 @@ char *argv[]; if(dflag == -1 && lflag == -1 && current == -1 && pflag == -1 && hflag == -1 && res == -1 && Pflag == 0 && tflag == 0 && fflag == -1 - && colms == 0 && mflag == -1) + && colms == 0 && mflag == -1 && bflag == -1) { lflag = 1; } @@ -367,6 +374,20 @@ char *argv[]; exit(0); } + if (bflag == 1) + { + if(vflag) + printf("Setting number of scrollback buffer pages "); + printf("to %d.\n", scrollback_pages); + + if(ioctl(fd, SETSCROLLSIZE, &scrollback_pages) < 0) + { + perror("ioctl(SETSCROLLSIZE)"); + exit(2); + } + exit(0); + } + if(mflag == 1) /* return monitor type */ { printmonitor(fd); diff --git a/sys/arch/i386/isa/pcvt/pcvt_ext.c b/sys/arch/i386/isa/pcvt/pcvt_ext.c index 85425fca42c..0937e85aa1f 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.21 1999/09/28 20:36:04 aaron Exp $ */ +/* $OpenBSD: pcvt_ext.c,v 1.22 1999/09/29 22:29:10 aaron Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -2552,7 +2552,7 @@ vgapage(int new_screen) { /* we are committed */ vt_switch_pending = 0; - reallocate_scrollbuffer(vsp, SCROLLBACK_PAGES); + reallocate_scrollbuffer(vsp, scrollback_pages); } } return 0; diff --git a/sys/arch/i386/isa/pcvt/pcvt_hdr.h b/sys/arch/i386/isa/pcvt/pcvt_hdr.h index 633299299e9..8cf173166ab 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.24 1999/09/28 20:36:04 aaron Exp $ */ +/* $OpenBSD: pcvt_hdr.h,v 1.25 1999/09/29 22:29:10 aaron Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -603,7 +603,7 @@ #define SYS_FKL 0 /* in hp mode, sys-fkls are active */ #define USR_FKL 1 /* in hp mode, user-fkls are active */ -/* scrollback buffer size (in pages) */ +/* initial default scrollback buffer size (in pages) */ #define SCROLLBACK_PAGES 8 /* variables */ @@ -829,6 +829,7 @@ struct tty *pcconsp; /* ptr to current device, see pcattach() */ 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}}; @@ -988,6 +989,7 @@ extern u_char keyboard_is_initialized; extern u_char kbd_polling; extern u_short *Scrollbuffer; +extern u_short scrollback_pages; #if PCVT_SHOWKEYS extern u_char keyboard_show; diff --git a/sys/arch/i386/isa/pcvt/pcvt_ioctl.h b/sys/arch/i386/isa/pcvt/pcvt_ioctl.h index 2348053a54a..a702caf4320 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.10 1998/09/28 03:00:28 downsj Exp $ */ +/* $OpenBSD: pcvt_ioctl.h,v 1.11 1999/09/29 22:29:09 aaron Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -478,6 +478,7 @@ struct pcvtinfo { /* compile time option values */ }; #define VGASETCOLMS _IOW('V', 115, int) /* set number of columns (80/132)*/ +#define SETSCROLLSIZE _IOW('V', 116, u_short) /* scrollbuffer size */ /* * only useful if compiled with ``XSERVER'' defined, but always here: diff --git a/sys/arch/i386/isa/pcvt/pcvt_out.c b/sys/arch/i386/isa/pcvt/pcvt_out.c index b9cd2ce3d0b..acb7f3a3e68 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.11 1999/09/29 21:01:01 aaron Exp $ */ +/* $OpenBSD: pcvt_out.c,v 1.12 1999/09/29 22:29:10 aaron Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -1392,8 +1392,9 @@ vt_coldmalloc(void) MAXROW_VGA * MAXCOL_VGA * CHR; } + scrollback_pages = SCROLLBACK_PAGES; if ((Scrollbuffer = (u_short *)malloc(vs[0].maxcol * - vs[0].screen_rows * SCROLLBACK_PAGES * CHR, M_DEVBUF, + vs[0].screen_rows * scrollback_pages * CHR, M_DEVBUF, M_WAITOK)) == NULL) { printf("pcvt: scrollback memory malloc failed\n"); @@ -1966,7 +1967,7 @@ vt_col(struct video_state *svsp, int cols) #endif /* PCVT_SIGWINCH */ } - reallocate_scrollbuffer(svsp, SCROLLBACK_PAGES); + reallocate_scrollbuffer(svsp, scrollback_pages); return(1); } diff --git a/sys/arch/i386/isa/pcvt/pcvt_sup.c b/sys/arch/i386/isa/pcvt/pcvt_sup.c index b2e4a4f1bda..001eb999ea2 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.9 1999/09/28 20:36:05 aaron Exp $ */ +/* $OpenBSD: pcvt_sup.c,v 1.10 1999/09/29 22:29:10 aaron Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -224,6 +224,17 @@ vgaioctl(Dev_t dev, int cmd, caddr_t data, int flag) return EINVAL; break; + case SETSCROLLSIZE: + if (*(u_short *)data < 2) + scrollback_pages = 2; + else if (*(u_short *)data > 100) + scrollback_pages = 100; + else + scrollback_pages = *(u_short *)data; + + reallocate_scrollbuffer(vsp, scrollback_pages); + break; + case TIOCSWINSZ: /* do nothing here */ break; @@ -739,7 +750,7 @@ set_screen_size(struct video_state *svsp, int size) pgsignal(svsp->vs_tty->t_pgrp, SIGWINCH, 1); #endif /* PCVT_SIGWINCH */ - reallocate_scrollbuffer(svsp, SCROLLBACK_PAGES); + reallocate_scrollbuffer(svsp, scrollback_pages); break; } } |