	character a*200,b*256,c*70,d*70,fdate*24,ft*24,f1*40,cr*1
	byte init1(14),init2(24),init3(23),iend(5)
	data init1/32,32,27,'E',27,'&','l','1','O',     ! reset & landscape
     *		       27,'&','a','0','L'/		! left margin
	data init2/27,'(','s','1','2','.','0','0','h',	! default
     *                '1','0','.','0','v','3','T',	! font
     *             27,'&','l','6','d','6','2','F'/	! line gap
	data init3/27,'(','s','1','6','.','6','7','h',	! samll font
     *                '8','.','5','v','0','T',		! font
     *             27,'&','l','8','d','8','2','F'/	! line gap
	data  iend/27,'&','l','0','H'/			! eject paper
	cr=char(13)
	n=iargc()
	if(n.eq.0)then
	write(*,*)'HP 2p Laser_printer in Landscape (create by Jiang 1991)'
	write(*,*)'usage: hplp [-te#] file1 file2 ... '
	write(*,*)'    t: title;  e: small_font;  #: 0~9 left margin)'
	stop
	endif
	call getenv('HOME',f1)
	f1=f1(1:lnblnk(f1))//'/daemon.page'
	k1=1
	ipage=43
	call getarg(k1,a)
	if(a(1:1).eq.'-')then
	k1=k1+1
	if(a(2:2).eq.'t'.or.a(3:3).eq.'t'.or.a(4:4).eq.'t')ipage=41
	if(a(2:2).eq.'e'.or.a(3:3).eq.'e'.or.a(4:4).eq.'e')ipage=ipage+15
	do 99 i=2,4
	k=ichar(a(i:i))
99	if(k.lt.58.and.k.gt.48)init1(13)=k
	endif		
	do 100 k=k1,n
	call getarg(k,a)
	open(1,file=a,status='old',iostat=ierr)
	if(ierr.ne.0)write(*,*)'cannot access ',a(1:30)
	if(ierr.ne.0)goto 100
	call unlink(f1)
	open(2,file=f1,status='new')
  	call getenv('HOST',b)
  	call getenv('PWD',c)
  	d=b(1:lnblnk(b))//':'//c
  	c=d(1:lnblnk(d))//'/'//a
	ft=fdate()
	c=c(1:46)//ft
        write(2,"('  ',$)")
	if(ipage.lt.50)write(2,'(38a1,$)')init1,init2
	if(ipage.gt.50)write(2,'(37a1,$)')init1,init3
	i=0
	ip=0
10	i=i+1
	read(1,'(a)',end=20)a
	if(mod(i,ipage).eq.1)then
	ip=ip+1
	if(ipage.eq.41)write(2,"(2a,39x,'page',i4/)")cr,c,ip
	if(ipage.eq.56)write(2,"(2a,84x,'page',i5/)")cr,c,ip
	endif
	j2=0
	do 30 j=1,lnblnk(a)
	j2=j2+1
	if(ichar(a(j:j)).ne.9)then
	b(j2:j2)=a(j:j)
		else
	j3=j2+7-mod(j2-1,8)
	b(j2:j3)=' '
	j2=j3
		endif
30	continue
	write(2,"(2a)")cr,b(1:j2)
	goto 10
20	write(2,'(5a1,$)')iend
	close(2)
	close(1)
	a='lpr -Php '//f1
	call system(a)
	write(*,*)c(1:40),ip,' pages'
100	continue
	call unlink(f1)
	end
