home *** CD-ROM | disk | FTP | other *** search
- /* Name : INET_Online.rexx
- ** Author : Jim Dutton (jimd@siu.edu)
- ** Date : 22 Feb 1998
- ** Version : 1.0
- ** PreReq's : ARexx, INet-255 (Interworks TCP/IP)
- **
- ** CoReq's : INET_Offline.rexx
- **
- ** Function : Display a (relatively) small console window wherein
- ** the current amount of time (minutes) "online" is displayed
- **
- ** Caveats : As with any other Shell/CLI window, accidently moving
- ** cursor in the window interrupts output
- **
- ** Benie's : Initial window can be resized and moved as desired
- **
- ** Comments : ARexx must be up and running before Inet is;
- ** Modify the initial window size as needed;
- ** The console window closes automatically after Inet
- ** goes offline (via Stop...), after the 15 (sec) pause at the bottom
- **
- ** Usage : Place this and the other programs in an Inet subdirectory;
- ** Add the following line to each Start... Inet script for
- ** dial-up connections, before the 'SetEnv HOSTNAME' line:
- **
- ** Run rexxc:rx inet:<path>/INET_Online <phone number>
- **
- ** Add the following line to each Stop.... Inet script for
- ** dial-up connections:
- **
- ** rexxc:rx inet:<path>/INET_Offline
- *
- */
-
- startup.time = time(); duh = time(reset); parse arg inet_online_phonenum .
-
- If ~open(console,"CON:1/1/500/70/INET_Online_Console") then
- Do; say "*** Can't open 'INET_Online_Console' ***"; Exit 32; End
-
- duh = writeln(console,inet_online_phonenum" INET ONLINE at" startup.time)
-
- If ~show("L","rexxsupport.library") then
- duh = addlib("rexxsupport.library",0,-30,0)
-
- If ~openport(INET_Online_Console) then
- Do
- duh = writeln(console,"*** Can't open 'INET_Online_Console' port ***")
- address "COMMAND" "WAIT 5"; duh = close(console); Exit 33
- End
-
- close_port = no; null_packet = '0000 0000'x; lastElapsedINT = 0; stoptime = 0
-
- Do while close_port = no
- packet_addr = getpkt(INET_Online_Console)
- If packet_addr = null_packet then address 'COMMAND' 'WAIT 10'
- Else
- Do
- packet.time = time(); packet_msg = getarg(packet_addr,0); duh = reply(packet_addr,0)
-
- If subword(packet_msg,1,2) = "INET Offline" then
- Do
- close_port = yes; parse var packet_msg . . . stoptime .
- duh = writeln(console,inet_online_phonenum" INET went ONLINE at:" startup.time)
- duh = writeln(console,inet_online_phonenum" INET went OFFLINE at:" stoptime)
- duh = writeln(console,"-- Offline packet time =" packet.time)
- End
- Else
- duh = writeln(console,packet_msg)
- End
-
- ElapsedINT = time(elapsed)%60
- If ElapsedINT > lastElapsedINT then
- Do
- duh = writeln(console,inet_online_phonenum" Minutes Online:" ElapsedINT)
- lastElapsedINT = ElapsedINT
- End
- End
-
- duh = closeport(INET_Online_Console); address "COMMAND" "WAIT 15"
- duh = close(console)
- Exit
-