******************************************************************************
*
*	FORCEX forces a process to exit (drop to the dollar sign on a
*	terminal, for example).  Used for the GAMEMON package
*
*	Eric Richards, 05-Dec-83
*
******************************************************************************
	program forcex
	implicit integer(a-z)
	character buffer*22, ideq*22
	ideq = '/IDENTIFICATION='
	call lib$get_foreign(buffer,,len)
	if (len .eq. 0) then
	   istat = 229448		! Insufficient params
	else
	   loc = index(buffer, '/')
	   if (loc .eq. 0) then
	      istat = sys$forcex(,buffer(1:len),%val(1))
	   else
	      eqloc = index(buffer, '=')
	      if (buffer(loc:eqloc-1) .ne. ideq(loc:eqloc-1)) then
	         istat = 229472		! Unrecognized qual keyword
	      else
	         istat = 229512		! Invalid syntax for value spec.
	         read(buffer(eqloc+1:len),100,err=150) pid
100	         format(z8)
	         istat = sys$forcex(pid,,%val(1))
	      end if
	   end if
	end if
150	call sys$exit(%val(istat))
	end
