{ ROSUTL.INC - Remote Operating System Utility Sub-system } overlay procedure display_users; { Display user file } var i, colbeg, colend, len: integer; ch, disp_case: char; t: tad_array; key: StrName; st: StrTAD; temp_user_rec: user_list; begin if user_rec.access = 255 then ch := select('User list', 'AllQuickUnvalidated') else ch := 'Q'; if not (ch in ['A', 'Q', 'U']) then ch := 'Q'; GetTAD(t); st := FormTAD(t); if ch = 'U' then writeln(USR, 'Unvalidated users as of: ', st) else writeln(USR, 'User file as of: ', st); writeln(USR); if user_rec.access = 255 then write(USR, FileLen(DatF), ' records, '); writeln(USR, UsedRecs(DatF), ' users in file.'); colend := len_msg; ClearKey(IdxF); repeat NextKey(IdxF, i, key); if OK then with temp_user_rec do begin GetRec(DatF, i, temp_user_rec); if (ch = 'Q') and (fn <> 'SYSOP') and (access >= 20) then begin key := fn + ' ' + ln; colbeg := succ(colend); while 0 <> colbeg mod 16 do colbeg := succ(colbeg); len := colbeg - colend; colend := colbeg + length(key); if colend > len_msg then begin writeln(USR); colend := length(key) end else write(USR, ' ':len); write(USR, key) end else if (ch = 'A') or ((ch = 'U') and (access < 20)) then begin if case_sw then disp_case := 'L' else disp_case := 'U'; st := FormTAD(laston); writeln(USR, pad(ln, len_ln), ' ', pad(fn, len_fn), ' ', pad(ad, len_ad), ' ', pad(pw, len_pw), ' ', access:3, ' ', nulls:2, ' ', disp_case, ' ', st:32, ' ', time_today:2, ' ', time_total:4, ' ', lasthi:4, ' ', upload:3, ' ', download:3) end end until brk or (not OK) end; overlay function chat: boolean; { Chat with sysop } var ch: char; i: integer; count: real; t: tad_array; st: StrStd; begin OK := op_chat; if op_chat then writeln(USR, 'CHAT initiated by Sysop.') else begin GetTAD(t); if (t[2] < ChatStart) or (t[2] > pred(ChatEnd)) then writeln(USR, 'Sorry, the hours to chat are ', ChatStart, ':00 to ', ChatEnd, ':00.') else begin writeln(USR); writeln(USR, 'Please standby ', user_rec.fn, ' ', user_rec.ln, '.'); writeln(USR, 'Will ring for 30 seconds. Type ^C to cancel.'); writeln(USR); write(USR, '|-------------------------------|', CR, '|'); i := 15; repeat write(BEL, BEL, BEL); { BEL is not normally sent to console } write(USR, '-+', BEL); count := 1.6 * lps; repeat ch := GetChar; count := count - 1.0 until (not online) or (count < 0.0) or (ch in [ETX, ESC]); i := pred(i) until (not online) or (i <= 0) or (ch in [ETX, ESC]); writeln(USR); if ch = ETX then writeln(USR, 'Cancelled.') else if ch = ESC then begin writeln(USR, 'Sysop is available. Type ^C to exit CHAT...'); OK := TRUE end else writeln(USR, 'Sorry, the sysop is not available.') end end; if OK then begin writeln(USR); next_inpstr := ''; repeat st := next_inpstr; GetStr(st, ch, len_msg, 'AEW'); writeln(USR) until (not online) or (ch = ETX); chat := FALSE end else chat := ask('Would you care to leave a message'); op_chat := FALSE end; overlay procedure display_time; { Display current system time and date } var t: tad_array; st: StrTAD; begin GetTAD(t); st := FormTAD(t); writeln(USR, st); if user_rec.access = 255 then if ask('Do you want to reset the time') then begin writeln(USR); t[5] := strint(prompt('Year : ', 2, 'E')); writeln(USR); t[4] := strint(prompt('Month : ', 2, 'E')); writeln(USR); t[3] := strint(prompt('Day : ', 2, 'E')); writeln(USR); t[2] := strint(prompt('Hour : ', 2, 'E')); writeln(USR); t[1] := strint(prompt('Minute: ', 2, 'E')); writeln(USR); t[0] := strint(prompt('Second: ', 2, 'E')); writeln(USR); SetTAD(t); GetTAD(t); st := FormTAD(t); writeln(USR, st) end end; overlay procedure display_stats; var days, max: integer; t: tad_array; day_array: array[0..23] of integer; procedure show_graph(title: StrPr); var i, j: integer; factor, scale: real; line: StrStd; begin writeln(USR, ' ':8, title, ' for the Last ', days, ' Days'); writeln(USR); factor := max / 15.0; for j := 15 downto 1 do begin line := ' '; scale := factor * j; for i := 0 to 23 do if day_array[i] > scale then begin line[1 + 3 * i] := '*'; line[2 + 3 * i] := '*' end; { write(USR, (scale / 10.0):3:1); } write(USR, scale:3:0); i := length(line); while line[i] = ' ' do i := pred(i); writeln(USR, ' ', copy(line, 1, i)) end; writeln(USR, ' 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11'); writeln(USR, ' |------------- A. M. ---------------|------------- P. M. -------------|') end; procedure show_users_by_hour; var i: integer; begin for i := 0 to 23 do begin day_array[i] := round(10.0 * stat_rec.users_per_hour[i] / days); if max < day_array[i] then max := day_array[i] end; show_graph('Average Number of Users per Hour') end; procedure show_busy_by_hour; var i: integer; begin for i := 0 to 23 do begin day_array[i] := round((100.0 * stat_rec.busy_per_hour[i]) / (60.0 * days)); if max < day_array[i] then max := day_array[i] end; show_graph('Percent of Average System Usage by Hour') end; begin { show_stats } GetTAD(t); days := round(greg_to_jul(t[3], t[4], t[5]) - greg_to_jul(stat_rec.t[3], stat_rec.t[4], stat_rec.t[5])); if days = 0 then days := 1; max := 0; show_busy_by_hour end; overlay procedure alter_user_params; { Get new user parameters } var valid, continue: boolean; ch: char; temp: string[1]; begin repeat continue := TRUE; ch := select('Parameter', 'BellHelpNullsPasswordShiftlock'); case ch of 'B': noisy := not noisy; 'H': begin writeln(USR, 'Current help level: ', user_rec.help_level); temp := prompt('New level [0-3]: ', 1, 'AES') + ' '; writeln(USR); if temp in ['0'..'3'] then user_rec.help_level := strint(temp) else writeln(USR, 'Help level unchanged.') end; 'N': begin writeln(USR, 'Currently using ', user_rec.nulls, ' nulls.'); get_nulls end; 'P': begin get_old_password('Please enter current password', valid); if valid then get_new_password else writeln(USR, 'Password unchanged.') end; 'S': get_case; '?': begin list('C'); continue := FALSE end end until continue end;