From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 14-DEC-1989 09:48
To:	MRGATE::"ARISIA::EVERHART"
Subj:	RETRIEVE, part 1 of 5

Received: From NAC.NO by GIZMO.SRI.COM with TCP; Thu, 14 DEC 89 04:20:54 PDT
Received: from runix.runit.sintef.no by nac.no (5.61++/1.15) with SMTP 
	id AA03091; Thu, 14 Dec 89 13:18:53 +0100
Received: by runix.runit.sintef.no (norunix.EARN) (1.2/7.8)
	id AA11298;  Thu, 14 Dec 89 13:19:22 +0100
Date: 14 Dec 89 13:18 +0100
From: Jo Torsmyr <j_torsmyr%avh.unit.uninett@nac.no>
To: <info-vax@kl.sri.com>
Message-Id: <237*j_torsmyr@avh.unit.uninett>
Subject: RETRIEVE, part 1 of 5


Here is a reposting of part 1.

NB: Note that this version of Retrieve runs under VMS 5.X. If you want a
version which runs under VMS 4.X, I have to get it from some tape.


Jo Torsmyr UNIT AVH Trondheim Norway
j_torsmyr@avh.unit.uninett


$! ................... Cut between dotted lines and save. ...................
$!...........................................................................
$! VAX/VMS archive file created by VMS_SHARE V06.10 7-FEB-1989.
$!
$! VMS_SHARE was written by James Gray (Gray:OSBUSouth@Xerox.COM) from
$! VMS_SHAR by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au).
$!
$! To unpack, simply save, concatinate all parts into one file and
$! execute (@) that file.
$!
$! This archive was created by user J_TORSMYR
$! on 12-DEC-1989 15:24:27.10.
$!
$! ATTENTION: To keep each article below 31 blocks (15872 bytes), this
$!            program has been transmitted in 5 parts.  You should
$!            concatenate ALL parts to ONE file and execute (@) that file.
$!
$! It contains the following 7 files:
$!        AAAREADME.1ST
$!        MAKE.COM
$!        RETRIEVE.CLD
$!        RETRIEVE.HLP
$!        RETRIEVE.PAS
$!        RETRIEVE_RTL_ROUTINES.PSE
$!        RET_MSG.MSG
$!
$!============================================================================
$ SET SYMBOL/SCOPE=( NOLOCAL, NOGLOBAL )
$ VERSION = F$GETSYI( "VERSION" )
$ IF VERSION .GES "V4.4" THEN GOTO VERSION_OK
$ WRITE SYS$OUTPUT "You are running VMS ''VERSION'; ", -
    "VMS_SHARE V06.10 7-FEB-1989 requires VMS V4.4 or higher."
$ EXIT 44 ! SS$_ABORT
$VERSION_OK:
$ GOTO START
$!
$UNPACK_FILE:
$ WRITE SYS$OUTPUT "Creating ''FILE_IS'"
$ DEFINE/USER_MODE SYS$OUTPUT NL:
$ EDIT/TPU/COMMAND=SYS$INPUT/NODISPLAY/OUTPUT='FILE_IS'/NOSECTION -
    VMS_SHARE_DUMMY.DUMMY
