Comment ============================================================= SMITE.MNU Copyright 1993-95 by Marc Perkel Smites user connections. This is an example of how you can use MarxMenu to write a command line utility. ============================================================= EndComment ;#Define Shareware var ConnectionList Users Groups Names Display LongestName AllUsers Cons Setup if UpperCase(ParamStr(2)) = 'PICK' PickUsersToSmite else Loop 15 if ParamStr(LoopIndex + 1) > '' AddToList(ParamStr(LoopIndex + 1)) endif EndLoop endif RemoveDuplicates(Loc ConnectionList) if NumberOfElements Connectionlist = 0 Writeln 'No connections selected!' ExitSmite endif GatherNames LongestName = LongestString(Display) AddConnectionNumber SmiteUsers ExitSmite ;========================== PROCEDURES ========================== Procedure Help Writeln 'Computer Tyme Smite * Copyright 1993-95 by Marc Perkel' Writeln 'All Rights Reserved * Version 1.1 * Release Date: 05-09-95' Include 'ADDRESS.INC' Writeln 'This utility drops user connections from the network.' Writeln Writeln 'If you run SMITE PICK you will get a list of all connected users.' Writeln 'You can pick user names from a list to drop.' Writeln Writeln 'USAGE: SMITE Writeln Writeln 'Example:' Writeln ' SMITE ACCOUNTING LEGAL DICK JANE SALLY' Writeln ' SMITE PICK' Writeln ' SMITE #2 #5 #13' Writeln ' SMITE NOT-LOGGED-IN' Writeln Writeln 'Number of users smitten returned in DOS ErrorLevel' Writeln Writeln '$95 per Server. Written in MarxMenu. Comes free with the Network Survival Kit.' ExitSmite EndProc Procedure AddConnectionToList (C) AppendArray(ConnectionList,C) EndProc Procedure AddUserToList (User) var List NovGetConnections(List,User,1) Loop List AddConnectionToList(LoopVal) EndLoop EndProc Procedure AddGroupToList (Group) var Members NovGroupMembers(Group,Members) Loop Members AddUserToList(LoopVal) EndLoop EndProc Procedure AddToList (St) St = UpperCase St if left(St,1) = '#' delete(St,1,1) AddConnectionToList(Value(St)) elseif St = "NOT-LOGGED-IN" NovShowNotLoggedIn NovUsersLoggedIn(AllUsers) NovConLoggedIn(Cons) Loop AllUsers if LoopVal = "NOT-LOGGED-IN" AddConnectionToList(Cons[LoopIndex]) endif EndLoop elseif PosInList(St,Users) > 0 AddUserToList(St) elseif PosInList(St,Groups) > 0 AddGroupToList(St) else Writeln St ' is not a User or Group!' endif EndProc Procedure RemoveDuplicates (Orig) var List List = Orig Dispose Orig SortArray(List) Loop List if (LoopVal <> List[LoopIndex + 1]) and (LoopVal <> NovConnection) AppendArray(Orig,LoopVal) endif EndLoop EndProc Procedure GatherNames Loop ConnectionList Display[LoopIndex] = NovLoginName(LoopVal) EndLoop EndProc Procedure AddConnectionNumber Loop Display Length(LoopVal) = LongestName LoopVal = LoopVal + ' [' + Str(ConnectionList[LoopIndex]) + ']' EndLoop Names = Display EndProc Procedure SmiteUsers Loop ConnectionList Write 'Smiting Connection: ' Names[LoopIndex] ' ... ' NovClearConnection(LoopVal) Writeln EndLoop EndProc Procedure PickUsersToSmite var PickedUsers Wide Tall StandardIO Off NoBoxBorder BoxInsideColor Green Black UseArrows Off Explode Off DrawBox 1 1 ScreenWidth ScreenHeight Write 'Reading Connections ... ' Explode On NovShowNotLoggedIn NovUsersLoggedIn(AllUsers) NovConLoggedIn(Cons) LongestName = LongestString(AllUsers) Loop AllUsers Length(LoopVal) = LongestName LoopVal = LoopVal + ' [' + Str(Cons[LoopIndex]) + ']' EndLoop SortArray(AllUsers) BlockBox BoxInsideColor White Blue Wide = LongestString(AllUsers) + 6 Tall = Min(NumberOfElements(AllUsers),ScreenHeight - 4) + 2 BoxHeader ' Smite Keyboard Help ' DrawBox(ScreenWidth - Wide - 40,ScreenHeight / 2 - 1,25,5) Writeln ' ESC - Abort' Writeln ' Space - Mark/UnMark' Write ' Enter - When Done' DrawBox(ScreenWidth - Wide - 8,ScreenHeight - Tall / 2 + 1,Wide,Tall) PickMany(AllUsers,PickedUsers) EraseTopWindow EraseTopWindow EraseTopWindow StandardIO Loop PickedUsers delete(LoopVal,1,pos('[',LoopVal)) AppendArray(ConnectionList,Value(Left(LoopVal,pred(pos(']',LoopVal))))) EndLoop EndProc #If Shareware Procedure Beg BoxBorderColor Green Blue BoxInsideColor White Blue BoxHeaderColor Yellow Mag BoxHeader ' * Shameless Beg Screen * ' DrawBox 10 8 61 6 Writeln WriteCenter '* Smite Evaluation Copy *' Writeln WriteCenter 'Please remember to register this software.' Wait 600 EraseTopWindow ClearKbdBuffer EndProc #Endif Procedure Setup #If Shareware Beg #Endif StandardIO Writeln if NovBinderyAccess < 3 Writeln 'You must have Supervisor access to use this program!' ExitSmite; endif NovUsers(Users) NovGroups(Groups) if ParamStr(2) = '' then Help EndProc Procedure ExitSmite ExitCode = Min(255,NumberOfElements(ConnectionList)) ExitMenu EndProc