Comment ============================================================= WHOGOWA.MNU Copyright 1995 by Marc Perkel List who got what files open. 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 FileCount ErrorSet Setup Loop 15 if ParamStr(LoopIndex + 1) > '' AddToList(ParamStr(LoopIndex + 1)) endif EndLoop RemoveDuplicates(Loc ConnectionList) if NumberOfElements Connectionlist = 0 Writeln 'No connections selected!' ExitWhoGoWa endif GatherNames LongestName = LongestString(Display) AddConnectionNumber DisplayFiles ExitWhoGoWa ;========================== PROCEDURES ========================== Procedure Help Writeln 'Computer Tyme WhoGoWa * Copyright 1995 by Marc Perkel' Writeln 'All Rights Reserved * Version 1.1 * Release Date: 10-12-95' Include 'ADDRESS.INC' Writeln 'This utility lists the files opened by connection number.' Writeln Writeln 'USAGE: WHOGOWA Writeln Writeln 'Example:' Writeln ' WHOGOWA ACCOUNTING LEGAL DICK JANE SALLY' Writeln ' WHOGOWA #2 #5 #13' Writeln ' WHOGOWA NOT-LOGGED-IN' Writeln Writeln 'Number of files open returned in DOS ErrorLevel' Writeln Writeln '$95 per Server. Written in MarxMenu. Comes free with the Network Survival Kit.' ExitWhoGoWa 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] 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 DisplayFiles var Files Loop ConnectionList Writeln 'Files in use by: ' Names[LoopIndex] NovConOpenFiles(Files,LoopVal) if NovResult <> 0 Writeln if NovResult = $C6 Writeln 'You do not have enough rights to run this program!' Writeln 'You need Console Operator Status.' else Writeln 'Error: ' NovResult ' while reading connections using file.' endif ErrorSet On ExitWhoGoWa endif if NumberOfElements Files > 0 Loop Files Writeln ' ' LoopVal FileCount = FileCount + 1 EndLoop else Writeln ' (none)' endif Writeln 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 '* WhoGoWa 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!' ExitWhoGoWa; endif NovUsers(Users) NovGroups(Groups) if ParamStr(2) = '' then Help EndProc Procedure ExitWhoGoWa ExitCode = Min(255,FileCount) if ErrorSet then ExitCode = 255 ExitMenu EndProc