home *** CD-ROM | disk | FTP | other *** search
- uses
- eco_lib, eco_novl,
- crt, dos
-
- ;
-
-
- var
- count,
- total,
- station,
- conntype,
- retcode,
- x,
- write_it,
- pservers,
- not_logged_in : integer;
- username,
- hex_id,
- datetime,
- server,
- node,
- network,
- socket,
- filler,
- search : string;
-
-
-
- procedure header;
- begin
- filler := ' ';
- getservername(server,retcode);
- getnode(node,retcode);
- getstation(station,retcode);
- getconnectioninfo(station,username,hex_id,conntype,datetime,retcode);
- if search = '' then
- writeln('List of currently logged on users for server ',server) else
- writeln('List for user ',__up(search),' on ',server,'.');
- writeln;
- end;
-
-
-
- procedure display_all_users;
- begin
- total := 0; not_logged_in := 0; x := 0; pservers := 0; getserverinfo;
- for count := 1 to serverinfo.connections_max do begin
- get_internet_address(count,network,node,socket,retcode);
- if retcode=0 then begin
- getuser(count,username,retcode);
- if username <> '' then begin
- total := total + 1;
- write_it := 0;
- if search = '' then write_it := 1;
- if ((search <> '') and ( pos(__up(search),__up(username))>0) ) then write_it := 1;
- getconnectioninfo(count,username,hex_id,conntype,datetime,retcode);
- if write_it = 1 then inc(x);
- if write_it = 1 then if count=station then write('*') else write(' ');
- {is the connection an USER or an utility connection}
- if conntype <> 1 then begin
- username := '<'+username+'>'; inc(pservers)
- end;
- if write_it = 1 then write(
- copy(__num(count)+filler,1,3), ' ',
- copy(username+filler,1,15), ' ', datetime
- );
- if write_it = 1 then if x=1 then write(' | ');
- if x=2 then begin; x:= 0; writeln end;
- end else not_logged_in := not_logged_in + 1;
- end; {end of connection in use}
- end;
- end;
-
-
-
- procedure footer;
- begin
- writeln;
- if x=1 then writeln;
- write(total,' user');
- if total=1 then write(' is ') else write('s are ');
- writeln('logged into ',server,' as of ', __curdate);
- if not_logged_in > 0 then begin
- write(not_logged_in,' other connection');
- if not_logged_in = 1 then write(' is ') else write('s are ');
- writeln('in use, but the workstation has logged out.');
- end;
- if pservers > 0 then writeln(
- pservers, ' of the ', total, ' users were logged-in on ',
- server, ' as print servers.'
- );
- end;
-
-
-
- procedure credits;
- begin
- writeln;
- writeln('WHO: Displays a list of currently logged in users.');
- writeln;
- writeln('Example: C> WHO Display everyone');
- writeln(' C> WHO username Display a particular user.');
- writeln(' C> WHO server/ Display a different server.');
- writeln;
- halt;
- end;
-
-
-
- procedure change_server; { change default server to something else }
- var
- x, y, z : integer;
- new_server,
- servername : string;
-
- begin
- z := 0; x := pos('/',search); new_server := __nw(__up(copy(search,1,x-1)));
- search := __up(__nw(copy(search,x+1,255)));
- for y := 1 to 8 do begin
- get_file_server_name(y, servername);
- writeln(y,':',servername);
- if servername = new_server then begin
- z := 1;
- set_preferred_connection_id(y);
- end;
- end;
- if z=0 then begin
- writeln('Server ',new_server,' not found.');
- halt;
- end;
- end;
-
-
-
- begin
- if paramcount > 0 then search := paramstr(1) else search := '';
- if search = '?' then credits;
- if pos('/', search) > 1 then change_server;
- header;
- display_all_users;
- footer;
- end.
-