procedure main( cc )
dd := ""
n := 0
kj := 1
fg := cc[ 1 ]
if /fg then stop( "non-existent file" )
bb := open( fg, "r" ) | stop( "wrong file name" )
ee := open( fg || ".htm", "cw" )
while aa := read( bb ) do {
    if aa[ -1:0 ] ~== " " then aa ||:= " "   
    dd ||:= aa }
    
po := *dd / 100
hi := po / 4
dd ? { while jj := move( 1 ) do {
    n +:= 1
    if n = hi then { n := 0
	writes( &pos / po, "% \r" ) }
	
    case jj of {
	"<" : { if kj = 0 then write( ee )
	    writes( ee, "<", tab( upto( '>' ) ), ">" )
	    move( 1 )
	    tab( many( ' ' ) )
	    kj := 1 }
	    
	"&" : if "nbsp;" == move( 5 ) then { if kj = 0 then write( ee )
	    writes( ee, "&nbsp;" )
	    kj := 1 } else writes( ee, "&" )
	( jj ** &letters ~== jj ) : writes( ee, jj )
	default : { if kj = 1 then write( ee )
	    writes( ee, jj )
	    kj := 0 } 
	} 
    } 
    write( "100%" ) }
    
end
