Google
 

Trailing-Edge - PDP-10 Archives - tops10_integ_tools_v4_10jan-86 - 70,6067/telvms/tell.for
There are 4 other files named tell.for in the archive. Click here to see a list.
	PROGRAM TELL
	IMPLICIT NONE
C
C AUTHOR:	Ken Johnson
C
C 		Monsanto Agricultural Products Co.
C		800 N. Lindbergh V2B
C		St. Louis, MO 63167
C
C MODIFICATION HISTORY:
C
C	VERSION	WHO	WHEN		DESCRIPTION
C	-------+-------+---------------+-------------------------
C	V01.00	KLJ	18-Dec-83	INITIAL VERSION.
C	V01.01	KLJ	20-Jan-84	Fix handling of buffer length
C	V01.02	KLJ	27-Jan-84	Remove leading "1X" from FORMAT
C
C PAGE 2 - TELL - DOCUMENTATION
C
C+
C
C NAME:		TELL
C
C FUNCTION:	Work with TELL server to execute a command on a remote node
C
C DISCUSSION:
C
C		This program gets a command line and sends it to the
C	TELL server on another node; then the resulting output from
C	the remote command execution is displayed on the terminal.
C
C CALLING SEQUENCE:
C
C	CALL TELL (<arglist>,ERROR)
C
C ARGUMENTS:
C
C	<arg	- datatype usage; description>
C	ERROR	- INTEGER*4 OUTPUT; ERROR STATUS.
C
C ERROR VALUES:
C
C	1	- SUCCESSFUL COMPLETION.
C	<value	- description>
C
C NOTES:
C
C	<notes>
C
C-
C
C
C PAGE 3 - TELL - DECLARATIONS
C

C INCLUDED FILES:

C CALLING PARAMETERS:

C	<datatype	argument		! description>
	INTEGER*4	ERROR			! OUTPUT; ERROR STATUS.
	
C LOCAL PARAMETER STATEMENTS:

C	NONE.

C LOCAL VARIABLE AND ARRAY DEFINITIONS:

	INTEGER*4	LIB$GET_FOREIGN
	EXTERNAL	LIB$GET_FOREIGN
	INTEGER*4	I
	CHARACTER*136	COMMAND
	CHARACTER*136	MESSAGE
	INTEGER*4	LENGTH
	INTEGER*4	ISTATUS
	CHARACTER*40	NETFILE
	CHARACTER*30	NODNAME

C LOCAL EQUIVALENCES:

C LOCAL VARIABLE AND ARRAY INITIALIZATION:

C	NONE.
C
C PAGE 4 - TELL - ENTRY POINT
C
C
C	Get the command line
C
	COMMAND='               '
	ISTATUS=LIB$GET_FOREIGN(COMMAND,,LENGTH)
C	WRITE (*,1900)COMMAND
C
C	Parse out node name
C
	IF (INDEX(COMMAND,':') .EQ. 0) GOTO 850
	I=INDEX(COMMAND,':')
	IF (COMMAND(I+1:I+1) .NE. ':') GOTO 850
	NODNAME = COMMAND(1:I+1)
C
C	Set up the file spec to connect to object 198
C
	NETFILE=NODNAME
	NETFILE(I+2:I+7)='"198="'
	OPEN (ACCESS='SEQUENTIAL',
	1	FILE=NETFILE,
	4	STATUS='UNKNOWN',
	5	UNIT=2)
C
C	Parse out extra spaces and
C	Send the command to the TELL server
C
	I=I+2
50	CONTINUE
	IF (COMMAND(I:I) .NE. ' ')GOTO 100
	I=I+1
	GOTO 50
100	CONTINUE
	WRITE (2,1900)COMMAND(I:LENGTH)
C
C	Display the result of the command
C
200	CONTINUE
	MESSAGE(1:20)   ='                    '
	MESSAGE(21:40)  ='                    '
	MESSAGE(41:60)  ='                    '
	MESSAGE(61:80)  ='                    '
	MESSAGE(81:100) ='                    '
	MESSAGE(101:120)='                    '
	MESSAGE(121:136)='                '
	READ (2,1100,END=700,ERR=900)LENGTH,MESSAGE
	WRITE (*,1000)(MESSAGE(I:I),I=1,LENGTH)
	GOTO 200
700	CONTINUE
	WRITE (*,1000)(MESSAGE(I:I),I=1,LENGTH)
	GOTO 999
800	CONTINUE		! Connect failed
	WRITE (*,1200)
	GOTO 999
850	CONTINUE		! No nodename specified
	WRITE (*,1300)
	GOTO 999
900	CONTINUE		! Network I/O failed
	WRITE (*,1500)
	GOTO 999
999	CONTINUE		! exit
	CLOSE (UNIT=2)
	CALL EXIT(1)

C FORMAT STATEMENTS.

1000	FORMAT (1X,136A)
1100	FORMAT (Q,A136)
1200	FORMAT (1X,'Error in connecting to TELL server')
1300	FORMAT (1x,'No nodename (string::) found')
1500	FORMAT (1X,'Network I/O failed')
1900	FORMAT (136A)
	END