	character*48 f1,fit,fcat,fcatmp,f0,ch*1
	logical logi
        if(iargc().lt.5)then
          write(*,*)
	  write(*,*)'  makemark to file.cat **2000.7'
	  write(*,*)
	  write(*,*)'    Usage: makemark a03j.cat 87 1961 66 1922'
	  write(*,*)
          stop
        endif

        call getarg(1,fit)
	call getarg(2,f0)
	read(f0(1:),*)ic1
	call getarg(3,f0)
	read(f0(1:),*)ic2
	call getarg(4,f0)
	read(f0(1:),*)ir1
	call getarg(5,f0)
	read(f0(1:),*)ir2
	write(*,*)ic1,ic2,ir1,ir2
	if(ic2-ic1.lt.1500.or.ir2-ir1.lt.1500)then
	  write(*,*)' parameters error'
	  stop
	endif
	istar=0
	k=index(fit,'.')
	fcat=fit(1:k)//'cat'
        inquire(file=fcat,exist=logi)
        if(.not.logi)stop ' *.cat file not found !'
	fcatmp=fit(1:k)//'catmp'

	open(1,file=fcat,status='old')
	open(2,file=fcatmp,status='unknown')
	read(1,'(a)')f1
	write(2,'(a)')f1(1:lnblnk(f1))
	ipp=0
	do 5 i=1,14500
	read(1,'(a)',end=6)f1
	ipp=ipp+1
	read(f1(25:),*)x,y
	x=2049-x
	y=2049-y
	k=0
	if(x.lt.ic1.or.x.gt.ic2)k=1
	if(y.lt.ir1.or.y.gt.ir2)k=1
	if(k.eq.1)f1(1:1)='*'
	if(f1(1:1).ne.' ')istar=istar+1
5	write(2,'(a)')f1
6      	close(2) 
	call unlink(fcat)
	call system("mv "//fcatmp//" "//fcat)
	write(*,*)ipp,'  stars ',istar,'  marked_star'
	end
