do_bord.c ; turn borders on/off for PC7300
loci!clb
loci at killer.UUCP
Mon May 9 15:50:11 AEST 1988
If you're running a 7300 without windows, that is without "ua",
then sometimes a window pops up ("lpinfo", etc.) which must be
cleared away. At other times it is convenient to have borders,
for example to switch quickly between DOS-73 and a shell.
Here is a simple program to turn borders on and off. It is
invoked by typeing ...
do_bord on ... to turn borders on or ...
do_bord off ... to turn borders off (80x24)
Turning the borders on results in a window which can be "mouse'd"
from DOS-73, that is to say, it has a bit visible behind the
window used by DOS-73. The environment variables "WNHEIGHT" and
"WNWIDTH" are used, if set.
One known bug: "vi" page size isn't affected by invoking windows
and if "vi" thinks the page is 80x24, it makes a mess in a window.
As always, if you have questions, suggestions, flames, or make
interesting mod's, please send email.
Charles Brunow
clb at loci.uucp
____________________cut_line________
#include <stdio.h>
#include <sys/window.h>
static char author[] = { "@(#)do_bord.c 1.1: clb at loci.uucp (CLBrunow)"};
struct uwdata params =
{ 0, 12, 720, 288, NBORDER, }, /* 80x24 screen, no border */
stdwin =
{ 10, 12, 675, 144, BORDRESIZE, } /* default window */
;
struct utdata labels[] =
{
{ WTXTSLK1, "" },
{ WTXTSLK2, "" },
{ WTXTPROMT, "" },
{ WTXTCMD, "" },
{ WTXTLABEL, "Unix Shell" },
{ WTXTUSER, "Unix Shell" }
};
main(ac, av)
char *av[];
{
int i;
if(ac == 1)
{
printf("usage: %s on|off\n", av[0]);
exit(1);
}
if(av[1][2] == 'f')
ioctl(0, WIOCSETD, ¶ms);
else {
set_stdwin(); /* read environ for win size, if possible */
ioctl(0, WIOCSETD, &stdwin);
}
for(i=0; i<6; i++)
ioctl(0, WIOCSETTEXT, &labels[i]);
exit(0);
}
set_stdwin()
{
int t;
char *p;
extern char *getenv();
if((p = getenv("WNHEIGHT")) != NULL) {
sscanf(p, "%d", &t);
if(t > 0) stdwin.uw_height = t * WTXTVS;
}
if((p = getenv("WNWIDTH")) != NULL) {
sscanf(p, "%d", &t);
if(t > 0) stdwin.uw_width = 9 * t;
}
}
More information about the Unix-pc.sources
mailing list