      subroutine opnrot (temple, root, file, maxch)
      integer maxch
      integer*2 temple(*)
      integer*2 root(*)
      integer*2 file(*)
      integer*2 star
      integer ic
      integer jc
      logical Memb(1)
      integer*2 Memc(1)
      integer*2 Mems(1)
      integer Memi(1)
      integer*4 Meml(1)
      real Memr(1)
      double precision Memd(1)
      complex Memx(1)
      equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx)
      common /Mem/ Memd
      integer sp
      integer patten
      integer errmsg
      integer stridx
      integer wordfh
      integer imaccs
      logical xerflg
      common /xercom/ xerflg
      integer*2 nostar(55)
      integer*2 badime(50)
      save
      integer iyy
      data (nostar(iyy),iyy= 1, 8) / 84,101,109,112,108, 97,116,101/
      data (nostar(iyy),iyy= 9,16) / 32,110, 97,109,101, 32,100,111/
      data (nostar(iyy),iyy=17,24) /101,115, 32,110,111,116, 32, 99/
      data (nostar(iyy),iyy=25,32) /111,110,116, 97,105,110, 32,119/
      data (nostar(iyy),iyy=33,40) /105,108,100, 99, 97,114,100, 32/
      data (nostar(iyy),iyy=41,48) / 99,104, 97,114, 97, 99,116,101/
      data (nostar(iyy),iyy=49,55) /114, 32, 40, 37,115, 41, 0/
      data (badime(iyy),iyy= 1, 8) / 67, 97,110,110,111,116, 32,102/
      data (badime(iyy),iyy= 9,16) /105,110,100, 32,105,109, 97,103/
      data (badime(iyy),iyy=17,24) /101, 32, 99,111,114,114,101,115/
      data (badime(iyy),iyy=25,32) /112,111,110,100,105,110,103, 32/
      data (badime(iyy),iyy=33,40) /116,111, 32,114,111,111,116, 32/
      data (badime(iyy),iyy=41,48) /110, 97,109,101, 32, 40, 37,115/
      data (badime(iyy),iyy=49,50) / 41, 0/
      data star / 42 /
         call smark (sp)
         call salloc (patten, 511 , 2)
         call salloc (errmsg, 1023 , 2)
         ic = 1
         file(1) = 0
110      if (.not.(wordfh (temple, ic, memc(patten), 511 ) .gt. 0)) goto
     *    111
            jc = stridx (star, memc(patten))
            if (.not.(jc .eq. 0)) goto 120
               call sprinf (memc(errmsg), 1023 , nostar)
               call pargsr (memc(patten))
               call xerror(1, memc(errmsg))
               if (xerflg) goto 100
120         continue
            call xstrcy(memc(patten), file, jc-1)
            call xstrct(root, file, maxch)
            call xstrct(memc(patten+jc), file, maxch)
            if (.not.(imaccs (file, 1 ) .eq. 1)) goto 130
               goto 111
130         continue
            file(1) = 0
            goto 110
111      continue
         if (.not.(file(1) .eq. 0)) goto 140
            call sprinf (errmsg, 1023 , badime)
            call pargsr (root)
            call xerror(1, memc(errmsg))
            if (xerflg) goto 100
140      continue
         call sfree (sp)
100      return
      end
c     temple  template
c     sprinf  sprintf
c     opnrot  opnroot
c     imaccs  imaccess
c     wordfh  word_fetch
c     patten  pattern
c     badime  badimage
c     pargsr  pargstr
