From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 15-AUG-1989 15:32
To:	MRGATE::"ARISIA::EVERHART"
Subj:	RE:Terminal buffer

Message-Id:  <8908151922.AA05103@crdgw1.ge.com>
Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Tue, 15 AUG 89 11:44:37 PDT
Received: from nwc.navy.mil by KL.SRI.COM with TCP; Tue, 15 Aug 89 11:43:03 PDT
Date: 15 Aug 89 11:34:00 PDT
From: "FIDLER::LEVINE" <levine%fidler.decnet@nwc.navy.mil>
Subject: RE:Terminal buffer
To: "info-vax" <info-vax@kl.sri.com>

	The program below wil show the contents of your terminal buffer
(VMS 4.x only)as well as other operations. It is taken from VAX PRO October 87.

Michael N. LeVine                     Naval Weapons Center
LEVINE%FIDLER.DECNET@NWC.NAVY.MIL     China Lake
(619) 939-2614                        Ca 93555
 avn  437-2614                        USA

$! ------------------ CUT HERE -----------------------
$ v='f$verify(f$trnlnm("SHARE_VERIFY"))'
$!
$! This archive created by VMS_SHARE Version 7.1-004  3-AUG-1989
$!   On 15-AUG-1989 10:31:50.42   By user LEVINE 
$!
$! This VMS_SHARE Written by:
$!    Andy Harper, Kings College London UK
$!
$! Acknowledgements to:
$!    James Gray       - Original VMS_SHARE
$!    Michael Bednarek - Original Concept and implementation
$!
$! TO UNPACK THIS SHARE FILE, CONCATENATE ALL PARTS IN ORDER
$! AND EXECUTE AS A COMMAND PROCEDURE  (  @name  )
$!
$! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING:
$!       1. CMD.MAR;2
$!
$set="set"
$set symbol/scope=(nolocal,noglobal)
$f=f$parse("SHARE_TEMP","SYS$SCRATCH:.TMP_"+f$getjpi("","PID"))
$e="write sys$error  ""%UNPACK"", "
$w="write sys$output ""%UNPACK"", "
$ if f$trnlnm("SHARE_LOG") then $ w = "!"
$ if f$getsyi("version") .ges. "V4.4" then $ goto START
$ e "-E-OLDVER, Must run at least VMS 4.4"
$ v=f$verify(v)
$ exit 44
$UNPACK: SUBROUTINE ! P1=filename, P2=checksum
$ if f$search(P1) .eqs. "" then $ goto file_absent
$ e "-W-EXISTS, File ''P1' exists. Skipped."
$ delete/nolog 'f'*
$ exit
$file_absent:
$ if f$parse(P1) .nes. "" then $ goto dirok
$ dn=f$parse(P1,,,"DIRECTORY")
$ w "-I-CREDIR, Creating directory ''dn'."
$ create/dir 'dn'
$ if $status then $ goto dirok
$ e "-E-CREDIRFAIL, Unable to create ''dn'. File skipped."
$ delete/nolog 'f'*
$ exit
$dirok:
$ w "-I-PROCESS, Processing file ''P1'."
$ define/user sys$output nl:
$ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT 'f'/OUT='P1'
PROCEDURE Unpacker ON_ERROR ENDON_ERROR;SET(FACILITY_NAME,"UNPACK");SET(
SUCCESS,OFF);SET(INFORMATIONAL,OFF);f:=GET_INFO(COMMAND_LINE,"file_name");
buff:=CREATE_BUFFER(f,f);p:=SPAN(" ")@r&LINE_END;POSITION(BEGINNING_OF(buff))
;LOOP EXITIF SEARCH(p,FORWARD)=0;POSITION(r);ERASE(r);ENDLOOP;POSITION(
BEGINNING_OF(buff));g:=0;LOOP EXITIF MARK(NONE)=END_OF(buff);x:=
ERASE_CHARACTER(1);IF g = 0 THEN IF x="X" THEN MOVE_VERTICAL(1);ENDIF;IF x=
"V" THEN APPEND_LINE;MOVE_HORIZONTAL(-CURRENT_OFFSET);MOVE_VERTICAL(1);ENDIF;
IF x="+" THEN g:=1;ERASE_LINE;ENDIF;ELSE IF x="-" THEN g:=0;ENDIF;ERASE_LINE;
ENDIF;ENDLOOP;p:="`";POSITION(BEGINNING_OF(buff));LOOP r:=SEARCH(p,FORWARD);
EXITIF r=0;POSITION(r);ERASE(r);COPY_TEXT(ASCII(INT(ERASE_CHARACTER(3))));
ENDLOOP;o:=GET_INFO(COMMAND_LINE,"output_file");WRITE_FILE(buff,o);
ENDPROCEDURE;Unpacker;EXIT;
$ delete/nolog 'f'*
$ CHECKSUM 'P1'
$ IF CHECKSUM$CHECKSUM .eqs. P2 THEN $ EXIT
$ e "-E-CHKSMFAIL, Checksum of ''P1' failed."
$ ENDSUBROUTINE
$START:
$ create/nolog 'f'
X`009.title`009Command_line_buffer_flush
X;
X;`009Written by Hunter Goatley, Clyde Digital Systems,Orem UT
X;`009
X;`009Published in "VAX Professional" Oct 1987(Vol 9 #5)
X;
X;`009Entered from article with comments removed
X;
Xcmd_buf_beg`009=`009`094x7ffe350f
Xcmd_ptr`009`009=`009`094x7ffe350b
Xcmd_buf_end`009=`009`094x7ffe3910
Xcmd_buffer_addr`009=`009`094x7ffe3500
Xcmd_buffer_len`009=`0091040
Xcmd_buf_len`009=`009cmd_buf_end-cmd_buf_beg
X
X`009$ssdef
X`009$rmsdef
X`009$fabdef
X`009$rabdef
X`009$prvdef
X
X`009.macro`009check`009?here
X`009`009cmpl`009r11,r10
X`009`009bneq`009here
X`009`009movl`009#cmd_buf_end,r10
Xhere:
X`009.endm
X
X`009.macro`009present`009qual,routin1,routin2=0,?label
X`009`009cmpl`009#`094a\QUAL\,for_buff
X`009`009bnequ`009label
X`009`009calls`009#0,routin1
X`009`009.if`009dif`0090,routin2
X`009`009`009blbc`009r0,bye
X`009`009`009calls`009#0,routin2
X`009`009.endc
X`009`009brw`009bye
Xlabel:
X`009.endm
X
X`009.psect`009dcl_commands_data,noexe,wrt,long
X
X`009.align`009long
Xcmdfab:`009$fab`009fnm=<SYS$LOGIN:SAVE_CMDS.TXT>,-
X`009`009fac=<GET,PUT>,-
X`009`009mrs=1420,-
X`009`009org=SEQ
X
X`009.align`009long
Xcmdrab:`009$rab`009fab=cmdfab,-
X`009`009rbf=cmdrec,-
X`009`009rsz=cmd_buffer_len,-
X`009`009usz=cmd_buffer_len,-
X`009`009ubf=cmdrec
Xcmdrec:`009.=.+cmd_buffer_len
X
Xmaxcmdlen=256
X
Xcmdbuffer_d:
X`009.word`009maxcmdlen
X`009.byte`009dsc$k_dtype_t
X`009.byte`009dsc$k_class_s
X`009.address`009.+4
Xcmdbuffer:
X`009.byte`009`094a/ /`091maxcmdlen`093
X
Xfor_buf_d:
X`009.word`009maxcmdlen
X`009.byte`009dsc$k_dtype_t
X`009.byte`009dsc$k_class_s
X`009.address`009.+4
Xfor_buff:
X`009.blkb`009maxcmdlen
Xfor_len:.long`0090
Xusage_d:
X`009.ascid`009-
X\Must give valid qualifier: /LIST, /FLUSH, /SAVE, /RESTORE, /BOTH (save,flus
Vh)\
Xcmexec:`009.quad`009prv$m_cmexec
Xcmkrnl:`009.quad`009prv$m_cmkrnl
X
X`009.psect`009dcl_cmds,exe,nowrt
X`009.entry`009dcl_cmds,`094m<>
X`009pushaw`009for_len
X`009pushl`009#0
X`009pushaq`009for_buf_d
X`009calls`009#3,g`094lib$get_foreign
X`009tstw`009for_len
X`009bneq`00910$
X`009pushaq`009usage_d
X`009calls`009#1,g`094lib$put_output
X`009brw`009bye
X10$:`009present`009</RES>,restore_cmds
X`009present`009</LIS>,list_cmds
X`009present </FLU>,flush_cmds
X`009present`009</SAV>,save_cmds
X`009present`009</BOT>,save_cmds,flush_cmds
X`009pushaq`009usage_d
X`009calls`009#1,g`094lib$put_output
Xbye:`009$exit_s`009r0
X
X`009.entry`009save_cmds,`094m<>
X`009$create`009fab=cmdfab
X`009blbc`009r0,100$
X`009$connect`009rab=cmdrab
X`009blbc`009r0,100$
X`009movc3`009#cmd_buffer_len,@#cmd_buffer_addr,cmdrec
X`009$put`009rab=cmdrab
X`009blbc`009r0,100$
X`009$close`009fab=cmdfab
X100$:`009ret
X
X`009.entry`009restore_cmds,`094m<>
X`009calls`009#0,getprv
X`009blbc`009r0,100$
X`009$open`009fab=cmdfab
X`009blbc`009r0,100$
X`009$connect`009rab=cmdrab
X`009blbc`009r0,100$
X`009$get`009rab=cmdrab
X`009blbc`009r0,100$
X`009$cmexec_s`009routin=exec_restore
X`009$close`009fab=cmdfab
X100$:`009ret
X
X`009.entry`009exec_restore,`094m<>
X`009moval`009handler,(fp)
X`009movc3`009#cmd_buffer_len,cmdrec,@#cmd_buffer_addr
X`009movzbl`009#ss$_normal,r0
X`009ret
X`009.entry`009handler,`094m<>
X`009$exit_s
X
X`009.entry`009list_cmds,`094m<r2,r3,r4,r5,r6,r7,r8,r9,r10,r11>
X`009movl`009@#cmd_ptr,r10
X`009movl`009r10,r9
X`009movl`009#cmd_buf_beg,r11
Xlloop:`009movab`009cmdbuffer,r8
X`009movc5`009#0,#0,#`094a/ /,#maxcmdlen,(r8)
X`009movzbl`009-(r10),r7
X`009beqlu`009lfin
X`009movw`009r7,cmdbuffer_d
X`009check
X`009addl2`009r7,r8
Xlloop1:`009movb`009-(r10),-(r8)
X`009check
X`009sobgtr`009r7,lloop1
X`009pushaq`009cmdbuffer_d
X`009calls`009#1,g`094lib$put_output
X`009decl`009r10
X`009check
X`009decl`009r10
X`009check
X`009cmpl`009r10,r9
X`009beql`009lfin
X`009brb`009lloop
Xlfin:`009movl`009#ss$_normal,r0
X`009ret
X
X`009.entry`009flush_cmds,`094m<>
X`009calls`009#0,getprv
X`009blbc`009r0,5$
X`009$cmexec_s`009routin=exec_flush
X5$:`009ret
X`009.entry`009exec_flush,`094m<r2,r3,r4,r5>
X`009movc5`009#0,#0,#0,#cmd_buf_len,@#cmd_buf_beg
X`009movl`009#cmd_buf_beg,@#cmd_ptr
X`009movl`009#ss$_normal,r0
X`009ret
X
X`009.entry`009getprv,`094m<>
X`009$setprv_s`009enbflg=#1,prvadr=cmexec
X`009cmpl`009#ss$_normal,r0
X`009beqlu`0095$
X`009$setprv_s`009enbflg=#1,prvadr=cmkrnl
X`009cmpl`009#ss$_normal,r0
X`009beqlu`0095$
X`009movl`009#ss$_nocmexec,r0
X5$:`009ret
X`009.end`009dcl_cmds
$ CALL UNPACK CMD.MAR;2 1477235597
$ v=f$verify(v)
$ EXIT