b_part := CREATE_BUFFER( "{Part}", GET_INFO( COMMAND_LINE, "file_name" ) )
; s_file_spec := GET_INFO( COMMAND_LINE, "output_file" ); SET( OUTPUT_FILE
, b_part, s_file_spec ); b_errors := CREATE_BUFFER( "{Errors}" ); i_errors 
:= 0; pat_beg_1 := ANCHOR & "-+-+-+ Beginning"; pat_beg_2 := LINE_BEGIN 
& "+-+-+-+ Beginning"; pat_end := ANCHOR & "+-+-+-+-+ End"; POSITION
( BEGINNING_OF( b_part ) ); LOOP EXITIF SEARCH( SPAN( ' ' )@r_trail 
& LINE_END, FORWARD) = 0; POSITION( r_trail ); ERASE( r_trail ); ENDLOOP
; POSITION( BEGINNING_OF( b_part ) ); i_append_line := 0; LOOP EXITIF MARK
( NONE ) = END_OF( b_part ); s_x := ERASE_CHARACTER( 1 )
; IF s_x = '+' THEN r_skip := SEARCH( pat_beg_1, FORWARD, EXACT ); IF r_skip 
<> 0 THEN s_x := ''; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ERASE_LINE; ENDIF
; ENDIF; IF s_x = '-' THEN r_skip := SEARCH( pat_end, FORWARD, EXACT )
; IF r_skip <> 0 THEN s_x := ''; MOVE_HORIZONTAL( -CURRENT_OFFSET ); m_skip 
:= MARK( NONE ); r_skip := SEARCH( pat_beg_2, FORWARD, EXACT ); IF r_skip 
<> 0 THEN POSITION( END_OF( r_skip ) ); MOVE_HORIZONTAL( -CURRENT_OFFSET )
; MOVE_VERTICAL( 1 ); MOVE_HORIZONTAL( -1 ); ELSE POSITION( END_OF( b_part ) 
); ENDIF; ERASE( CREATE_RANGE( m_skip, MARK( NONE ), NONE ) ); ENDIF; ENDIF
; IF s_x = 'V' THEN s_x := ''; IF i_append_line <> 0 THEN APPEND_LINE
; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ENDIF; i_append_line := 1
; MOVE_VERTICAL( 1 ); ENDIF; IF s_x = 'X' THEN s_x := ''; IF i_append_line 
<> 0 THEN APPEND_LINE; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ENDIF
; i_append_line := 0; MOVE_VERTICAL( 1 ); ENDIF; IF s_x <> '' THEN i_errors 
:= i_errors + 1; s_text := CURRENT_LINE; POSITION( b_errors ); COPY_TEXT
( "The following line could not be unpacked properly:" ); SPLIT_LINE
; COPY_TEXT( s_x ); COPY_TEXT( s_text ); POSITION( b_part ); MOVE_VERTICAL
( 1 ); ENDIF; ENDLOOP; POSITION( BEGINNING_OF( b_part ) ); LOOP r_x := SEARCH
( "`", FORWARD, EXACT ); EXITIF r_x = 0; POSITION( r_x ); ERASE_CHARACTER( 1 
); COPY_TEXT( ASCII( INT( ERASE_CHARACTER( 3 ) ) ) ); ENDLOOP
; IF i_errors = 0 THEN SET( NO_WRITE, b_errors, ON ); ELSE POSITION
( BEGINNING_OF( b_errors ) ); COPY_TEXT( FAO
( "The following !UL errors were detected while unpacking !AS", i_errors
, s_file_spec ) ); SPLIT_LINE; SET( OUTPUT_FILE, b_errors, "SYS$COMMAND" )
; ENDIF; EXIT; 
$ DELETE VMS_SHARE_DUMMY.DUMMY;*
$ CHECKSUM 'FILE_IS
$ WRITE SYS$OUTPUT " CHECKSUM ", -
  F$ELEMENT( CHECKSUM_IS .EQ. CHECKSUM$CHECKSUM, ",", "failed!!,passed." )
$ RETURN
$!
$START: 
$ FILE_IS = "AAAREADME.1ST"
$ CHECKSUM_IS = 376840789
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
XRetrieve *must* be installed with the CMEXEC priv. Otherwise nothing works!
X
XChange the directory for the RETRIEVE.EXE image in the .CLD-file. I have
Xused SYS$UTIL:.
X
XPlease report any probs. with the files/source...
X
XJo Torsmyr, UNIT AVH Norway
Xj_torsmyr@avh.unit.uninett
Xjo_torsmyr@avh.unit.uninett
Xtorsmyr@noruint
$ GOSUB UNPACK_FILE

$ FILE_IS = "MAKE.COM"
$ CHECKSUM_IS = 1531930830
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X$! Build RETRIEVE
X$!
X$ Pascal/NoObject Retrieve_RTL_Routines.Pse
X$ Pas Retrieve
X$ Message Ret_Msg
X$ Link Retrieve,Ret_Msg,Sys$System:Sys.Stb/Selective_Search/NoTrace
X$ EXIT
$ GOSUB UNPACK_FILE

