Oberon || Library || Module Index || Search Engine || Definition || Module
TYPE StatusCommandList = POINTER TO StatusCommandListRec; TYPE StatusCommandListRec = RECORD (Objects.ObjectRec) END;
PROCEDURE CreateList(VAR list: StatusCommandList); PROCEDURE Add(list: StatusCommandList; command: ARRAY OF CHAR);
PROCEDURE Create(VAR sequence: RandomGenerators.Sequence; list: StatusCommandList);
Note that this module serves primarily as a fallback solution if random devices are not available, see SeedStreams. All useful seed generators like this one are expensive to use and ought to be stretched using unpredictable generators like SurfRandomGenerators.
CreateList and Add allow to create and extend a list of commands. These commands shall consist of a full pathname of a binary and a space-separated list of arguments. Meta characters of shells or the environment variable PATH are not considered as the commands are not passed to a shell for interpretation. It does not hurt to try different paths if the exact location is not known (see example). Note however that the standard error of these commands will be shared with the standard error channel of the own process. Hence, it should be avoided to give possibly invalid flags or commands that occasionally fail.
Create creates a sequence that is based upon the list of commands list. Note that the list must not be empty.
VAR seq: RandomGenerators.Sequence; VAR list: UnixStatusSeeds.StatusCommandList; (* ... *) UnixStatusSeeds.CreateList(list); UnixStatusSeeds.Add(list, "/bin/ps -ef"); UnixStatusSeeds.Add(list, "/usr/bin/ps -ef"); UnixStatusSeeds.Add(list, "/bin/date"); UnixStatusSeeds.Add(list, "/usr/bin/date"); UnixStatusSeeds.Add(list, "/bin/netstat -n"); UnixStatusSeeds.Add(list, "/usr/bin/netstat -n"); UnixStatusSeeds.Create(seq, list);
This example also shows how multiple paths for one command can be given if it is not clear where they are to be found.
Oberon || Library || Module Index || Search Engine || Definition || Module