From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 19-MAR-1991 14:44:37.53
To:	ARISIA::EVERHART
CC:	
Subj:	Terminal-Settings Copy Utility, Part 2 of 2

From:	RELAY-INFO-VAX@CRVAX.SRI.COM@SMTP@CRDGW2
To:	Everhart@Arisia@MRGATE

Received:  by crdgw1.ge.com (5.57/GE 1.91)
	 id AA27994; Tue, 19 Mar 91 14:16:37 EST
Received: From UCBVAX.BERKELEY.EDU by CRVAX.SRI.COM with TCP; Tue, 19 MAR 91 05:38:40 PST
Received: by ucbvax.Berkeley.EDU (5.63/1.42)
	id AA02792; Tue, 19 Mar 91 05:26:12 -0800
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 19 Mar 91 12:04:05 GMT
From: portal!cup.portal.com!Chris_F_Chiesa@apple.com
Organization: The Portal System (TM)
Subject: Terminal-Settings Copy Utility, Part 2 of 2
Message-Id: <40323@cup.portal.com>
References: <9103120950.AA11567@ucbvax.Berkeley.EDU>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com

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