$ FILE_IS = "RETRIEVE.CLD"
$ CHECKSUM_IS = 1428877691
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
XDEFINE VERB Retrieve
X
X
X!   Syntax:
X!
X!   /Log may be used on any qualifier
X!
X!`009$ Retrieve [<Cmd>`124<Nr>]
X!`009$ Retrieve/All
X!`009$ Retrieve/Erase
X!`009$ Retrieve/Flush
X!`009$ Retrieve/List[=Start=<Nr>][,][End=<Nr>]
X!`009$ Retrieve/Restore[=<File>]
X!`009$ Retrieve/Save[=<File>]
X!`009$ Retrieve/Verify
X!
X!`009Combinations:
X!
X!`009$ Retrieve/Save/Flush
X!`009$ Retrieve/List/Save
X!`009$ Retrieve/Restore/List
X!
X
XIMAGE`009    Sys$Util:Retrieve
X
XPARAMETER   p1`009`009Label = Command
X`009`009`009Value (Type = $Rest_Of_Line, Default = 1)
X
XQualifier   All`009`009NonNegatable
X
XQualifier   Erase`009NonNegatable
X
XQUALIFIER   Flush`009NonNegatable
X
XQUALIFIER   List`009NonNegatable
X`009`009`009Value (List, Type = List_Options)
X
XQUALIFIER   Log
X
XQUALIFIER   Restore`009NonNegatable
X`009`009`009Value (Type = $File, Default = Sys$Login:Retrieve.Dat)
X
XQUALIFIER   Save`009NonNegatable
X`009`009`009Value (Type = $File, Default = Sys$Login:Retrieve.Dat)
X`009`009`009Synonym Put
X`009`009`009Synonym Store
XQUALIFIER   Verify
X
XDISALLOW    ANY2 (Command, Restore, Save)
XDISALLOW    ANY2 (Command, Erase, Flush, List)
XDISALLOW    (Erase OR Flush) AND Restore
XDISALLOW    List.All AND (List.Start OR List.End)
X
X
XDEFINE TYPE List_Options
X
XKEYWORD`009    All`009`009Default
XKEYWORD`009    Start`009Value (Required, Type = $Number)
XKEYWORD`009    End`009`009Value (Required, Type = $Number)
$ GOSUB UNPACK_FILE

$ FILE_IS = "RETRIEVE.HLP"
$ CHECKSUM_IS = 1585106568
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X1 RETRIEVE
X
X  The  RETRIEVE  command  is  an extension  of the RECALL command. The
X  command  displays  previously  entered  commands  so  that  you  can
X  reprocess them. RETRIEVE is written by Jo Torsmyr, UNIT AVH.
X
X  Format:
X
X
X    RETRIEVE  [command-specifier]
X
X2 Parameters
X
X  command-specifier
X
X  Specifies the number or leading substring of the command you wish to
X  retrieve.
X
X  Command numbers can range from 1 to 255.  The most recently  entered
X  command is number  1.   If  you omit the command specifier, RETRIEVE
X  retrieves the most recently entered command.  Command 2 is  the next
X  to  last command entered.  The  RETRIEVE  command  itself  is  never
X  assigned a number, it is deleted.
X
X  The term "leading substring" refers to the first several  characters
X  in  a  command  string.   The  substring can be as short as a single
X  character.  If the  substring is  not unique, RETRIEVE retrieves the
X  most  recently issued  command line that matches the substring.  For
X  example, suppose you issue a SHOW STATUS command and later  issue  a
X  SHOW TIME command.  If  you  then  type  RETRIEVE S,  the  SHOW TIME
X  command is retrieved. You must type RETRIEVE SHOW S, to retrieve the
X  SHOW STATUS command.
X
X  You can use the /LIST qualifier to have the system  display  all the
X  commands  in the RETRIEVE buffer,  along with their command numbers,
X  to verify the number of the command you want to retrieve.
X
X2 Command_Qualifiers
X
X/ALL
X
X /ALL
X
X  Displays all the commands in the recall buffer.
X
X/ERASE
X
X /ERASE
X
X  See /FLUSH.
X
X/FLUSH
X
X /FLUSH
X
X  Flushes the RETRIEVE buffer.  May not be used with the /RESTORE  and
X  /LIST qualifiers.
X
X/LIST
X
X /LIST[=(keyword[,...])]    (Default = /LIST=ALL)
X
X  Specifies  that  all  the commands  currently stored in the RETRIEVE
X  buffer be displayed, along with their command numbers. Remember that
X  the RETRIEVE command is never stored in the RETRIEVE buffer.
X
X  Keyword can have one of the following values:
X
X      ALL                 Displays all the commands in the buffer.
X
X      START = lower limit Specifies the number of the first command to
X                          be displayed. If omitted, the lower limit is
X                          set to 1.
X
X      END = upper limit   Specifies the number of the first command to
X                          be displayed.  The upper limit  must be less
X                          than or equal to 255. If omitted, the  upper
X                          limit is set  to the  number of  commands in
X                          the RETRIEVE buffer.
X
X  The /LIST qualifier can not be used with the /FLUSH qualifier.
X
X/LOG
X
X /LOG
X /NOLOG (Default)
X
X  Specifies whether status messages should be display.
X
X/RESTORE
X
X /RESTORE[=filename]     (Default = /RESTORE= SYS$LOGIN:RETRIEVE.DAT)
X
X  Flushes the buffer  and restores  the commands stored in the  given
X  file. May not be used together with the /SAVE qualifier.
X
X/SAVE
X
X /SAVE[=filename]        (Default = /SAVE= SYS$LOGIN:RETRIEVE.DAT)
X
X  Saves the buffer to the given file.  May not be used together  with
X  the /RESTORE qualifier.
X
X/VERIFY
X
X /VERIFY
X /NOVERIFY (Default)
X
X  Displays the current installed version of RETRIEVE.
X
X2 Examples
X
X  1.   $ SHOW DEFAULT
X         DISK3:[SMITH]
X       $ DIRECTORY SEPT*
X       $ SET DEFAULT [SMITH.LETTERS]
X       $ RETRIEVE/LIST/NOLOG
X        1 SET DEFAULT [SMITH.LETTERS]
X        2 DIRECTORY SEPT*
X        3 SHOW DEFAULT
X       $ RETRIEVE 2
X       $ DIRECTORY SEPT* <RETURN>
X       $ RETRIEVE 2
X       $ SET DEFAULT [SMITH.MEMOS] <RETURN>
X       $ RETRIEVE DIR
X       $ DIRECTORY SEPT* <RETURN>
X
X  This example starts with a SHOW DEFAULT  and  a  DIRECTORY  command.
X  Not  finding the file you want, you issue the SET DEFAULT command to
X  move to the LETTERS subdirectory.  You then  use  the  RETRIEVE/LIST
X  command to see the list of commands you have entered. When you issue
X  the  RETRIEVE 2 command, the system repeats the DIRECTORY command in
X  the LETTERS  subdirectory.   Since you have still not found the file
X  you want,  you issue the RETRIEVE command again to retrieve the  SET
X  DEFAULT command. Because you issued the DIRECTORY command again, the
X  SET DEFAULT  command becomes  command 2 in the RETRIEVE list.  Using
X  the  DELETE  key, you can edit  the command  line so that the system
X  will  set  the  default  to  the MEMOS  subdirectory.  Finally,  you
X  retrieve the DIRECTORY command to try once more to find the file. At
X  this point  there are  two identical DIRECTORY commands in the list,
X  numbered 2 and 4.  Press  RETURN to  process the  retrieved command.
X
X
X  2.  $ RETRIEVE/SAVE= C.BUF/NOLOG/FLUSH
X      $ RETRIEVE/RESTORE= LAST.BUF/LIST=(START=6,END=33)
X      %RETR-S-RESFROFIL, commands restored from file DISK1:[JONES]
X      LAST.BUF;4
X       6 Sh Users
X       7 Dir
X       .`032
X       .
X       .
X      33 PHONE JO_TORSMYR
X      %RETR-I-TOTOFCMDS, total of 35 commands
X
X  Saves the  current contents of the RETRIEVE buffer in the file C.BUF
X  and flushes the commands. /NOLOG indicates that no message should be
X  displayed.
X  The contents of the file LAST.BUF is then copied into the buffer and
X  the commands are listed.
$ GOSUB UNPACK_FILE

