[mod.computers.vax] Yet Another Command file for Remote DECnet access

CHRIS@engvax.UUCP.UUCP (07/14/86)

[ Oh great bug, this line I offer unto you. ]

     The following command file I whiped up when I got tired of logging out of
one system and onto another one just to check who was logged in, or if all the
disks were on the other system, or whatever.  It requires that you be able to
write to whatever directory you default to on the other node (without proxys
that is typically the default DECnet account).

     It was a quick and dirty hack, so I didn't try to do things like passing
parameters to any command files that I might want to pass over to the other
node.  Also, remember that the command files that you execute exist on your
node...

-- Chris Yoder			UUCP -- {allegra|ihnp4}!scgvaxd!engvax!chris 
   Hughes Aircraft Company 	ARPA -- engvax!chris@csvax.caltech.edu

-------------------------------- Cut Here --------------------------------------
$	veri = f$verify(0)
$ ! REMOTE.COM -- A command file to execute a command on a remote node.
$ !
$ !	Written by	Chris Yoder
$ !		on	January 16, 1986
$ !		for	Hughes Aircraft Company
$ !			Space and Communications Group
$ !			Computing Technology Center
$ !			Copyright 1986
$ !
$ !	P1 -- Name of the system that the command is to be run on.  :'s are
$ !		automatically stripped.
$ !	P2 -- Command to run on remote system. (@ sign to indicate command file)
$ !	P3 -> P8 -- Tacked onto the command to run on the remote system iff it
$ !		is not a command file.
$ !
$	on control_y then $ goto cleanup
$	on error then $ goto cleanup
$	on warning then $ goto cleanup
$ top:
$	if p1 .nes. "" then goto check2
$	inquire p1 "Node to run on"
$ 	goto top
$ check2:
$	if p2 .nes. "" then goto do_it
$	inquire p2 "Command to run"
$	goto check2
$ do_it:
$	p1 = p1 - ":" - ":"
$	if f$locate("@",P2) .ne. f$length(P2) then goto command_file
$	on error then $ goto close_file
$	on warning then $ goto close_file
$	open/write stuff sys$scratch:doof_remote.com
$	write stuff "$ define sys$output sys$net"
$	write stuff "''p2' "+"''p3' "+"''p4' "+"''p5' "+"''p6' "+"''p7' "+"''p8'"
$	close stuff
$	on error then $ goto cleanup
$	on warning then $ goto cleanup
$	goto do_command
$ command_file:
$	on error then $ goto close_file
$	on warning then $ goto close_file
$	open/write stuff sys$scratch:doof_remote.com
$	write stuff "$ define sys$output sys$net"
$	close stuff
$	on error then $ goto cleanup
$	on warning then $ goto cleanup
$	p2 = f$edit(p2,"TRIM")
$	if f$length(P2) .eq. 1 then $ p2 = f$edit(p3,"TRIM")
$	if f$locate(".",p2) .eq. f$length(p2) then $ p2 = p2 + ".com"
$	if f$locate("@",p2) .nes. f$length(p2) then -
		$ p2 = f$extract(1,f$length(p2)-1,p2)
$	on warning then goto do_command
$	append 'p2 sys$scratch:doof_remote.com
$ do_command:
$	on warning then goto cleanup
$	copy sys$scratch:doof_remote.com 'p1::doof_remote.com
$	type 'p1::"task=doof_remote"
$	goto cleanup
$ close_file:
$	close stuff
$ cleanup:
$	set noon
$	delete 'p1::doof_remote.com.
$	delete sys$scratch:doof_remote.com.
$	set on
$	veri = f$verify(veri)
$ exit