/****^ *********************************************************** * * * Copyright, (C) Honeywell Bull Inc., 1987 * * * * Copyright, (C) Honeywell Information Systems Inc., 1982 * * * * Copyright (c) 1972 by Massachusetts Institute of * * Technology and Honeywell Information Systems, Inc. * * * *********************************************************** */ /* format: style4 */ tty_lines: tln: procedure; /* This command prints certain information from the answer_table about each channel that is attached to Multics. It has one optional argument, used to elicit subsets of the information. Normal printed data consists of tty channel name, type of device to last dialup the channel, dialup count, channel state (1 = hungup, 2 = listening, 5 = dialedup), location in dialup (see SPS), activity value (1 = hungup, 2 = listening, 3 = dialed-up, 4 = user is logged-in, 5 = user has process), and user and project names and device ID if activity is 4 or 5 (also for 2 or 3 if information is available). This option to the command is either a channel name or a selector of the form xxyyyy. Values of xx and yyyy are as follows: V__a_l_u_e _o_f "_x_x" M__e_a_n_i_n_g _o_f "_y_y_y_y" id Teletype ID code (value printed in ID column) ct Channels with "experiment-count" >_ yyyy Since channel last initialized (value printed in ID column) dl Channels with "dialup-count" >_ yyyy since answer_table last truncated (value printed in ID column) st Channels in state yyyy (possible values 1, 2 or 5) wp Channels at "wait-point" yyyy (1-21) ac Channels with "activity" yyyy (0-7) sl Information for "slot" yyyy (1-999) (0 or blank means entire table) c= Channels for which "experiment-count" equals _y_y_y_y (value printed in ID column) d= Channels for which "dialup count" equals _y_y_y_y (value printed in ID column) Note that a null part of the option is equivalent to a value of 0 in the selection mechanism (except for the "ID" option, where _y_y_y_y is alpha-numeric). Alternatively, a pair of arguments, -type , can be specified to get information for those lines most recently accessed by a terminal of the specified type. Modified by Robert Coren, June 1977, to add -type argument. Modified 1980 December by Art Beattie to obtain process ident information from daemon and absentee user tables. Also improved display with header by determining longest terminal type name and adjusting column placement accordingly. Modified December 1981, E. N. Kittlitz, for user_table_entry conversion. Modified June 1982, E. N. Kittlitz, for user_attributes.incl.pl1. */ /****^ HISTORY COMMENTS: 1) change(87-04-26,GDixon), approve(87-07-08,MCR7741), audit(87-07-15,Hartogs), install(87-08-04,MR12.1-1055): Upgraded for change to answer_table.incl.pl1 and user_table_entry.incl.pl1 END HISTORY COMMENTS */ %page; dcl cu_$arg_ptr entry (fixed bin, ptr, fixed bin, fixed bin (35)), cu_$arg_count entry (fixed bin), hcs_$terminate_noname entry (ptr, fixed bin (35)), hcs_$initiate entry (char (*) aligned, char (*) aligned, char (*) aligned, fixed bin, fixed bin, ptr, fixed bin (35)), cv_dec_ entry (char (*) aligned, fixed bin), date_time_ entry (fixed bin (71), char (*) aligned), clock_ returns (fixed bin (71)), (ioa_, ioa_$nnl, com_err_) entry options (variable); dcl (addr, char, hbound, length, low, max, min, null, ptr, rel, rtrim, substr) builtin; dcl keyp ptr, (fmtmax, fmtmin, t_active, isearch, islot, lasti, ndial, i, table_idx) fixed bin, code fixed bin (35); dcl argp ptr, argln fixed bin (17), arg char (argln) based (argp) unaligned; dcl (c2 char (2), c4 char (4), type_str char (32), test_type char (32), time_str char (16)) aligned; dcl test_name char (32); dcl hdrflag bit (1) init ("1"b), j fixed bin, count fixed bin; dcl (max_name_len, max_type_len) fixed bin; dcl NL char (1) init (" "); dcl collapse (11) fixed bin (17) static init (0, 1, 2, 2, 2, 3, 3, 3, 0, 2, 2); dcl keys char (22) static aligned init (" idslctdlacwpst c=d="); dcl scd char (48) aligned static init (">system_control_1"); dcl 1 key aligned based (keyp), 2 k2 (14) char (2) unaligned; dcl answer_table_ptrs (3) pointer; %page; call hcs_$initiate (scd, "cdt", "", 0, 1, cdtp, code); if cdtp = null then do; call com_err_ (code, "tty_lines", "cdt"); return; end; call hcs_$initiate (scd, "answer_table", "", 0, 1, answer_table_ptrs (1), code); if answer_table_ptrs (1) = null then do; call com_err_ (code, "tty_lines", "answer_table"); return; end; call hcs_$initiate (scd, "absentee_user_table", "", 0, 1, answer_table_ptrs (2), code); if answer_table_ptrs (2) = null then call com_err_ (code, "tty_lines", "^/Cannot get pointer to absentee_user_table; continuing."); call hcs_$initiate (scd, "daemon_user_table", "", 0, 1, answer_table_ptrs (3), code); if answer_table_ptrs (3) = null then call com_err_ (code, "tty_lines", "^/Cannot get pointer to daemon_user_table; continuing."); isearch = 0; /* Initialize default */ fmtmax = 4; fmtmin = 0; call cu_$arg_count (count); do j = 1 to count; call cu_$arg_ptr (j, argp, argln, code); if arg = "-lines" then ; else if arg = "-type" then do; /* terminal type specified */ j = j + 1; /* get following argument */ call cu_$arg_ptr (j, argp, argln, code); if code ^= 0 then do; call com_err_ (code, "tty_lines"); return; end; test_type = arg; isearch = 9; end; else do; hdrflag = "0"b; keyp = addr (keys); /* get ptr to argument key values */ c2 = char (arg, 2); /* pick off key */ c4 = substr (arg, 3); /* and get key argument */ do i = 1 to hbound (collapse, 1); if c2 = k2 (i) then do; /* look for key match */ isearch = i; go to setup (collapse (i)); setup (1): /* here for key "id" */ fmtmin = 3; go to end_setup; setup (2): /* here for keys "sl","ct", "dl", "c=", and "d=" */ fmtmax = 2; setup (3): /* here for keys "ac", "wp", and "st" */ call cv_dec_ (c4, islot); go to end_setup; end; else do; isearch = 1; /* not recognized, assume it's a channel name */ test_name = arg; end; end; end; setup (0): /* here for key "tt" */ end_setup: end; call date_time_ ((clock_ ()), time_str); if hdrflag then do; max_name_len, max_type_len = 0; do i = 1 to cdt.current_size; cdtep = addr (cdt.cdt_entry (i)); if cdte.in_use ^= 0 then do; max_name_len = max (max_name_len, length (rtrim (cdte.name))); max_type_len = max (max_type_len, length (rtrim (cdte.current_terminal_type))); end; end; call ioa_ ("^/Attached lines = ^d (size = ^d) at ^16a^2/Name^vxType^vxNo. S WP A Baud User^/", cdt.n_cdtes, cdt.current_size, time_str, max_name_len - 3, max_type_len - 2); end; lasti = 1; do i = 1 to cdt.current_size; cdtep = addr (cdt.cdt_entry (i)); if cdte.in_use <= 0 then go to end_i; ndial = cdte.n_dialups; if ndial ^= 0 & cdte.current_terminal_type ^= low (32) then type_str = cdte.current_terminal_type; else type_str = "(NU)"; t_active = cdte.in_use; go to request (isearch); /* dispatch on key type */ request (1): if cdte.name = test_name then go to print_it; go to end_i; request (2): /* id */ if c4 = cdte.tty_id_code then go to print_it; go to end_i; request (3): /* sl */ if islot = 0 then go to print_it; /* if slot = 0, print all entries */ if i = islot then go to print_it; go to end_i; request (4): /* ct */ ndial = cdte.count; request (5): /* dl */ if ndial >= islot then go to print_it; go to end_i; request (6): /* ac */ if t_active = islot then go to print_it; go to end_i; request (7): /* wp */ if cdte.tra_vec = islot then go to print_it; go to end_i; request (8): /* st */ if cdte.state = islot then go to print_it; go to end_i; request (9): /* ty */ if type_str = test_type then go to print_it; go to end_i; request (10): /* c= */ ndial = cdte.count; request (11): /* d= */ if ndial = islot then go to print_it; go to end_i; request (0): /* if printing everything */ if t_active = 0 /* if slot not active */ then go to end_i; print_it: if i ^= lasti then call ioa_$nnl ("(^d)^/", i - lasti); if ^hdrflag then do; max_name_len = length (rtrim (cdte.name)); max_type_len = length (rtrim (type_str)); end; go to print_hlr (max (min (t_active, fmtmax), fmtmin)); /* select proper printing format */ print_hlr (2): print_hlr (3): if cdte.dialed_to_procid = "0"b then go to print_hlr (1); do table_idx = 1 to hbound (answer_table_ptrs, 1); if answer_table_ptrs (table_idx) ^= null then do; utep = ptr (answer_table_ptrs (table_idx), rel (cdte.process)); if ute.proc_id = cdte.dialed_to_procid then do; if table_idx = 1 /* this is the answer_table */ then call ioa_ ("^va ^va ^4d ^1d ^2d ^1d ^4d ^a ^a (^a) ^a", max_name_len, cdte.name, max_type_len, type_str, ndial, cdte.state, cdte.tra_vec, t_active, cdte.baud_rate, ute.person, ute.project, ute.tty_id_code, cdte.comment); else call ioa_ ("^va ^va ^4d ^1d ^2d ^1d ^4d ^a ^a (^a) ^a", max_name_len, cdte.name, max_type_len, type_str, ndial, cdte.state, cdte.tra_vec, t_active, cdte.baud_rate, ute.person, ute.project, ute.tty_name, cdte.comment); go to upd_last; end; end; end; /* couldn't find anything in any of the */ /* tables to display */ go to print_hlr (1); print_hlr (4): utep = ptr (answer_table_ptrs (1), rel (cdte.process)); /* Get user table entry */ call ioa_ ("^va ^va ^4d ^1d ^2d ^1d ^4d ^a ^a (^a) ^a", max_name_len, cdte.name, max_type_len, type_str, ndial, cdte.state, cdte.tra_vec, t_active, cdte.baud_rate, ute.person, ute.project, cdte.tty_id_code, cdte.comment); go to upd_last; print_hlr (0): print_hlr (1): /* just display what's in CDT */ call ioa_ ("^va ^va ^4d ^1d ^2d ^1d ^4d ^a", max_name_len, cdte.name, max_type_len, type_str, ndial, cdte.state, cdte.tra_vec, t_active, cdte.baud_rate, cdte.comment); upd_last: lasti = i + 1; end_i: end; if i = lasti then call ioa_ (""); else call ioa_ ("(^d)^/", i - lasti); do i = 1 to hbound (answer_table_ptrs, 1); if answer_table_ptrs (i) ^= null then call hcs_$terminate_noname (answer_table_ptrs (i), code); end; call hcs_$terminate_noname (cdtp, code); return; %skip (4); tln_test: entry (test_dir); dcl test_dir char (*) unaligned; scd = test_dir; %page; %include answer_table; %page; %include author_dcl; %page; %include cdt; %page; %include ttyp; %page; %include user_attributes; %page; %include user_table_entry; %page; %include user_table_header; end tty_lines; */ ----------------------------------------------------------- Historical Background This edition of the Multics software materials and documentation is provided and donated to Massachusetts Institute of Technology by Group Bull including Bull HN Information Systems Inc. as a contribution to computer science knowledge. This donation is made also to give evidence of the common contributions of Massachusetts Institute of Technology, Bell Laboratories, General Electric, Honeywell Information Systems Inc., Honeywell Bull Inc., Groupe Bull and Bull HN Information Systems Inc. to the development of this operating system. Multics development was initiated by Massachusetts Institute of Technology Project MAC (1963-1970), renamed the MIT Laboratory for Computer Science and Artificial Intelligence in the mid 1970s, under the leadership of Professor Fernando Jose Corbato. Users consider that Multics provided the best software architecture for managing computer hardware properly and for executing programs. Many subsequent operating systems incorporated Multics principles. Multics was distributed in 1975 to 2000 by Group Bull in Europe , and in the U.S. by Bull HN Information Systems Inc., as successor in interest by change in name only to Honeywell Bull Inc. and Honeywell Information Systems Inc. . ----------------------------------------------------------- Permission to use, copy, modify, and distribute these programs and their documentation for any purpose and without fee is hereby granted,provided that the below copyright notice and historical background appear in all copies and that both the copyright notice and historical background and this permission notice appear in supporting documentation, and that the names of MIT, HIS, Bull or Bull HN not be used in advertising or publicity pertaining to distribution of the programs without specific prior written permission. Copyright 1972 by Massachusetts Institute of Technology and Honeywell Information Systems Inc. Copyright 2006 by Bull HN Information Systems Inc. Copyright 2006 by Bull SAS All Rights Reserved */