+-+-+-+ Beginning of part 2 +-+-+-+ X$ if f$length(p2) .eq. 4 then user = "''p2' " X$ if f$length(p2) .eq. 5 then user = "''p2' " X$ if f$length(p2) .eq. 6 then user = "''p2' " X$ if f$length(p2) .eq. 7 then user = "''p2' " X$ if f$length(p2) .eq. 8 then user = "''p2' " X$ if f$length(p2) .eq. 9 then user = "''p2' " X$ if f$length(p2) .eq. 10 then user = "''p2' " X$ if f$length(p2) .eq. 11 then user = "''p2' " X$ if f$length(p2) .eq. 12 then user = "''p2'" X$! X$ read /index=0 /key="''user'" /delete ration_file ration_line X$ goto cleanup X$cleanup: X$ set control=y X$ close /nolog ration_file X$ exit V$!--------------------------------------------------------------------------- X--- X$check_for_new_ration: X$ read /index=0 /key="''user'" /error=add_new_ration ration_file ration_line X$ return X$add_new_ration: X$ write ration_file "''user'''default_time_template'" X$ return V$!--------------------------------------------------------------------------- X--- X$command_entry: X$ inquire /nopunct ration_cmd "RATION> " X$ bit0 = f$element(0," ",ration_cmd) X$ bit1 = f$element(1," ",ration_cmd) X$ bit2 = f$element(2," ",ration_cmd) X$ bit3 = f$element(3," ",ration_cmd) X$ good_cmd = 0 X$ if (bit0 .eqs. "HELP") .or. (bit0 .eqs. "?") X$ then X$ `009good_cmd = 1 X$ `009say "" X$ `009say "The following commands are available at the RATION> prompt:" X$ `009say "" V$ `009say " CR`123EATE`125 Creates a new RATION.DAT file (if any X users have" V$`009say " been modified, they are moved over to the new X file)" V$`009say " DE`123LETE`125 username Remove the username from the RATION.DAT X file" V$ `009say " MOD`123IFY`125 username [authorized minutes] `123used minutes` X125" X$ `009say " SH`123OW`125 username Displays the current usage and ration" X$ `009say " TY`123PE`125 Displays the RATION.DAT file" X$`009say "" X$ `009say " EX`123IT`125 Exits this procedure" X$ `009say "" X$ endif X$! X$ if (f$extr(0,2,bit0) .eqs. "EX") .and. - X`009(f$loc("''bit0'","EXIT") .ne. f$len("EXIT")) then goto cleanup X$! X$ if (f$extr(0,2,bit0) .eqs. "TY") .and. - X`009(f$loc("''bit0'","TYPE") .ne. f$len("TYPE")) X$ then X$ `009type 'default_ration_location'ration.dat X$`009good_cmd = 1 X$ endif X$! X$ if (f$extr(0,2,bit0) .eqs. "SH") .and - X`009(f$loc("''bit0'","SHOW") .ne. f$len("SHOW")) .and. - X`009(bit1 .nes. " ") X$ then X$ `009close /nolog ration_file X$ `009open /share/read/write ration_file 'default_ration_location'ration.dat X$ `009if f$length(bit1) .eq. 1 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 2 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 3 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 4 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 5 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 6 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 7 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 8 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 9 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 10 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 11 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 12 then user = "''bit1'" V$ `009read /index=0 /key="''user'" /error=no_user_show ration_file ration_lin Xe X$`009@'default_ration_location'ration show_ration 'bit1' X$`009say "" X$`009goto good_user_show X$no_user_show: X$`009close /nolog ration_file V$ `009say "%RATION-E-NOUSER, The ''bit1' username does not exist in RATION.DA XT." X$good_user_show: X$`009good_cmd = 1 X$ endif X$! X$ if (f$extr(0,3,bit0) .eqs. "MOD") .and. - X`009(f$loc("''bit0'","MODIFY") .ne. f$len("MODIFY")) .and. - X`009(bit1 .nes. " ") X$ then X$ `009close /nolog ration_file X$ `009open /share/read/write ration_file 'default_ration_location'ration.dat X$ `009if f$length(bit1) .eq. 1 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 2 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 3 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 4 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 5 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 6 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 7 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 8 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 9 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 10 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 11 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 12 then user = "''bit1'" V$ `009read /index=0 /key="''user'" /error=no_user_modify ration_file ration_l Xine X$`009@'default_ration_location'ration modify_ration 'bit1' 'bit2' 'bit3' X$`009say "" X$`009goto good_user_modify X$no_user_modify: X$`009close /nolog ration_file V$ `009say "%RATION-E-NOUSER, The ''bit1' username does not exist in RATION.DA XT." X$good_user_modify: X$`009good_cmd = 1 X$ endif X$! X$ if (f$ext(0,2,bit0) .eqs. "CR") .and. - X`009(f$loc("''bit0'","CREATE") .ne. f$len("CREATE")) X$ then X$`009@'default_ration_location'ration create_ration X$`009good_cmd = 1 X$ endif X$! X$ if (f$extr(0,2,bit0) .eqs. "DE") .and. - X`009(f$loc("''bit0'","DELETE") .ne. f$len("DELETE")) .and. - X`009(bit1 .nes. " ") X$ then X$ `009close /nolog ration_file X$ `009open /share/read/write ration_file 'default_ration_location'ration.dat X$ `009if f$length(bit1) .eq. 1 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 2 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 3 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 4 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 5 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 6 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 7 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 8 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 9 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 10 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 11 then user = "''bit1' " X$ `009if f$length(bit1) .eq. 12 then user = "''bit1'" V$ `009read /index=0 /key="''user'" /error=no_user_delete ration_file ration_l Xine X$`009@'default_ration_location'ration delete_ration 'bit1' 'bit2' X$`009say "" X$`009goto good_user_delete X$no_user_delete: X$`009close /nolog ration_file V$ `009say "%RATION-E-NOUSER, The ''bit1' username does not exist in RATION.DA XT." X$good_user_delete: X$`009good_cmd = 1 X$ endif X$! X$ if .not. good_cmd then - X`009say "%RATION-E-BADCMD, Bad command (type HELP for commands)." X$ goto command_entry X$ goto cleanup $ GOSUB UNPACK_FILE $ FILE_IS = "RATION_MONITOR.COM" $ CHECKSUM_IS = 1930244948 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X$ set noon X$ set control=y X$ say := write sys$output X$ auth_minutes := 00240 X$ if .not. f$priv("sysprv") then exit X$ default_ration_location = "BBS$ROOT:[RATION]" X$ if f$parse("''default_ration_location'") .eqs. "" X$ then X$ `009default_ration_location = f$environment("procedure") V$ `009default_ration_location = f$extract(0,f$locate("]",default_ration_locat Xion)+1,default_ration_location) X$ endif X$ if f$search("''default_ration_location'ration.dat") .eqs. "" then - X`009@'default_ration_location'ration create_ration X$ if f$mode() .eqs. "OTHER" then goto top X$ control_variable = "" X$stop_monitor_loop: X$ cur_pid = f$pid(control_variable) X$ if cur_pid .eqs. "" then goto start_monitor X$ process_name = f$getjpi(cur_pid,"prcnam") X$ if process_name .eqs. "Ration Monitor" then - X`009stop/id='cur_pid' X$ if process_name .eqs. "Ration Monitor" then - X`009goto start_monitor X$ goto stop_monitor_loop X$start_monitor: X$ run /detached sys$system:loginout - X /input='default_ration_location'ration_monitor.com - X /output='default_ration_location'ration_monitor.log /uic=[001,004] - X /process_name="Ration Monitor" X$ purge 'default_ration_location'ration_monitor.log X$ exit X$top: X$ close /nolog ration_file X$ wait 00:01:00 X$ open /share/read/write ration_file 'default_ration_location'ration.dat X$ gosub record_usage X$ goto top V$!=========================================================================== X=== X$record_usage: X$ control_variable = "" X$show_process_loop: X$ cur_pid = f$pid(control_variable) X$ if cur_pid .eqs. "" then goto end_show_process X$ phy_term = f$getjpi(cur_pid,"tt_phydevnam") X$ if phy_term .eqs. "" then goto show_process_loop X$ if f$extract(0,3,phy_term) .nes. "_NV" then goto show_process_loop X$ gosub record_ration X$ goto show_process_loop X$end_show_process: X$ return V$!=========================================================================== X=== X$record_ration: X$ user = f$getjpi(cur_pid,"username") X$ if f$edit(user,"trim") .eqs. "" then return X$ tim = f$extract(0,17,f$time()) X$ read /index=0 /key="''user'" /error=new_user ration_file ration_line X$ used = f$extract(17,5,ration_line) X$ used = f$int(used) X$ used = used + 1 X$ if f$length(used) .eq. 5 then used = "''used'" X$ if f$length(used) .eq. 4 then used = "0''used'" X$ if f$length(used) .eq. 3 then used = "00''used'" X$ if f$length(used) .eq. 2 then used = "000''used'" X$ if f$length(used) .eq. 1 then used = "0000''used'" X$ auth = f$extract(12,5,ration_line) X$ say "''tim' ''user' (auth: ''auth' used: ''used')" X$ write /update ration_file "''user'''auth'''used'" X$ return X$new_user: X$ say "''tim' ''user' (new user entry)" X$ write ration_file "''user'''auth_minutes'00000" X$ return $ GOSUB UNPACK_FILE $ EXIT -+-+-+-+-+ End of part 2 +-+-+-+-+- -- Harrison M. Spain III ... Voice: (714) 952-6114 McDonnell Douglas M&E ... Internet: spain@mdcbbs.com 5701 Katella Avenue ... UUCP: {uunet,decwrl,att}!mdcbbs.com!spain Cypress, CA 90630 ... PSI: PSI%31060099980019::SPAIN