[net.sources] clear for vax/vms

colonel@gloria.UUCP (Col. G. L. Sicherman) (06/10/85)

This program clears the screen under VAX/VMS.  I haven't figured out
how to suppress the error message that says there are no error messages.
-----
/*
 *      clear the screen.  (why is there no command for this?)
 *      Col. Sicherman.  10 Jun 1985.
 */
#define BUFLEN  18
#define SMG$K_ERASE_WHOLE_DISPLAY       474
#include <descrip.h>
#include <dvidef.h>
#include <iodef.h>
#include <stdio.h>
char *outname = "sys$output";
struct dsc$descriptor_s stringp;
main()
{
        short int chan;
        long int s, termtype, event, retlen, termtable, x, y;
        char databuf[BUFLEN];
        stringp.dsc$b_dtype = 1;
        stringp.dsc$b_class = DSC$K_DTYPE_T;
        stringp.dsc$a_pointer = outname;
        stringp.dsc$w_length = strlen(outname);
        s = sys$assign(&stringp, &chan, 0,0);
        if (!(1&s)) {
                fprintf(stderr,
                "CLEAR: ERROR %ld IN ASSIGNING SYS$OUTPUT\n",s);
                exit(1);
        }
        x = DVI$_DEVTYPE;
        s = lib$getdvi(&x, &chan, 0, &termtype);
        if (!(1&s)) {
                fprintf(stderr,"CLEAR: CANNOT GET DEVICE TYPE\n");
                exit(1);
        }
        s=smg$init_term_table_by_type(&termtype, &termtable);
        if (!(1&s)) {
                fprintf(stderr,"CLEAR: UNKNOWN TERM TYPE\n");
                exit(1);
        }
        x = SMG$K_ERASE_WHOLE_DISPLAY;
        y = BUFLEN;
        s = smg$get_term_data(&termtable, &x, &y, &retlen, databuf, 0);
        if (!(1&s)) {
                fprintf(stderr,"CLEAR: CANNOT GET CLEAR SEQUENCE\n");
                exit(1);
        }
        if (!retlen) {
                fprintf(stderr,"CLEAR: NO CLEAR SEQUENCE\n");
                exit(1);
        }
        s = LIB$GET_EF(&event);
        if (!(1&s)) {
                fprintf(stderr,"CLEAR: CANNOT GET EVENT FLAG\n");
                exit(1);
        }
        s = SYS$QIOW(event,chan,
        IO$_WRITEVBLK,0,0,0,databuf,retlen,0,0,0,0);
        if (!(1&s)) {
                fprintf(stderr, "CLEAR: ERROR %ld IN WRITING\n",s);
                exit(1);
        }
        s = LIB$FREE_EF(&event);
        if (!(1&s)) {
                fprintf(stderr,"CLEAR: CANNOT FREE EVENT FLAG\n");
                exit(1);
        }
        exit(0);
}
-- 
Col. G. L. Sicherman
...{rocksvax|decvax}!sunybcs!colonel

eric@grkermi.UUCP (06/11/85)

In article <820@gloria.UUCP> it is written:
>This program clears the screen under VAX/VMS.  I haven't figured out
>how to suppress the error message that says there are no error messages.
> *      clear the screen.  (why is there no command for this?)
> *      Col. Sicherman.  10 Jun 1985.
>...
>Col. G. L. Sicherman
>...{rocksvax|decvax}!sunybcs!colonel

How about the slightly less elegant:

cls:==set term/width=80

It may not work in every possible case, but it works just fine on a vt100!

			-Eric Starkman
	UUCP: ...decvax!genrad!grkermit!eric
	ARPA: starkman@mit-charon.ARPA

umdhep@eneevax.UUCP (Todd Aven) (07/03/85)

What VMS are you running? C version 2.0 has a rudimentary
curses package which would take only about 5 lines of code
to implement a clear-screen routine. If you want to clear
screen without even worrying about terminal type, just
assign a log-name or define a symbol telling the terminal
type that can be read by a command proc containing all
the sequences necessary to clear screen on whatever terminal
you like. It's not pretty, but it sure works well.

============================================================
|Todd Aven               MANAGER@UMDHEP.BITNET             |
|Softwear Sweatshop         AVEN@UMCINCOM (arpanet, bitnet)|
|High Energy Physics      UMDHEP@ENEEVAX.UUCP              |
|University of Maryland                                    |
|College Park, MD 20742                                    |
============================================================

