Relay-Version: version nyu B notes v1.6.1 1/11/90; site acf3.NYU.EDU From: Chris_F_Chiesa@cup.portal.com Date: 19 Mar 91 07:04 EST Date-Received: 19 Mar 91 09:55 EST Subject: Terminal-Settings Copy Utility, Part 2 of 2 Message-ID: <40323@cup.portal.com> Path: acf3!cmcl2!cmcl2!yale!mintaka!snorkelwacker.mit.edu!apple!portal!cup.portal.com!Chris_F_Chiesa Newsgroups: comp.os.vms Organization: The Portal System (TM) References: <9103120950.AA11567@ucbvax.Berkeley.EDU> Lines: 282 Here's part 2 of the terminal-settings copier... ----- -+-+-+-+-+-+-+-+ START OF PART 2 -+-+-+-+-+-+-+-+ X`009blbc`009r0,copy_err X; X`009$DASSGN_S - X`009`009chan=dest_chan X`009blbc`009r0,copy_err X`009ret X; Xcopy_err: X`009$EXIT_S`009r0 X; X`009.end`009copysettings $ CALL UNPACK COPYSETTINGS.MAR;6 1948156303 $ create/nolog 'f' X`009`009COPYSETTINGS v1.0, by Chris Chiesa. 2/6/91 X XI. INTRODUCTION X XCopySettings adds three useful operations to your VMS terminal-settings`032 Xtoolkit. You may now copy settings directly from one terminal to another`03 V2 X("set THIS terminal exactly the same way THAT one is set"), save terminal Xsettings into a data file ("remember how this terminal is set right now") Xand restore them later ("set the terminal back to the way it was before"). XThese three operations have saved me a tremendous amount of frustration in Xtrying to figure out which particular setting is responsible for one ter- Xminal port's behaving differently than another. I can now maintain a`032 Xlibrary of "standard" port settings for different devices which might be Xconnected to a terminal port, and instantly switch between wildly different Xconfigurations with a single command. I think you'll like it too. X X Before I specifically discuss CopySettings, bear with me while I define Xsome terms. The VMS I/O User's Reference Manual, Volume I, Chapter 8`032 X("Terminal Driver") distinguishes between "sensing" and "setting" terminal Xbehavior settings, and further distinguishes a terminal's temporary "mode"`0 V32 Xfrom its permanent "characteristics." I wish to avoid wallowing in these Xterms, and will refer throughout this document to "settings" and "PERMANENT` V032 Xsettings," where the I/O U.R.M. would say "mode" and "characteristics." XFor further information, RTFM :-). X X XII. SETUP X X To empower yourself to use CopySettings, you must do three things: X X`0091) Build the CopySettings executable image from Macro assembly X`009 source code,`032 X X`0092) Customize the definition of the DCL verb which will invoke X`009 CopySettings in your particular environment, and X X`0093) Add the DCL command verb which will invoke CopySettings, to X`009 your process or system Command Definition Table. X X The first step need be performed only once, and is very straightforward. XYou must assemble the supplied Macro source file, COPYSETTINGS.MAR, then Xlink the resulting object file, COPYSETTINGS.OBJ. I have provided a`032 Xcommand procedure, BUILD_COPYSETTINGS.COM, which will perform all the Xnecessary steps for you. The easiest way to use it is to place`032 XCOPYSETTINGS.MAR and BUILD_COPYSETTINGS.COM in the same directory, set your` V032 X"default directory" to that same directory, and issue the command X X`009@BUILD_COPYSETTINGS X XWhen your DCL prompt reappears, you will find COPYSETTINGS.EXE in the`032 Xdirectory. You can then COPY or RENAME it to another directory with no Xill effects. X X The second step probably also needs to be performed only once, or at`032 Xleast "not very often" if your site is relatively stable in its directory Xorganization. Customization of the CopySettings verb definition amounts Xto EDITing the file COPYSETTINGS.CLD supplied in this distribution, so Xthat it specifies the proper directory path to your particular copy of`032 XCOPYSETTINGS.EXE. (See the Notes at the end of this document, for a sug- Xgestion of another optional edit at this point in the proceedings.) X X The COPYSETTINGS.CLD file supplied in this directory contains a line`032 Xwhich reads X X`009IMAGE UTILITIES:COPYSETTINGS.EXE X XThis will tell DCL to look for the COPYSETTINGS.EXE executable image in Xa directory identified by the logical name "UTILITIES". You may either Xleave this definition as-is, and simply define the logical name UTILITIES Xwhenever you wish to use CopySettings, OR change this definition in the X.CLD file to indicate the directory where you have placed your own copy Xof COPYSETTINGS.EXE. This is the ONLY change to COPYSETTINGS.CLD which`032 XI "officially sanction." Any other changes are made at your own risk! X X Finally, you are ready to add the SETTINGS verb -- the verb which will Xinvoke CopySettings -- to your process or system Command Definition Table.`0 V32 XIf you add the verb to your process table, it will last only until you log Xout, and you will have to add the verb anew the next time you wish to use XCopySettings. If you add the verb to your system table, it will be Xavailable only AFTER you log out and log in again -- but will remain Xavailable thereafter. System privilege CMKRNL is required for properly Xadding the verb to your system, and other privileges may be required Xdepending on your site's environment.`032 X X To add the SETTINGS verb to your process Command Definition Table, issue Xthe DCL command X X SET COMMAND COPYSETTINGS X Xwhen COPYSETTINGS.CLD is in your default directory. X X To add the SETTINGS verb to your system Command Definition Table, issue`03 V2 Xthe DCL command`032 X X SET COMMAND COPYSETTINGS /TABLE=tablefilespec /OUTPUT=tablefilespe Vc X X... where both the /TABLE and /OUTPUT qualifiers specify your system's`032 Xmaster Command Definition Table file. (At most sites this file will be XSYS$LIBRARY:DCLTABLES.EXE, but that is not ironclad.) If this step pro- Xceeds successfully, issue the following series of DCL commands to replace Xthe old Command Definition Table with the updated one, then log out and Xlog back in: X X`009INSTAL :== $INSTALL/COMM X`009INSTAL/REPLACE tablefilespec X`009 X For best (safest) results, you should also reboot your system, but I Xhave had acceptable behavior WITHOUT rebooting, in many cases. X X XIII. Using CopySettings X X Once you've defined the CopySettings invocation verb, SETTINGS, you Xare ready to begin using it! CopySettings provides COPY, SAVE, and RESTORE Xfunctions for both "temporary" and "permanent" terminal settings, giving a Xtotal of six distinct operations. X X CopySettings is invoked by issuing the DCL command "SETTINGS," with one Xof the qualifiers /COPY, /SAVE, or /RESTORE to select an operation, and Xoptionally with the /PERMANENT qualifier to indicate that "permanent"`032 Xsettings are to be manipulated. (If you do not supply the /PERMANENT`032 Xqualifier, CopySettings will operate on a terminal's "temporary" settings.) X X Use of the SETTINGS command is as follows. X X X`009SETTINGS /operation `091/PERMANENT`093 source destination X Xwhere X X "/operation" is a required qualifier indicating the operation to X`009be performed. It must be one, and only one, of the following: X X`009`009/COPY`009- copy settings directly from the "source" X`009`009`009 terminal to the "destination" terminal X X`009`009/SAVE`009- save the "source" terminal's settings in X`009`009`009 the "destination" file X X`009`009/RESTORE- restore the "destination" terminal's settings X`009`009`009 from the "source" file X X "/PERMANENT" is a required qualifier indicating that CopySettings is X`009to operate on a terminal's "permanent" settings. If the /PERMANENT X`009qualifier is not specified, CopySettings operates on the terminal's`032 X`009"temporary" settings. X X "source" specifies the terminal (for /COPY or /SAVE operations) or X`009disk file (for /RESTORE operations) from which settings are read. X X "destination" specifies the terminal (for /COPY or /RESTORE operations) X`009or disk file (for /SAVE operations) to which settings are written. X X X This definition results in six possible operations, as mentioned`032 Xpreviously. Examples: X X`009SETTINGS/COPY OPA0: TXB3: X X`009`009- copies temporary settings from the operator's X`009`009 terminal to terminal TXB3: X X`009SETTINGS/SAVE/PERMANENT TXA1: SYS$LOGIN:SAVE_TXA1.DAT X X`009`009- saves the permanent settings of terminal TXA1: X`009`009 into the file SYS$LOGIN:SAVE_TXA1.DAT X X`009SETTINGS/RESTORE SYS$LOGIN:SAVED_TTA2.DAT TTA2: `032 X X`009`009- restores terminal TTA2:'s temporary settings`032 X`009`009 from the file SYS$LOGIN:SAVED_TTA2.DAT X XIV) NOTES X X Known Bugs: X X`009CopySettings is not finicky about the file specified as a /SAVE X`009"destination" or /RESTORE "source." It will read the first twelve`032 X`009bytes of raw data (including "hidden" RMS file-structure information)`03 V2 X`009from ANY file you specify. Be careful! X X Caveats: X X`009Copying or restoring settings which result in the destination`032 X`009terminal switching from "/MODEM" to "/NOMODEM" state will behave X`009exactly as though SET TERM/NOMODEM has been issued: namely, DTR X`009will be dropped, possibly disconnecting a modem connection active X`009on the terminal port. X X Customization Suggestion: X X`009- The verb definition "SETTINGS" is awfully similiar to the`032 X`009 existing, standard DCL verb "SET". If this bothers you,`032 X`009 you can perform an additional customization of the`032 X`009 COPYSETTINGS.CLD file, to change the verb to something you X`009 feel more comfortable with. Change the word SETTINGS in X`009 the line X X`009`009DEFINE VERB SETTINGS X X`009 to the verb of your choice, and use that verb wherever X`009 "SETTINGS" appears in this document. X X Hints, Tips, and Thoughts: X X`009- The /COPY operation copies temporary settings to temporary X`009 settings, and permanent settings to permanent settings. You X`009 can, however, copy temporary settings to permanent settings X`009 and vice versa, by using an intermediate file for a /SAVE`032 X`009 of one kind, followed by a /RESTORE of the other. X X`009- CopySettings does not verify that the /RESTORE "source" or X`009 /SAVE "destination" parameter actually specifies a DISK`032 X`009 FILE per se. CopySettings will in fact save and restore X`009 settings to any I/O device/channel you can access, although X`009 it works best, and is only officially sanctioned, when`032 X`009 saving/restoring to/from disk files! (Saving and restoring X`009 to and from a mailbox is interesting. I don't use IO$M_NOWAIT, X`009 of course.) X X`009- Thoughts for additional features are welcome -- see "contact" X`009 below -- but here are a few I've thought of: X X`009`009- a new /BOTH qualifier, telling CopySettings to manage X`009`009 both "temporary" AND "permanent" characteristics in X`009`009 one operation. X X`009`009- separate interpretation of /PERMANENT on a parameter- X`009`009 specific, rather than command-line-global, basis, to X`009`009 implement the type of "permanent/temporary CROSS" X`009`009 operation described in the first "Hint," above. X X Contact: X X`009For those who get a kick out of talking to the programmers of`032 X`009these things, or who might have an employment opportunity for X`009a bright young "quick study" with lots of practical experience X`009on VMS, Unix, and many other platforms, here are a couple of ways`032 X`009you can reach me: X X`009E-mail: to Chris_F_Chiesa@cup.portal.com X`009`009 or cfchiesa@bsu-cs.bsu.edu X X`009 - E-mail to the latter address will be forwarded to the former. X X`009Physical-Mail:`009Chris Chiesa X`009`009`009509 Shelford Rd. X`009`009`009Rochester, NY 14609 X`009`009`009`009`009 USA X X`009Telephone: X`009`009`009(716) 724-2029 (work, days, 8A-5P Eastern) X`009`009`009(716) 482-9573 (home, all other times, more or less)`009 X $ CALL UNPACK COPYSETTINGS_README.TXT;1 1493342668 $ v=f$verify(v) $ EXIT Relay-Version: version nyu B notes v1.6.1 1/11/90; site acf3.NYU.EDU From: Chris_F_Chiesa@cup.portal.com Date: 19 Mar 91 07:01 EST Date-Received: 19 Mar 91 09:55 EST Subject: Terminal-Settings Copy Utility (Source & Docs Included Here) Message-ID: <40322@cup.portal.com> Path: acf3!cmcl2!cmcl2!yale!mintaka!snorkelwacker.mit.edu!apple!portal!cup.portal.com!Chris_F_Chiesa Newsgroups: comp.os.vms Organization: The Portal System (TM) References: <9103120950.AA11567@ucbvax.Berkeley.EDU> Lines: 417 A week or two ago I mentioned in a posting on some topic that I had written a utility which allows you to copy "settings" from one terminal to another, and to save settings in a file and restore them from a file. My hometown (Rochester, NY) was immediately hit by an ice storm that left my uploading computer without power for nine days! Sorry for the delay, but better late than never. Here's the CopySettings utility, in two parts, VMS_SHAREd. Bug reports, suggestions, etc. to me here or at contact points listed in the included docfile. Chris_F_Chiesa@cup.portal.com ----- $! ------------------ CUT HERE ----------------------- $ v='f$verify(f$trnlnm("SHARE_VERIFY"))' $! $! This archive created by VMS_SHARE Version 7.1-004 3-AUG-1989 $! On 17-MAR-1991 16:03:40.72 By user CHIESA $! $! This VMS_SHARE Written by: $! Andy Harper, Kings College London UK $! $! Acknowledgements to: $! James Gray - Original VMS_SHARE $! Michael Bednarek - Original Concept and implementation $! $!+ THIS PACKAGE DISTRIBUTED IN 2 PARTS, TO KEEP EACH PART $! BELOW 30 BLOCKS $! $! 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. COPYSETTINGS.CLD;4 $! 2. COPYSETTINGS.MAR;6 $! 3. COPYSETTINGS_README.TXT;1 $! $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' XDEFINE VERB SETTINGS ! V1.0, C.Chiesa, 2/6/91 X! X! Change the UTILITIES: directoryspec below, to whatever's appropriate for X! your own site. X! X IMAGE UTILITIES:COPYSETTINGS X PARAMETER P1,LABEL=SOURCE,PROMPT="Source" X VALUE (REQUIRED,TYPE=$INFILE) X PARAMETER P2,LABEL=DEST,PROMPT="Destination" X VALUE (REQUIRED,TYPE=$OUTFILE) X QUALIFIER COPY X QUALIFIER SAVE X QUALIFIER RESTORE X QUALIFIER PERMANENT X DISALLOW ANY2(COPY,SAVE,RESTORE) X DISALLOW ((NOT COPY) AND (NOT SAVE) AND (NOT RESTORE)) $ CALL UNPACK COPYSETTINGS.CLD;4 891570937 $ create/nolog 'f' X`009.TITLE`009COPYSETTINGS - Copy, Save, and Restore terminal settings X`009.IDENT`009\V01.00\ X;++ X; X; Author: X; X;`009Christopher F. Chiesa (Chris_F_Chiesa@cup.portal.com) X; X; Edit History: X; X;`009V01.00`009- C.F.Chiesa X;`009`009`009original, no modifications X; X; Functional Description: X; X;`009CopySettings provides three useful functions which operate on X;`009a terminal's characteristics (as set by SET TERMINAL or SET X;`009TERMINAL/PERMANENT). X; X;`009COPY - copies one terminal's characteristics to another, i.e. X;`009`009"set THIS terminal exactly the same as THAT one" X; X;`009SAVE - saves a terminal's characteristics in a data file, i.e. X;`009`009"save a record of how this terminal is set right now" X; X;`009RESTORE - restores a terminal's characteristics from a data X;`009`009file, i.e. "set this terminal back the way it was when X;`009`009we SAVEd the settings" X; X; Environment: X; X;`009OS: `009`009VMS V4.4 or above X;`009CLI:`009`009DCL X;`009Invocation:`009Native command defined by COPYSETTINGS.CLD X; `009Privileges:`009OPER priv for use of /PERMANENT qualifier only X; X; Usage: X; X;`009SETTINGS /qualifiers source destination X; X;`009 source: X; X;`009`009Device or file from which terminal characteristics are X;`009`009read. Specifies a terminal device when /COPY or /SAVE X;`009`009is used, or a disk file when /RESTORE is used. X; X;`009 destination: X; X;`009`009Device or file to which terminal characteristics are X;`009`009written. Specifies a terminal device when /COPY or`032 X;`009`009/RESTORE is used, or a disk file when /SAVE is used. X; X;`009 qualifiers: X; X;`009`009/COPY - copy settings from "source" TERMINAL to "destination" X;`009`009`009TERMINAL X; X;`009`009/SAVE - save "source" TERMINAL settings into "destination" X;`009`009`009FILE X; X;`009`009/RESTORE - restore "destination" TERMINAL settings from X;`009`009`009"source" FILE X; X;`009`009/PERMANENT - operate on terminal's PERMANENT characteristics X;`009`009`009(by default, CopySettings operates on terminal's X;`009`009`009"temporary" characteristics) X; X; X; Known Bugs: X; X;`009CopySettings V01.00 does not verify that a file being /RESTOREd from X;`009was /SAVEd by CopySetting; it will "restore terminal characteristics"`0 V32 X;`009from ANY file. X;- X;=========================================================================== X`009.macro gen_ascid size`009; Generate ASCID string of "size" blanks X`009savpc1 = . X`009.ascid`009\ \ X`009.blkb`009 X`009savpc2 = . X`009. = savpc1 X`009.word`009size X`009. = savpc2 X`009.endm X;=========================================================================== X`009.psect`009data`009wrt,noexe,long X; X`009string_size = 255 X`009char_buf_size = 12 X;+ X; We'll use some bitwise flags to indicate the operation requested on the X; command line: names with "_m_" are MASKS, names with "_v_" are offsets. X;- X`009copy_m_copy = 1`009`009`009; /COPY was specified X`009copy_m_save = 2`009`009`009; /SAVE X`009copy_m_restore = 4`009`009; /RESTORE X`009copy_m_permanent = 8`009`009; /PERMANENT X; X`009copy_v_copy = 0 X`009copy_v_save = 1 X`009copy_v_restore = 2 X`009copy_v_permanent = 3 X; Xfile_access:`009$FAB`009fac=,-`009; Used with /SAVE and /RESTORE on Vly X`009`009`009fop=,- X`009`009`009org=,- X`009`009`009alq=1 X; Xiosb:`009`009.blkq X; Xcharacteristics:`009`009`009; Terminal characteristics buffer X`009`009.blkb`00912 X; Xsource_chan:`009.blkw Xdest_chan:`009.blkw X;+ X; Following are the qualifier and parameter names parsed for us by DCL. X; These names must agree with those used in COPYSETTINGS.CLD. X;- Xcopy_qual:`009.ascid`009\COPY\ Xsave_qual:`009.ascid`009\SAVE\ Xrestore_qual:`009.ascid`009\RESTORE\ Xpermanent_qual:`009.ascid`009\PERMANENT\ Xsource_parm:`009.ascid`009\SOURCE\ Xdest_parm:`009.ascid`009\DEST\ X; Xsource_spec:`009gen_ascid string_size`009; Receives source device/file spec V. Xdest_spec:`009gen_ascid string_size`009; Receives destination dev/file spec V. Xexp_source:`009gen_ascid string_size`009; Expanded name (RMS or $GETDVI) Xexp_dest:`009gen_ascid string_size`009; Expanded name X;=========================================================================== X`009.psect`009code`009nowrt,exe X; X`009.entry`009copysettings,`094m<> X;+ X; Parse command-line arguments: operation to perform (copy, save, restore), X; source, destination. NOTE: WE RELY ON CDU TO MAKE /COPY, /SAVE, AND X; /RESTORE MUTUALLY EXCLUSIVE. X;- X`009clrl`009r10`009`009`009; R10 => operation flags X`009pushaq`009copy_qual`009`009; Was /COPY specified? X`009calls`009#1,g`094CLI$PRESENT X`009insv`009r0,#copy_v_copy,#1,r10`009; Set or clear COPY oper. flag`032 X`009`009`009`009`009; according to "success" bit in R0 X; X`009pushaq`009save_qual`009`009; Was /SAVE specified? X`009calls`009#1,g`094CLI$PRESENT X`009insv`009r0,#copy_v_save,#1,r10`009; Set or clear SAVE oper. flag X; X`009pushaq`009restore_qual`009`009; Was /RESTORE specified? X`009calls`009#1,g`094CLI$PRESENT X`009insv`009r0,#copy_v_restore,#1,-`009; Set or clear RESTORE oper. flag X`009`009 r10 X; X`009pushaq`009permanent_qual`009`009; Was /PERMANENT specified? X`009calls`009#1,g`094CLI$PRESENT X`009insv`009r0,#copy_v_permanent,-`009; Set or clear PERMANENT oper. flag X`009`009 #1,r10 X; X`009pushal`009source_spec`009`009; Obtain "source" specification X`009pushaq`009source_spec X`009pushaq`009source_parm X`009calls`009#3,g`094CLI$GET_VALUE X`009blbs`009r0,10$`009`009`009; Cleared if successful X`009jmp`009copy_err X10$: X`009pushal`009dest_spec`009`009; Obtain "destination" specification X`009pushaq`009dest_spec X`009pushaq`009dest_parm X`009calls`009#3,g`094CLI$GET_VALUE X`009blbs`009r0,20$ X`009jmp`009copy_err X20$: X;+ X; If we are doing either COPY or SAVE, we want to open a channel to a`032 X; terminal port. Otherwise we want to open a channel to a disk file. X; We test for the ABSENCE of the RESTORE bit, counting on the CLD defi- X; nition to make that condition the equivalent of "SAVE!RESTORE". X;- X`009moval`009source_spec,r2`009`009; R2 => source string descriptor address X`009bbc`009#copy_v_restore,r10,32$`009; Are we doing a RESTORE? X`009`009`009`009`009; NO: go open channel directly X`009`009`009`009`009; YES: open FILE for input X; X`009movab`009file_access,r3`009`009; R3 => FAB base address X; X`009movb`009DSC$W_LENGTH(r2),FAB$B_FNS(r3)`009`009; Install input spec X`009moval`009@DSC$A_POINTER(r2),FAB$L_FNA(r3) X; X`009$OPEN`009FAB=(r3)`009`009; Open the input entity X`009blbs`009r0,30$`009`009`009; Set if successful X`009jmp`009copy_err X30$: X`009movw`009FAB$L_STV(r3),-`009`009; VMS channel number to source X`009`009 source_chan X`009jmp`00934$ X32$: X`009$ASSIGN_S -`009`009`009; Open channel directly for`032 X`009`009chan=source_chan,-`009; either SAVE or COPY operations X`009`009devnam=(r2) X`009blbs`009r0,34$ X`009jmp`009copy_err X34$:`009 X;+ X; If we're doing COPY or SAVE, we want to use $QIOW to get terminal charac- X; teristics. Otherwise we want to use it to read the first 12 bytes from X; a disk file. X;- X`009bbs`009#copy_v_restore,r10,40$`009; Are we doing a RESTORE? YES: branch X`009movl`009#IO$_SENSEMODE,r4`009; NO: COPY or SAVE.`032 X`009movl`009#0,r5`009`009`009; No P3 needed for sense operation X; X`009bbc`009#copy_v_permanent,r10,-`009; Are we doing PERMANENT char's? X`009`009 50$`009`009`009; NO: branch... X`009movl`009#IO$_SENSECHAR,r4`009; ... around change of function X`009brb`00950$ X40$: X`009movl`009#IO$_READVBLK,r4`009; R4 => I/O function code; assume X`009`009`009`009`009; this is RESTORE. ($QIO FUNC) X`009movl`009#1,r5`009`009`009; R5 => VBN to read (P3) X50$: X`009$QIOW_S`009func=r4,-`009`009; Function is pusha'd X`009`009chan=source_chan,- X`009`009iosb=iosb,- X`009`009p1=characteristics,-`009; buffer address X`009`009p2=#char_buf_size,- X`009`009p3=r5`009`009`009; VBN to read, or 0 for sense X`009blbc`009r0,55$ X`009movzwl`009iosb,r0 X`009blbs`009r0,60$ X55$: X`009jmp`009copy_err X60$: X;+ X; We have terminal characteristics in the buffer; now we do pretty much the X; same thing to write 'em OUT, with a slightly different set of conditions. X; If we are doing either COPY or RESTORE we want to open a channel to a`032 X; terminal port. Otherwise we want to open a channel to a disk file. X; We should (may) be able to use RMS in both cases; what the hell,`032 X; let's TRY it before we give up... X; X; Note that we can hard-code this straight through, because the CLD`032 X; definition won't let the SAVE and RESTORE operations take place at the X; same time, therefore we will never use the $FAB for input and output`032 X; at the same time. X; X; For output, if we're doing either COPY or RESTORE, we want to open a chann Vel`032 X; to a terminal port. Otherwise we want to open a channel to a disk file. X; We test for the ABSENCE of the SAVE bit, counting on the CLD definition X; to make that condition the equivalent of "RESTORE!COPY".`032 X;- X`009moval`009dest_spec,r2`009`009; R2 => dest. string descriptor address X`009bbc`009#copy_v_save,r10,72$`009; Are we doing a SAVE? X`009`009`009`009`009; NO: go open channel directly X`009`009`009`009`009; YES: open FILE for input X; X`009movab`009file_access,r3`009`009; R3 => FAB base address X; X`009movb`009DSC$W_LENGTH(r2),FAB$B_FNS(r3)`009`009; Install input spec X`009moval`009@DSC$A_POINTER(r2),FAB$L_FNA(r3) X; X`009$CREATE`009FAB=(r3)`009`009; Create the output (save) file X`009blbs`009r0,70$`009`009`009; Set if successful X`009jmp`009copy_err X70$: X`009movw`009FAB$L_STV(r3),-`009`009; VMS channel number to source X`009`009 dest_chan X`009jmp`00974$ X72$: X`009$ASSIGN_S -`009`009`009; Open channel directly for`032 X`009`009chan=dest_chan,-`009; either SAVE or COPY operations X`009`009devnam=(r2) X`009blbs`009r0,74$ X74$:`009 X;+ X; If we're doing COPY or RESTORE we want to use $QIOW to get terminal charac V- X; teristics. Otherwise we want to use it to read the first 12 bytes from X; a disk file. X;- X`009bbs`009#copy_v_save,r10,80$`009; Are we doing a SAVE? YES: branch X`009movl`009#IO$_SETMODE,r4`009`009; NO: COPY or RESTORE. X`009movl`009#0,r5`009`009`009; No P3 needed for setmode operation X; X`009bbc`009#copy_v_permanent,r10,-`009; Are we doing PERMANENT char's? X`009`009 90$`009`009`009; NO: branch... X`009movl`009#IO$_SETCHAR,r4`009`009; ... around change of function X`009brb`00990$ X80$: X`009movl`009#IO$_WRITEVBLK,r4`009; R4 => I/O function code; assume X`009`009`009`009`009; this is SAVE ($QIO FUNC) X`009movl`009#1,r5`009`009`009; R5 => VBN to write (P3) X90$: X`009$QIOW_S`009func=r4,-`009`009; Function is pusha'd X`009`009chan=dest_chan,- X`009`009iosb=iosb,- X`009`009p1=characteristics,-`009; buffer address X`009`009p2=#char_buf_size,- X`009`009p3=r5`009`009`009; VBN to read, or 0 for sense X`009blbc`009r0,95$ X`009movzwl`009iosb,r0 X`009blbs`009r0,100$ X95$: X`009jmp`009copy_err X100$: X;+ X; At this point, we should be done; just deassign the channels and get out X; of here. X;- X`009$DASSGN_S - X`009`009chan=source_chan +-+-+-+-+-+-+-+- END OF PART 1 +-+-+-+-+-+-+-+-