cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
c	UBBS utilities - Crlf.for
c	Redo the userlog for UBBS V 3.0
c	Dale Miller - UALR
c	10-Feb-1985
c
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
	implicit none
	include 'bbs_inc.for'
	include 'sys$library:foriosdef'
	integer istat,str$upcase,sys$gettim,sys$asctim
	character null4*4,lfcr*4,dummy_20*20
	real*8 null8/'0000000000000000'x/

	character  zz*1,appstr*12
	character*40 zeros/'0000000000000000000000000000000000000000'/
	null4=char(0)//char(0)//char(0)//char(0)
	lfcr=char(10)//char(13)//char(255)//' '

	open(unit=1,file='userlog.dat',status='old',	
	1   organization='indexed',access='keyed',
	2   recordtype='fixed',recl=50,shared)

	ur.user_key=char(0)
	
 0010	read(1,keygt=ur.user_key,iostat=ios)ur
	if(ios.eq.for$ios_sperecloc) go to 10
	if(ios.ne.0) go to 5000
	if(ur.user_key.eq.zeros) go to 10
 0011	if(ur.approved) then
	    appstr='* Approved *'
	else
	    appstr='Not Approved'
	endif

c	write(6,1000)ur.user_key,ur.city,ur.state,ur.phone_number(1:3),
c	1   ur.phone_number(4:6),ur.phone_number(7:10),ur.computer,
c	2   ur.last_log_date,ur.last_log_time,ur.num_logon,appstr

 1000	format(1x,a,1x,a,','a,1x,'(',a,')',a,'-',a,/,
	1   1x,a,1x,a,1x,a,i6,/,1x,a)

	if(ur.user_crlf.eq.null4) then
	    ur.user_crlf=char(13)//char(10)//char(255)
	    print*,'bad cr '//ur.user_key
	    endif
	if(ur.user_ff.eq.null4) then
	    ur.user_ff=char(13)//char(10)//char(255)
	    print*,'bad ff '//ur.user_key
	    endif
	if(ur.user_crlf.eq.lfcr) then
	    ur.user_crlf=char(13)//char(10)//char(255)
	    print*,'flip cr '//ur.user_key
	    endif
	if(ur.user_ff.eq.lfcr) then
	    ur.user_ff=char(13)//char(10)//char(255)
	    print*,'flip ff '//ur.user_key
	    endif
	if(ur.last_pass_chg.eq.null8) then
	    istat=sys$gettim(%ref(ur.last_pass_chg))
	    istat=sys$asctim(,dummy_20,%ref(ur.last_pass_chg),)
	    print*,'bad password change date '//ur.user_key,dummy_20
	    endif

	rewrite(1,err=90500,iostat=ios)ur
	go to 10

 5000	close(unit=1)
	print*,'ios=',ios
	print*,'finished'
	stop

90500	print*,'an error has occurred'
	print*,'ios=',ios
	stop
	end
