home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
PASCAL
/
NWTP04
/
XSERV
/
CLRCONN.PAS
next >
Wrap
Pascal/Delphi Source File
|
1993-12-29
|
1KB
|
53 lines
{$X+,V-,B-}
Program ClrConn;
{ Example for the nwServ unit / NwTP 0.4 API. (c) 1994, R.Spronk }
{ utility for users with console privileges:
Terminate a connection on the current server. }
Uses nwMisc,nwServ;
Var errCode:Integer;
connNbr:byte;
connStr:String;
showHelp:boolean;
begin
IF NOT CheckConsolePrivileges
then begin
IF nwServ.result=$C6
then writeln('You need console privileges to run this util.')
else writeln('Error checking console privileges, err#',nwServ.result);
halt(1);
end;
IF ParamCount=1
then begin
connStr:=ParamStr(1);
Val(connStr,connNbr,errCode);
showhelp:=(errCode<>0);
end
else showHelp:=true;
IF showHelp
then begin
writeln('CLRCONN-- usage:');
writeln;
writeln('CLRCONN connection_number');
writeln;
writeln('the connection_number must be supplied.');
writeln('it should contain numbers only (range 1..255)');
halt(1);
end;
IF ClearConnectionNumber(connNbr)
then writeln('Connection ',connNbr,' was terminated.')
else if nwServ.result=253
then writeln('Connection NOT cleared. The supplied ConnectionNumber was too high.')
else if nwServ.result=162
then writeln('You cleared your own connection!')
else writeln('Connection NOT cleared. Error# ',nwServ.result);
end.