C this was WAY too painful, so I put the bad stuff into memory
	parameter(maxstars=100000)
C This is the critical parameter:
	data hit/1.0/
	character*80 inline
	character*80 filein
	dimension xbad(maxstars),ybad(maxstars)
	open(unit=1,file='badxy',status='old')
	ibad=0
111	read(1,*,end=88) xb,yb
	ibad=ibad+1
	xbad(ibad)=xb
	ybad(ibad)=yb
	go to 111
88	continue
	write(6,89) ibad
89	format('Number of bad stars:',i9)
	close(unit=1)
	open(unit=1,file='temppass',status='old')
	read(1,2) filein
	write(6,2) filein
2	format(a80)
	close(unit=1)
	alast=lnblnk(filein)
C This is the OLD als file
	open(unit=1,file=filein(1:alast),status='old')
C Get the next line from the allstar file
1	read(1,2,end=99) inline
C If it is a comment line, just copy it over
	if(inline(1:1).eq.'#')then
	  write(3,2) inline
	  go to 1
	end if
C
C OK if we are here then it is a real star. Two lines per star.
	read(inline(10:29),*) x,y
C 
C Now see if it is in the bad boy file:
	do 555 i=1,ibad
	dist2=(x-xbad(i))**2+(y-ybad(i))**2
C See if it's bad
	if(dist2.lt.hit) then
C get rid of this star
	read(1,2) inline
	go to 1
	end if
555	continue
C If we're here, then we're AOK!
	write(3,2) inline
	read(1,2) inline
	write(3,2) inline
	go to 1
99	close(unit=1)
	close(unit=3)
	stop
	end