ccrdave@ucdavis.UUCP (Lord Kahless) (07/06/85)

Here is a dcl command file that clears the screen for a vt52 and
three variations of a vt100.  I replaced the <ESC>'s by ^[ in the
file, so if you change them back, it will work.  This is part of
my login.com .... 

I'd have posted earlier if I hadn't thought that everyone had one
of these in their login.com...

$! get your terminal type
$ SET TERM/inquire
$! find out what the terminal type is...
$ lsn = f$logical("sys$command")
$! clear and post a message...
$ if f$getdvi(LSN,"DEVTYPE") .eqs. "110" THEN WRITE SYS$OUTPUT -
 "^[[;H^[[2J"
$ if f$getdvi(LSN,"DEVTYPE") .eqs. "98" THEN WRITE SYS$OUTPUT -
 "^[[;H^[[2J"
$ if f$getdvi(LSN,"DEVTYPE") .eqs. "96" THEN WRITE SYS$OUTPUT -
 "^[[;H^[[2J"
$! The ^[-^[0 sets some options on a common vt52 emulator around
$! u.c. davis, the Microterm Mime 2a. You can set options such as
$! nowrapmargin or nokeyclick if you choose in such a .com file
$ if f$getdvi(LSN,"DEVTYPE") .eqs. "64" THEN WRITE SYS$OUTPUT -
 "^[H^[J^[-^[0"

The C curses package isn't necessary.  You should remember that usually
a user on VMS is using either a vt100 or vt52 family terminal.  If you
use getenv ("TERM") in C, you can deduce the device type.  If it's a
vt52, write out the four character vt52 clear, else if it is a vt100
family terminal (100,101,102, 125, gigi, 200...) write out the vt100
family clear, which is the same on a Wyse 75 as it is on a vt241.

rcb@rti-sel.UUCP (Random) (07/06/85)

If you are running vms v4.x, why not just use the following:

	$ clear :== type/page nl:

-- 
					Random
					Research Triangle Institute
					...!mcnc!rti-sel!rcb

colonel@gloria.UUCP (Col. G. L. Sicherman) (07/09/85)

> If you are running vms v4.x, why not just use the following:
> 
> 	$ clear :== type/page nl:

We run 4.1, and the above command does nothing to my Chat.
Clear.c works fine.
-- 
Col. G. L. Sicherman
UU: ...{rocksvax|decvax}!sunybcs!colonel
CS: colonel@buffalo-cs
BI: csdsicher@sunyabva

rcb@rti-sel.UUCP (Random) (07/15/85)

In article <913@gloria.UUCP> colonel@gloria.UUCP (Col. G. L. Sicherman) writes:
>> If you are running vms v4.x, why not just use the following:
>> 
>> 	$ clear :== type/page nl:
>
>We run 4.1, and the above command does nothing to my Chat.
>Clear.c works fine.
>

This assumes that you have the new terminal stuff (termtable.txt) set up
and working and that your terminal type is set properly. (set term/dev=chat)

-- 
					Random
					Research Triangle Institute
					...!mcnc!rti-sel!rcb

greenber@timeinc.UUCP (Ross M. Greenberg) (07/17/85)

This newsgroup is for source code. Discussion about the source code
should go elsewhere. This article may be followed up in net.followup.
  Howzabout a net.sources.d for discussion?

-- 
------------------------------------------------------------------
Ross M. Greenberg  @ Time Inc, New York 
              --------->{vax135 | ihnp4}!timeinc!greenber<---------

I highly doubt that Time Inc.  would make me their spokesperson.
----
"I was riding a wombat this morning, 'till it broke its leg. I had to
 shoot it"  -- Ranger on Camel

colonel@gloria.UUCP (Col. G. L. Sicherman) (07/18/85)

> >> If you are running vms v4.x, why not just use the following:
> >> 
> >> 	$ clear :== type/page nl:
> >
> >We run 4.1, and the above command does nothing to my Chat.
> >Clear.c works fine.
> 
> This assumes that you have the new terminal stuff (termtable.txt) set up
> and working and that your terminal type is set properly. (set term/dev=chat)

It also assumes that TERMTABLE.TXT has been compiled, and the appropriate
logical symbol points to its directory.

Obviously all this is true, since clear.c works.  TYPE/PAGE NL: does
_not_ work.
-- 
Col. G. L. Sicherman
UU: ...{rocksvax|decvax}!sunybcs!colonel
CS: colonel@buffalo-cs
BI: csdsicher@sunyabva