	SUBROUTINE NOPRIV (ist,fname,*)
	 
C 
C FUNCTIONAL DESCRIPTION:	
C 
C    NOPRIV checks the passed value of IST for SS$_NOPRIV or RMS$_PRV to
C    indicate that the accessor has no privilege for the attempted operation.
C    If this is the case, a message is written to unit 6, together with
C    the name of the file (passed in FNAME) and control is returned to the 
C    caller.
C 
C DUMMY ARGUMENTS:
C 
C    IST      Integer*4	  Read	  Status variable
C    FNAME    Character	  Read	  Name of file
C    *	      Address	  Read	  Address of return for error condition
C				  CALL NOPRIV(ist,fname,*20)	 
C IMPLICIT INPUTS:
C 
C    none
C 
C IMPLICIT OUTPUTS:
C 
C    none
C 
C SIDE EFFECTS:
C 
C    A message will be printed if a protection violation has occurred
C 
	IMPLICIT NONE
	INCLUDE '($SSDEF)'
	INCLUDE '($RMSDEF)'

	INTEGER*4 ist
	CHARACTER*(*) fname

	INTEGER*4 ll
	CHARACTER*255 xname

	IF(ist.EQ.SS$_NOPRIV.OR.ist.EQ. RMS$_PRV) THEN
	  CALL STR$TRIM(xname,fname,ll)
	  IF(ll.gt.0) THEN
            IF(ll.lt.40) THEN
              WRITE(6,1000) xname(1:ll)
            ELSE
              WRITE(6,2000) xname(1:ll)
            ENDIF
          ELSE
	      WRITE(6,1000) '<No filename available>'
	  ENDIF
	ELSE
	  RETURN
	ENDIF
	RETURN 1
 1000   FORMAT(A,T30,'No privilege for attempted operation')
 2000   FORMAT(A/T30,'No privilege for attempted operation')
	END
