home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
OS2UTIL.ZIP
/
SM.C
< prev
next >
Wrap
Text File
|
1990-05-21
|
4KB
|
133 lines
#define INCL_SUB
#include <os2def.h>
#include <bsesub.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* *argv);
int rattr(void);
main(argc, argv)
int argc;
char *argv[];
{
VIOMODEINFO modedata;
VIOCURSORINFO cursordata;
int row, col, up;
if (argc != 2) {
puts("syntax: sm 25 | 43 | 50");
return(0);
}
switch(atoi(argv[1])) {
case 50:
VioGetCurPos(&row, &col, 0);
modedata.cb = sizeof( modedata );
VioGetMode( &modedata, 0 );
modedata.row = 50;
VioSetMode( &modedata, 0 );
cursordata.yStart = 6;
cursordata.cEnd = 7;
cursordata.cx = 1;
cursordata.attr = 0;
VioSetCurType( &cursordata, 0 );
VioSetCurPos( row, col, 0 );
break;
case 43:
VioGetCurPos(&row, &col, 0);
modedata.cb = sizeof( modedata );
VioGetMode( &modedata, 0 );
modedata.row = 43;
VioSetMode( &modedata, 0 );
cursordata.yStart = 6;
cursordata.cEnd = 7;
cursordata.cx = 1;
cursordata.attr = 0;
VioSetCurType( &cursordata, 0 );
VioSetCurPos( row, col, 0 );
break;
case 40:
modedata.cb = sizeof( modedata );
VioGetMode( &modedata, 0 );
up = (modedata.row == 25);
if (up)
VioGetCurPos(&row, &col, 0);
else
{
static char buffer[2] = { 0x20, 0x07 };
buffer[1] = (char) rattr();
VioScrollUp( 0, 0, -1, -1, -1, (char far *)buffer, 0 );
}
modedata.row = 40;
VioSetMode( &modedata, 0 );
cursordata.yStart = 8;
cursordata.cEnd = 9;
cursordata.cx = 1;
cursordata.attr = 0;
VioSetCurType( &cursordata, 0 );
if (up)
VioSetCurPos( row, col, 0 );
else
VioSetCurPos( 0, 0, 0 );
break;
case 35:
modedata.cb = sizeof( modedata );
VioGetMode( &modedata, 0 );
up = (modedata.row == 25);
if (up)
VioGetCurPos(&row, &col, 0);
else
{
static char buffer[2] = { 0x20, 0x07 };
buffer[1] = (char) rattr();
VioScrollUp( 0, 0, -1, -1, -1, (char far *)buffer, 0 );
}
modedata.row = 35;
VioSetMode( &modedata, 0 );
cursordata.yStart = 8;
cursordata.cEnd = 9;
cursordata.cx = 1;
cursordata.attr = 0;
VioSetCurType( &cursordata, 0 );
if (up)
VioSetCurPos(row, col, 0);
else
VioSetCurPos( 0, 0, 0 );
break;
case 25: {
static char buffer[2] = { 0x20, 0x07 };
buffer[1] = (char) rattr();
VioScrollUp( 0, 0, -1, -1, -1, (char far *)buffer, 0 );
modedata.cb = sizeof( modedata );
VioGetMode( &modedata, 0 );
modedata.row = 25;
VioSetMode( &modedata, 0 );
cursordata.yStart = 12;
cursordata.cEnd = 13;
cursordata.cx = 1;
cursordata.attr = 0;
VioSetCurType( &cursordata, 0 );
VioSetCurPos( 0, 0, 0 );
break; }
}
return atoi(argv[1]);
}
rattr() /* read attribute */
{ /* reads foreground and background color */
char attr[2];
USHORT cb = sizeof(attr);
USHORT row, col;
VioGetCurPos(&row, &col, 0);
VioReadCellStr(attr, &cb, row-1, 0, 0);
return(attr[1]);
}