home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / os / vms / 13760 < prev    next >
Encoding:
Internet Message Format  |  1992-08-18  |  18.6 KB

  1. Path: sparky!uunet!wupost!psuvax1!ukma!vlsi!wkuvx1!goathunter
  2. From: goathunter@wkuvx1.bitnet
  3. Newsgroups: comp.os.vms
  4. Subject: Re: Saving the recall buffer
  5. Message-ID: <1992Aug18.070826.1968@wkuvx1.bitnet>
  6. Date: 18 Aug 92 07:08:26 CDT
  7. References: <920817140148.20409853@FRED.ALHRG.WPAFB.AF.MIL>
  8. Distribution: world
  9. Organization: Western Kentucky University, Bowling Green, KY
  10. Lines: 443
  11.  
  12. In article <920817140148.20409853@FRED.ALHRG.WPAFB.AF.MIL>, SYSTEMM@FRED.ALHRG.WPAFB.AF.MIL (System Manager Wuest) writes:
  13. >    I know this is not a FAQ because I've been watching INFO-VAX for at least
  14. >    a year and it has never come up.  I'm sure it is not an original idea. ;-)
  15. >    Has anyone developed the code to save the RECALL buffer from one session 
  16. >    to another?  I won't belabor how useful this might be...
  17. One of my earliest _VAX Professional_ articles presented just such a
  18. program.  CMD will SAVE, RESTORE, FLUSH (it was written before
  19. RECALL/ERASE existed), and LIST the command recall buffer.
  20.  
  21. I've included it below.  It must be installed with CMEXEC privilege to
  22. be used by users without that priv.  (The recall buffer is protected
  23. from user write.)
  24.  
  25.     $ MACRO CMD
  26.     $ LINK/NOTRACE CMD
  27.     $ INSTALL ADD dev:[dir]CMD.EXE
  28.     $ cmd :== $dev:[dir]cmd.exe
  29.  
  30. Valid qualifiers are /LIST, /FLUSH, /SAVE, /RESTORE, /BOTH (save,flush).
  31.  
  32. Hunter
  33. ------
  34. Hunter Goatley, VMS Systems Programmer, Western Kentucky University
  35. goathunter@WKUVX1.BITNET, 502-745-5251
  36.  
  37. $! ------------------ CUT HERE -----------------------
  38. $ v='f$verify(f$trnlnm("SHARE_VERIFY"))'
  39. $!
  40. $! This archive created by VMS_SHARE Version 7.2-011  26-Jun-1992
  41. $!   On 18-AUG-1992 07:04:06.32   By user GOATHUNTER (@WKUVX1.BITNET)
  42. $!
  43. $! This VMS_SHARE Written by:
  44. $!    Andy Harper, Kings College London UK
  45. $!
  46. $! Acknowledgements to:
  47. $!    James Gray       - Original VMS_SHARE
  48. $!    Michael Bednarek - Original Concept and implementation
  49. $!
  50. $! TO UNPACK THIS SHARE FILE, CONCATENATE ALL PARTS IN ORDER
  51. $! AND EXECUTE AS A COMMAND PROCEDURE  (  @name  )
  52. $!
  53. $! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING:
  54. $!       1. CMD.MAR;1
  55. $!
  56. $set="set"
  57. $set symbol/scope=(nolocal,noglobal)
  58. $f=f$parse("SHARE_TEMP","SYS$SCRATCH:.TMP_"+f$getjpi("","PID"))
  59. $e="write sys$error  ""%UNPACK"", "
  60. $w="write sys$output ""%UNPACK"", "
  61. $ if f$trnlnm("SHARE_LOG") then $ w = "!"
  62. $ ve=f$getsyi("version")
  63. $ if ve-f$extract(0,1,ve) .ges. "4.4" then $ goto START
  64. $ e "-E-OLDVER, Must run at least VMS 4.4"
  65. $ v=f$verify(v)
  66. $ exit 44
  67. $UNPACK: SUBROUTINE ! P1=filename, P2=checksum
  68. $ x = P1 - f$parse(P1,,,"version")
  69. $ y = f$search(x)
  70. $ if y .eqs. "" then $ goto file_absent
  71. $ x = f$integer(f$parse(P1,,,"version")-";")
  72. $ y = f$integer(f$parse(y,,,"version")-";")
  73. $ if x .gt. y then $ goto file_absent
  74. $ if f$mode() .eqs. "INTERACTIVE" then $ goto file_interactive
  75. $ if x .eq. y then e "-W-EXISTS, File ''P1' exists. Skipped."
  76. $ if x .ne. y then e "-W-NEWERVERSION, of File ''P1' exists. Skipped."
  77. $file_delete:
  78. $ delete 'f'*
  79. $ exit
  80. $file_interactive:
  81. $ if x .eq. y then e "-W-EXISTS, File ''P1' exists."
  82. $ if x .ne. y then e "-W-NEWERVERSION, of File ''P1' exists."
  83. $ read/error=file_delete/end=file_delete-
  84.   /prompt="Create new version [y/n]: " -
  85.   sys$command x
  86. $ if .not. x then $ e "-W-SKIPPED, File ''P1' skipped."
  87. $ if .not. x then $ goto file_delete
  88. $ P1 = P1 - f$parse(P1,,,"version")
  89. $file_absent:
  90. $ if f$parse(P1) .nes. "" then $ goto dirok
  91. $ dn=f$parse(P1,,,"DIRECTORY")
  92. $ w "-I-CREDIR, Creating directory ''dn'."
  93. $ create/dir 'dn'
  94. $ if $status then $ goto dirok
  95. $ e "-E-CREDIRFAIL, Unable to create ''dn'. File skipped."
  96. $ delete 'f'*
  97. $ exit
  98. $dirok:
  99. $ w "-I-PROCESS, Processing file ''P1'."
  100. $ if .not. f$verify() then $ define/user sys$output nl:
  101. $ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT 'f'/OUT='P1'
  102. PROCEDURE Unpacker ON_ERROR ENDON_ERROR;SET(FACILITY_NAME,"UNPACK");SET(
  103. SUCCESS,OFF);SET(INFORMATIONAL,OFF);f:=GET_INFO(COMMAND_LINE,"file_name");b:=
  104. CREATE_BUFFER(f,f);p:=SPAN(" ")@r&LINE_END;POSITION(BEGINNING_OF(b));
  105. LOOP EXITIF SEARCH(p,FORWARD)=0;POSITION(r);ERASE(r);ENDLOOP;POSITION(
  106. BEGINNING_OF(b));g:=0;LOOP EXITIF MARK(NONE)=END_OF(b);x:=ERASE_CHARACTER(1);
  107. IF g=0 THEN IF x="X" THEN MOVE_VERTICAL(1);ENDIF;IF x="V" THEN APPEND_LINE;
  108. MOVE_HORIZONTAL(-CURRENT_OFFSET);MOVE_VERTICAL(1);ENDIF;IF x="+" THEN g:=1;
  109. ERASE_LINE;ENDIF;ELSE IF x="-" THEN IF INDEX(CURRENT_LINE,"+-+-+-+-+-+-+-+")=
  110. 1 THEN g:=0;ENDIF;ENDIF;ERASE_LINE;ENDIF;ENDLOOP;t:="0123456789ABCDEF";
  111. POSITION(BEGINNING_OF(b));LOOP r:=SEARCH("`",FORWARD);EXITIF r=0;POSITION(r);
  112. ERASE(r);x1:=INDEX(t,ERASE_CHARACTER(1))-1;x2:=INDEX(t,ERASE_CHARACTER(1))-1;
  113. COPY_TEXT(ASCII(16*x1+x2));ENDLOOP;WRITE_FILE(b,GET_INFO(COMMAND_LINE,
  114. "output_file"));ENDPROCEDURE;Unpacker;QUIT;
  115. $ delete/nolog 'f'*
  116. $ CHECKSUM 'P1'
  117. $ IF CHECKSUM$CHECKSUM .eqs. P2 THEN $ EXIT
  118. $ e "-E-CHKSMFAIL, Checksum of ''P1' failed."
  119. $ ENDSUBROUTINE
  120. $START:
  121. $ create 'f'
  122. X;========================================================================
  123. X;=`09`09`09`09`09`09`09`09`09=
  124. X;=`09Programmer:`09Hunter Goatley`09`09`09`09`09=
  125. X;=`09`09`09goathunter@WKUVX1.BITNET`09`09`09=
  126. X;=`09Program:`09CMD.MAR`09`09`09`09`09`09=
  127. X;=`09Purpose:`09Save, restore, flush, & list DCL command buffer`09=
  128. X;=`09Language:`09VAX-11 MACRO32  assembly language`09`09=
  129. X;=`09System:`09`09VAX/VMS v4.x`09`09`09`09`09=
  130. X;=`09Date:`09`09October 8, 1986`09`09`09`09`09=
  131. X;=`09`09`09`09`09`09`09`09`09=
  132. X;========================================================================
  133. X;=`09`09`09`09`09`09`09`09`09=
  134. X;=`09Copyright `A9 1989 by Hunter Goatley`09`09`09`09=
  135. X;=`09`09`09`09`09`09`09`09`09=
  136. X;=`09This program may be distributed freely for non-profit use`09=
  137. X;=`09as long as this notice remains intact.`09`09`09`09=
  138. X;=`09`09`09`09`09`09`09`09`09=
  139. X;========================================================================
  140. X;=`09`09`09`09`09`09`09`09`09=
  141. X;=`09`09`09`09`09`09`09`09`09=
  142. X;=`09This  program  allows  the user to flush the command buffer,`09=
  143. X;=`09list all of the commands in  the buffer,  write the contents`09=
  144. X;=`09of the buffer to a file, and restore the buffer from a file.`09=
  145. X;=`09`09`09`09`09`09`09`09`09=
  146. X;=`09To use this program, set up a foreign symbol, such as:`09`09=
  147. X;=`09`09`09`09`09`09`09`09`09=
  148. X;=`09`09`09$ CMD :== $dev:`5Bdir`5DCMD.EXE`09`09`09=
  149. X;=`09`09`09$ CMD/qualifier`09`09`09`09`09=
  150. X;=`09`09`09`09`09`09`09`09`09=
  151. X;=`09To build:`09`09`09`09`09`09`09=
  152. X;=`09`09`09$ MACRO CMD`09`09`09`09`09=
  153. X;=`09`09`09$ LINK CMD/NOTRACEBACK`09`09`09`09=
  154. X;=`09`09`09`09`09`09`09`09`09=
  155. X;=`09To install:`09`09`09`09`09`09`09=
  156. X;=`09`09`09$ INSTALL ADD CMD.EXE/PRIV=CMEXEC`09`09=
  157. X;=`09`09`09`09`09`09`09`09`09=
  158. X;=`09`09`09`09`09`09`09`09`09=
  159. X;=`09The valid qualifiers are:`09`09`09`09`09=
  160. X;=`09`09`09`09`09`09`09`09`09=
  161. X;=`09/LIST`09-  List all commands in the DCL command buffer`09`09=
  162. X;=`09/SAVE`09-  Save the commands in SYS$LOGIN:SAVE_CMDS.TXT`09`09=
  163. X;=`09/RESTORE-  Restore commands previously SAVEd`09`09`09=
  164. X;=`09/FLUSH`09-  Flush the command buffer`09`09`09`09=
  165. X;=`09/BOTH`09-  SAVE, then FLUSH the DCL command buffer`09`09=
  166. X;=`09`09`09`09`09`09`09`09`09=
  167. X;========================================================================
  168. X;
  169. X`09.LINK`09"SYS$SYSTEM:SYS.STB"/selective_search
  170. X`09.LINK`09"SYS$SYSTEM:DCLDEF.STB"/selective_search
  171. X
  172. X;
  173. X;  This macro compares the current address (in R10) with the beginning addre
  174. Vss
  175. X;  of the data area -- if they are equal, set the current address = to the e
  176. Vnd
  177. X;  of the data block (wrap).
  178. X;
  179. X`09.MACRO`09CHECK`09?HERE
  180. X`09CMPL`09R11,R10`09`09`09; Have we gone past the beginning?
  181. X`09BNEQ`09HERE`09`09`09; No -- skip next instruction
  182. X`09MOVAB`09PRC_G_COMMANDS(R3),R10
  183. X`09ADDL2`09#PRC_S_COMMANDS+1,R10
  184. X;`09MOVL`09#CMD_BUF_END,R10`09; Make R10 point to one byte past the
  185. X`09`09`09`09`09; ... end of the data area.  With next
  186. X`09`09`09`09`09; ... autodecrement, it will point to
  187. X`09`09`09`09`09; ... the last byte of the table.
  188. X HERE:`09.ENDM`09CHECK
  189. X`09`09`09`09`09;
  190. X;
  191. X;  This macro compares the first four bytes of FOR_BUFF with a valid qualifi
  192. Ver.
  193. X;  If there is a match, the appropriate routine is called and control branch
  194. Ves
  195. X;  to return to VMS.
  196. X;
  197. X`09.MACRO`09PRESENT`09QUAL,ROUTIN1,ROUTIN2=0,?LABEL
  198. X`09CMPL`09#`5EA\QUAL\,FOR_BUFF`09; Was /QUAL given?
  199. X`09BNEQU`09LABEL`09`09`09; No - try next
  200. X`09CALLS`09#0,ROUTIN1`09`09; Call the proper routine
  201. X`09.IF`09DIF`090,ROUTIN2`09; Was a second routine given?
  202. X`09BLBC`09R0,BYE`09`09`09; Error?
  203. X`09CALLS`09#0,ROUTIN2`09`09; No - call the second routine
  204. X`09.ENDC`09`09`09`09; ...
  205. X`09BRW`09BYE`09`09`09; Return to VMS (only one qualifier
  206. XLABEL:`09.ENDM`09PRESENT`09`09`09; ...  at a time!!!
  207. X
  208. X`09.PSECT`09DCL_CMDS_DATA,NOEXE,WRT,LONG
  209. X`09`09`09`09`09;
  210. X`09$SSDEF`09`09`09`09; Include status symbols
  211. X`09$RMSDEF`09`09`09`09; Include RMS symbols
  212. X`09$FABDEF`09`09`09`09; Include $FAB symbols
  213. X`09$RABDEF`09`09`09`09; Include $RAB symbols
  214. X`09$PRVDEF`09`09`09`09; Include privilege symbols
  215. X;
  216. X;=======================================================================
  217. X;
  218. XCMDFAB: $FAB`09FNM=<SYS$LOGIN:SAVE_CMDS.TXT>, -`09; File name
  219. X`09`09FAC=<GET,PUT>, -`09`09; File ACcess (R/W only)
  220. X`09`09MRS=1420, -`09`09`09; Maximum Record Size
  221. X`09`09RAT=CR, -`09`09`09; Record ATtributes
  222. X`09`09ORG=SEQ`09`09`09`09; File Organization (sequential)
  223. X;
  224. X;***  Record Access Block for SAVE_CMDS.TXT
  225. X;
  226. XCMDRAB:
  227. X`09$RAB    FAB=CMDFAB, -`09`09; Record Access Block
  228. X`09`09RBF=CMDREC, -`09`09; If writing, write from CMDREC
  229. X`09`09UBF=CMDREC`09`09; Address of SAVE_CMDS record buffer
  230. X
  231. X;
  232. X;
  233. XCMDREC:`09.BLKB`091032`09`09`09; Buffer for DCL commands
  234. X;
  235. X;=======================================================================
  236. X;
  237. XMAXCMDLEN = 256`09`09`09`09; Maximum length of a DCL command
  238. X`09`09`09`09`09;
  239. XCMDBUFFER_D:`09`09`09`09; Descriptor for the command buffer
  240. X`09.WORD`09MAXCMDLEN`09`09; ...
  241. X`09.BYTE`09DSC$K_DTYPE_T`09`09; ...
  242. X`09.BYTE`09DSC$K_CLASS_S`09`09; ...
  243. X`09.ADDRESS .+4`09`09`09; ...
  244. XCMDBUFFER:`09`09`09`09; The command buffer
  245. X`09.BYTE`09`5EA/ /`5BMAXCMDLEN`5D`09; ...
  246. X`09`09`09`09`09;
  247. XFAOCTR:`09.ASCID`09/!3UL !AS/
  248. XFAOUT:`09.WORD`09256`09`09`09`09; ...
  249. X`09.BYTE`09DSC$K_DTYPE_T`09`09`09; ...
  250. X`09.BYTE`09DSC$K_CLASS_S`09`09`09; ...
  251. X`09.ADDRESS .+4`09`09`09`09; ...
  252. X`09.BLKB`09256
  253. X
  254. XFOR_BUFF_D:`09`09`09`09; Descriptor for the command line
  255. X`09.WORD`09MAXCMDLEN`09`09; ...  returned by LIB$GET_FOREIGN
  256. X`09.BYTE`09DSC$K_DTYPE_T`09`09; ...
  257. X`09.BYTE`09DSC$K_CLASS_S`09`09; ...
  258. X`09.ADDRESS .+4`09`09`09; ...
  259. XFOR_BUFF:`09`09`09`09; BUffer holding the command line
  260. X`09.BLKB`09MAXCMDLEN`09`09; ...
  261. XFOR_LEN:.LONG`090`09`09`09; Length of command line returned
  262. XUSAGE_D:`09`09`09`09; Usage message
  263. X`09.ASCID`09-
  264. X \Must give valid qualifier: /LIST, /FLUSH, /SAVE, /RESTORE, /BOTH (save,flu
  265. Vsh)\
  266. XCMEXEC:`09.QUAD`09PRV$M_CMEXEC`09`09; Privilege needed to flush & restore
  267. XCMKRNL:`09.QUAD`09PRV$M_CMKRNL`09`09; Alternative privilege needed
  268. X;
  269. X;===========================================================================
  270. V====
  271. X;
  272. X`09.PSECT`09DCL_CMDS,EXE,NOWRT
  273. X`09.ENTRY`09DCL_CMDS,`5EM<>
  274. X
  275. X`09MOVW`09#PRC_S_COMMANDS+4,-`09; Store the size of the command buffer
  276. X`09`09CMDRAB+RAB$W_RSZ`09; ... in the RAB
  277. X`09MOVW`09#PRC_S_COMMANDS+4,-`09; Store the size of the command buffer
  278. X`09`09CMDRAB+RAB$W_USZ`09; ... in the RAB
  279. X
  280. X; A simple command line parser follows.  The code simply checks for a "/"
  281. X; followed by at least 3 characters of the command qualifier.  Not very
  282. X; forgiving, but easy to code.
  283. X;
  284. X`09PUSHAW`09FOR_LEN`09`09`09; Get any commands on command line
  285. X`09PUSHL`09#0`09`09`09; Don't want to prompt for anything
  286. X`09PUSHAQ`09FOR_BUFF_D`09`09; Buffer for command line
  287. X`09CALLS`09#3,G`5ELIB$GET_FOREIGN`09; Get the command line
  288. X`09TSTW`09FOR_LEN`09`09`09; Was anything given?
  289. X`09BNEQ`0910$`09`09`09; Yes  - see what was
  290. X`09PUSHAQ`09USAGE_D`09`09`09; No - print usage message
  291. X`09CALLS`09#1,G`5ELIB$PUT_OUTPUT`09; ...
  292. X`09BRW`09BYE`09`09`09; ...
  293. X`09`09`09`09`09;
  294. X10$:`09PRESENT`09</RES>,RESTORE_CMDS`09`09; Was /RESTORE given?
  295. X`09PRESENT`09</LIS>,LIST_CMDS`09`09; Was /LIST?
  296. X`09PRESENT`09</FLU>,FLUSH_CMDS`09`09; Was /FLUSH?
  297. X`09PRESENT`09</SAV>,SAVE_CMDS`09`09; Was /SAVE?
  298. X`09PRESENT`09</BOT>,SAVE_CMDS,FLUSH_CMDS`09; Was /BOTH (save and flush)?
  299. X
  300. X`09PUSHAQ`09USAGE_D`09`09`09; If here, a valid qualifier was not
  301. X`09CALLS`09#1,G`5ELIB$PUT_OUTPUT`09; ...  given - print USAGE message
  302. X BYE:`09$EXIT_S`09CODE=R0`09`09`09; Exit to VMS
  303. X`09`09`09`09`09;
  304. X;===========================================================================
  305. V====
  306. X;   Subroutine SAVE_CMDS - Save the DCL commands in SYS$LOGIN:SAVE_CMDS.TXT
  307. X;
  308. X`09.ENTRY`09SAVE_CMDS,`5EM<>
  309. X`09`09`09`09`09`09;
  310. X`09$CREATE`09FAB=CMDFAB`09`09`09; Create the output file
  311. X`09BLBC`09R0,100$`09`09`09`09; Error?
  312. X    `09$CONNECT RAB=CMDRAB`09`09`09; Connect the RAB
  313. X`09BLBC`09R0,100$`09`09`09`09; Error?
  314. X`09MOVAB`09G`5ECTL$AG_CLIDATA,R3`09`09; Get address of CLI data
  315. X`09MOVL`09PPD$L_PRC(R3),R3`09`09; Get address of PRC region
  316. X`09MOVC3`09#PRC_S_COMMANDS+4, -`09`09; Get the DCL previous command
  317. X`09`09PRC_L_RECALLPTR(R3),CMDREC`09; ... buffer (not protected
  318. X`09`09`09`09`09`09; ... against user-mode reads)
  319. X`09$PUT`09RAB=CMDRAB`09`09`09; Write the buffer to the file
  320. X`09BLBC`09R0,100$`09`09`09`09; Error?
  321. X`09$CLOSE`09FAB=CMDFAB`09`09`09; Close the file
  322. X 100$:`09RET`09`09`09`09`09; Return to caller
  323. X`09`09`09`09`09`09;
  324. X;===========================================================================
  325. V====
  326. X;   Subroutine RESTORE_CMDS - Restore DCL commands in SYS$LOGIN:SAVE_CMDS.TX
  327. VT
  328. X;   Calls EXEC_RESTORE from EXECUTIVE mode
  329. X;
  330. X`09.ENTRY`09RESTORE_CMDS,`5EM<>
  331. X`09`09`09`09`09`09;
  332. X`09CALLS`09#0,GETPRV`09`09`09; Turn on the CMEXEC to do this
  333. X`09BLBC`09R0,10$`09`09`09`09; If error (No priv), return
  334. X`09$OPEN`09FAB=CMDFAB`09`09`09; Open SAVE_CMDS.TXT for reading
  335. X`09BLBC`09R0,10$`09`09`09`09; Error?
  336. X`09$CONNECT RAB=CMDRAB`09`09`09; Connect the RAB
  337. X`09BLBC`09R0,10$`09`09`09`09; Error?
  338. X`09$GET`09RAB=CMDRAB`09`09`09; Read the only record in the
  339. X`09`09`09`09`09`09; ... file (the command buffer)
  340. X`09BLBC`09R0,10$`09`09`09`09; Error?
  341. X`09$CMEXEC_S -`09`09`09`09; Go move the command buffer
  342. X`09`09ROUTIN=EXEC_RESTORE`09`09; ... to process space
  343. X`09$CLOSE`09FAB=CMDFAB`09`09`09; Close the file
  344. X 10$:`09RET`09`09`09`09`09; Return to caller
  345. X;
  346. X;===========================================================================
  347. V====
  348. X;****`09This executive mode routine moves the previous commands from CMDREC
  349. X;****`09to the CLI data area.
  350. X;
  351. X`09.ENTRY`09EXEC_RESTORE,`5EM<>
  352. X`09`09   `09`09`09`09;
  353. X`09MOVAL`09HANDLER,(FP)`09`09`09; Unnecessary handler, but...
  354. X`09MOVAB`09G`5ECTL$AG_CLIDATA,R3`09`09; Get address of CLI data
  355. X`09MOVL`09PPD$L_PRC(R3),R3`09`09; Get address of PRC region
  356. X`09MOVC3`09#PRC_S_COMMANDS+4,CMDREC, -`09; Move the prev command block
  357. X`09`09PRC_L_RECALLPTR(R3)`09`09; ...  to the CLI data area
  358. X`09MOVZBL`09#SS$_NORMAL,R0`09`09`09; Set up a success return
  359. X`09RET`09`09`09`09`09; Return to caller
  360. X`09`09`09`09`09`09;
  361. X`09.ENTRY`09HANDLER,`5EM<>`09`09`09; Exit handler in case of
  362. X`09$EXIT_S`09`09`09`09`09; ... $ACCVIO (Kill process)
  363. X`09`09`09`09`09`09;
  364. X;===========================================================================
  365. V====
  366. X;   Subroutine LIST_CMDS - List all commands stored in DCL RECALL buffer
  367. X;
  368. X`09.ENTRY`09LIST_CMDS,`5EM<R2,R3,R4,R5,R6,R7,R8,R9,R10,R11>
  369. X`09MOVAB`09G`5ECTL$AG_CLIDATA,R3`09`09; Get address of CLI data
  370. X`09MOVL`09PPD$L_PRC(R3),R3`09`09; Get address of PRC region
  371. X`09MOVL`09PRC_L_RECALLPTR(R3),R10`09; Get addr of end of most recent cmd
  372. X`09MOVL`09R10,R9`09`09`09; Make a copy of it
  373. X`09MOVAB`09PRC_G_COMMANDS(R3),R11`09; Get the beginning of the data block
  374. X`09CLRL`09R6`09`09`09; Clear command counter
  375. X 10$:`09MOVAB`09CMDBUFFER,R8`09`09; Get the buffer address
  376. X`09`09   `09`09`09; Clear the buffer
  377. X`09MOVZBL`09-(R10),R7`09`09; Get the length of the first command
  378. X`09BNEQ`0920$
  379. X`09BRW`0940$`09`09`09; 2 null bytes in a row? End
  380. X 20$:`09MOVW`09R7,CMDBUFFER_D`09`09; Move the length to the descriptor
  381. X`09CHECK`09`09`09`09; Check to see if this command wraps
  382. X`09`09`09`09`09; ...  to the end of the data area
  383. X`09ADDL2`09R7,R8`09`09`09; Make R8 point to end of buffer
  384. X 30$:`09MOVB`09-(R10),-(R8)`09`09; Move the first byte
  385. X`09CHECK`09`09`09`09; Check our addresses
  386. X`09SOBGTR`09R7,30$`09`09`09; Loop until command is moved
  387. X`09INCL`09R6`09`09`09; Bump the command counter
  388. X`09$FAO_S`09CTRSTR=FAOCTR, -`09; Format for output
  389. X`09`09OUTBUF=FAOUT, -`09`09; ...
  390. X`09`09OUTLEN=FAOUT, -`09`09; ...
  391. X`09`09P1=R6, -`09`09; ...
  392. X`09`09P2=#CMDBUFFER_D`09`09; ...
  393. X`09PUSHAQ`09FAOUT`09`09`09; Write it to the terminal
  394. X`09CALLS`09#1,G`5ELIB$PUT_OUTPUT`09; ....
  395. X`09MOVW`09#256,FAOUT`09`09; Reset FAO output descriptor
  396. X`09DECL`09R10`09`09`09; Should now point to prefix count
  397. X`09CHECK`09`09`09`09; Check our addresses
  398. X`09DECL`09R10`09`09`09; Should now point to 0 byte
  399. X`09CHECK`09`09`09`09; Check our addresses
  400. X`09CMPL`09R10,R9`09`09`09; If current addr = starting addr
  401. X`09BEQL`0940$`09`09`09; ...  end of data
  402. X`09BRW`0910$`09`09`09; Loop until all commands printed
  403. X 40$:`09MOVL`09#SS$_NORMAL,R0`09`09; Set return code
  404. X`09RET`09`09`09`09; Return to caller
  405. X`09`09`09`09`09;
  406. X;===========================================================================
  407. V====
  408. X;   Subroutine FLUSH_CMDS - Flush the DCL command RECALL buffer
  409. X;
  410. X`09.ENTRY`09FLUSH_CMDS,`5EM<>
  411. X`09CALLS`09#0,GETPRV`09`09; Turn on the CMEXEC to do this
  412. X`09BLBC`09R0,10$`09`09`09; If error (No priv), return
  413. X`09$CMEXEC_S -`09`09`09; Flush the DCL command buffer
  414. X`09`09ROUTIN=EXEC_FLUSH`09; ...  (zero it out)
  415. X 10$:`09RET`09`09`09`09; Return to caller
  416. X;
  417. X;  Zero out the DCL command recall buffer
  418. X;
  419. X`09.ENTRY`09EXEC_FLUSH,`5EM<R2,R3,R4,R5>
  420. X`09MOVAB`09G`5ECTL$AG_CLIDATA,R3`09`09; Get address of CLI data
  421. X`09MOVL`09PPD$L_PRC(R3),R3`09`09; Get address of PRC region
  422. X`09MOVAB`09PRC_G_COMMANDS(R3),-`09`09; Reset last command pointer
  423. X`09`09PRC_L_RECALLPTR(R3)`09`09; ...
  424. X`09MOVC5`09#0,#0,#0,#PRC_S_COMMANDS,-`09; Zero out the DCL command
  425. X`09`09PRC_G_COMMANDS(R3)`09`09; ...  recall buffer
  426. X`09MOVL`09#SS$_NORMAL,R0`09`09`09; Set return status
  427. X`09RET`09`09`09`09`09; Return to caller
  428. X`09`09`09`09`09`09;
  429. X;===========================================================================
  430. V====
  431. X;   Subroutine GETPRV - Turn on either CMEXEC or CMKRNL to do FLUSH and REST
  432. VORE
  433. X;
  434. X`09.ENTRY`09GETPRV,`5EM<>
  435. X`09$SETPRV_S -`09`09`09; Turn on CMEXEC privilege
  436. X`09`09ENBFLG=#1, -`09`09; ...
  437. X`09`09PRVADR=CMEXEC`09`09; ...
  438. X`09CMPL`09#SS$_NORMAL,R0`09`09; Was CMEXEC turned on?
  439. X`09BEQLU`0910$`09`09`09; Yes - return
  440. X`09$SETPRV_S -`09`09`09; If not, try to turn on CMKRNL
  441. X`09`09ENBFLG=#1, -`09`09; ...
  442. X`09`09PRVADR=CMKRNL`09`09; ...
  443. X`09CMPL`09#SS$_NORMAL,R0`09`09; Was CMEXEC turned on?
  444. X`09BEQLU`0910$`09`09`09; Yes - return
  445. X`09MOVL`09#SS$_NOCMEXEC,R0`09; If not, tell that CMEXEC is needed
  446. X 10$:`09RET`09`09`09`09; Return to caller
  447. X
  448. X`09.END`09DCL_CMDS
  449. $ CALL UNPACK CMD.MAR;1 756169595
  450. $ v=f$verify(v)
  451. $ EXIT
  452.