$ FILE_IS = "RETRIEVE.PAS"
$ CHECKSUM_IS = 842360158
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X[INHERIT ('Retrieve_RTL_Routines', 'Sys$Library:Starlet')]
XPROGRAM Retrieve (Input, Output) ;
X`032
X`123
XPROGRAM DESCRIPTION:`032
X`032
X
X`009This program is an extension of the RECALL command. The VMS terminal
X`009driver (TTDRIVER) has a last-command recall capability that DCL
X`009disables; DCL stores the commands in its own buffer in a user's P1
X`009address space (program & data area). A 1025-byte buffer starting at
X`009virtual address "PhysStartAddr" is used to store the DCL commands.
X`009Depending on the length of the commands, as many as 100 or more
X`009could be stored (max is 256!). The commands are stored beginning at
X`009"PhysStartAddr" and extending through "PhysEndAddr". The longword at
X`009location "PhysPointerAddr" is a pointer`009to the end of the last
X`009command stored in the buffer (NULL).
X
X`009Each command is preceded and followed by a count byte, with a NULL (0)
V`009byte separating commands. The count byte, which holds the length of the`0
X32
X`009command, is used to let DCL know how many bytes to show as you use
X`009your cursor keys to step through the list. When you press the UP-arrow
X`009key, DCL uses the pointer (at "PhysPointerAddr") as the starting
X`009location. The pointer is actually the address of the NULL byte
X`009following thelast command. The pointer is decremented so that it
X`009points to the length of the last command, which then is used as the
X`009number of bytes to output to the terminal. After the command has been
X`009displayed, the command pointer is positioned at the NULL byte
X`009separating the last two commands. Then, depending on whether the
X`009UP-arrow or DOWN-arrow key is pressed, DCL moves forward or backward
X`009through the buffer.
X
X`009When the command buffer is full, DCL wraps the buffer so that it
X`009starts over again at "PhysStartAddr". Any resulting partial command
X`009is then zeroed out, so that DCL doesnt get confused and output part
X`009of a command. To flush or restore the command buffer, you have to
X`009run in kernel or executive mode.
X
X`009The recallbuffer has the following format:
X
X`009"PhysStartAddr"...`009    --->`009`009"PhysStartAddr"...
X`009-----------------------------------------------------------------
V`009... `124 0 `124 3 `124 D `124 I `124 R `124 3 `124 0 `124 4 `124 M `124 A
X `124 I `124 L `124 4 `124 0 `124 ...
X`009-----------------------------------------------------------------
X`009      1   2   3           4   1`009  2   3               4   1
X
X
X`009`0091 - NULL byte separating commands.
X`009`0092 - Leading length byte of command.
X`009`0093 - Start of command.
X`009`0094 - Trailing length byte of command.
X
X
X`009This program must be installed with CMEXEC privilege to modify the
X`009content of the recallbuffer.
X`009`009`009`009`009`009`009`009`009
X`009All possible combinations of qualifiers are described in the file
X`009Retrieve.Cld. Just as RECALL, RETRIEVE inserts the most recently given
X`009command`009"first" in the recallbuffer, provided that the current command
X`009not is equal to the last given.`009`009`009`009`009
X`009`009`009`009`009`009`009`009`009
X`009The system-procedure (Sys)$CmExec (Change mode to Execute) is used to
-+-+-+-+-+ End of part 1 +-+-+-+-+-

