$! $! remote_user.com - Use the phone object to see if a remote user is logged in. $! $! usage: $! $ @remote_user node::[target] $! target - remote username or asterisk (default) for complete listing $! $! $ echo = "write sys$output" $ if p1 .eqs. "" then inquire/nopun p1 "_User (node::user or node::*): " $! $! Make sure a node was specified $! $ target_node = f$extract(0,f$locate("::",p1),p1) $ if target_node .eqs. p1 $ then $ echo "Invalid target - please specify as node::user or node::*" $ exit $ endif $! $! If nothing was specified after the node then append an asterisk $! $ if p1 - "''target_node'::" .eqs. "" then p1 = p1 + "*" $! $! Figure out who we are. $! $ sender = "''f$getsyi("NODENAME")'::''f$getjpi(0,"USERNAME")'" $! $! Initialize phone protocol bytes. $! $ com_msg_type[0,8] = 7 ! verify target user's existence $ dir_msg_type[0,8] = 15 ! get directory listing $ null_byte[0,8] = 0 ! terminator $! $! Request a logical link to the target node phone object. $! $ open/read/write/error=open_error link 'target_node'::"29=" $ on control_y then goto control_y $! $! If an asterisk was specified then loop through a directory listing. $! Otherwise, verify the target user's existence. $! $ if f$locate("*",p1) .ne. f$length(p1) $ then $ dir_loop: $ write/error=write_error link dir_msg_type,sender,null_byte $ read/end=read_error/error=read_error link reply $ if reply .eqs. "" $ then $ close link $ exit $ endif $ echo reply $ goto dir_loop $ else $ write/error=write_error link com_msg_type,sender,null_byte,p1 $ read/error=read_error link reply $ close link $ status = f$cvui(0,8,reply) $ if status .eq. 1 $ then $ echo "''p1' is logged in." $ else $ if status .eq. 2 then echo "Error parsing ''p1'" $ if status .eq. 3 then echo "Error communicating with slave" $ if status .eq. 4 then echo "Error parsing ''p1': $ if status .eq. 5 then echo "Slave does not have necessary privileges." $ if status .eq. 6 then echo "''p1' not logged in." $ if status .lt. 0 .or. status .gt 6 then echo "Unexpected Reply:",reply $ endif $ exit $ endif $! $! $! $ open_error: $ echo "''target_node'::""29="" not accessible. - ''f$message($status)'" $ exit $! $ control_y: $ close link $ exit $! $ write_error: $ echo Write error - ''f$message($status)'" $ close link $ exit $! $ read_error: $ echo "Read error - ''f$message($status)'" $ close link $ exit