/* Written by Mikael duck Johansson */

parse arg LineNumber
signal on ERROR

DoorName = "LastUser"

if( ~show( 'l', "mebbsarexx.library" ) )then do
   say "Opening mebbsarexx.library"
 if( ~addlib( "mebbsarexx.library", 0, -30, 0 ) )then do
      say "Could not open library"
      exit 10
   end
end

call GetVar DoorName,LineNumber,1  ;  username=result
call GetVar DoorName,LineNumber,11 ;  calls=result
call GetVar DoorName,LineNumber,18 ;  total_calls=result

path="DOORS:"
a=0

logoff=left(time(), 5, 3)

call open(file,path||'LastUser/LastUser.txt','R')
     do until eof(file)
	a=a+1
	lin.a = readln(file)
     end
call close(file)

if LineNumber ~= "0" then do
call open(file,path||'LastUser/LastUser.txt','W')
     call writeln(file,lin.1''logoff' l')
     call writeln(file,lin.2)
     call writeln(file,lin.3)
     call writeln(file,lin.4)
     call writeln(file,lin.5)
     call writeln(file,lin.6)
     call writeln(file,lin.7)
     call writeln(file,lin.8)
     call writeln(file,lin.9)
     call close(file)
end

call Exit_Door DoorName,LineNumber
exit 0

ERROR:
	string=''                                                      
	call output ; string='*BOOM*  Got an error.  PLEASE notify the sysop.'       
	call output ; string='Line:' SIGL '   Severity:' RC                          
	call output ; string=''                                                      
	call output ; string='PLEASE write down the TYPE of ERROR and the LINE # and'
	call output ; string='leave the SYSOP a message so he may get it corrected.' 
	call output
	call HotKey DoorName,LineNumber,"Press any key "
	call Exit_Door DoorName,LineNumber
	exit 10

output:
call message DoorName,LineNumber,string,1
return 
