clear for vax/vms
Col. G. L. Sicherman
colonel at gloria.UUCP
Tue Jun 11 04:35:39 AEST 1985
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
More information about the Comp.sources.unix
mailing list