ViewPoint Manual

Sample Custom Status Server
ViewPoint Manual426801-001
D-7
Custom Server Code
Length := FNAMEEXPAND ( Item^Name.Z^Object^Name, Processname, Temp^Fname );
IF Length < 2 OR Length > 14 THEN
RETURN ( Zerr^Stat^No^Such^Object );
Temp^Fname ':=' " " & Temp^Fname FOR 7;
IF Processname[4] <> Temp^Fname FOR 8 THEN
RETURN ( Zerr^Stat^No^Such^Object );
RETURN ( Z^All^Ok^Code );
END; ! Check^Process^Exist
?PAGE "CHECK^VALID^FILE^NAME"
INT PROC Check^Valid^File^Name ( Request, Reply );
INT .EXT Request ( Zvpt^Check^Item^Request^Def ); ! Input
INT .EXT Reply; ! Output
BEGIN
-------------------------------------------------------------------------------
--
-- Procedure checks that the configured File name is Valid.
-- Right now, the file has to exist to pass the check, if this is a limitation
-- then you can change this code to verify only the file name format.
--
-------------------------------------------------------------------------------
STRUCT .Item^Name ( Zvpt^Item^Name^Def );
INT Internal^File^Name [ 0:Fname^Wsz - 1 ];
INT Temp^Fname [ 0:Fname^Wsz - 1 ];
INT Length; ! Length of external name.
INT File^Error;
Return^Error := 0;
Return^Error^Detail :=0;
Item^Name ':=' Request.Z^Status^Item.Z^Item^Name
FOR Len^Wsz ( Item^Name ) WORDS;
CALL PROGRAMFILENAME ( Temp^Fname );
Length := FNAMEEXPAND ( Item^Name.Z^Object^Name, Internal^File^Name,
Temp^Fname );
IF Length = 0 THEN RETURN ( Zerr^Stat^No^Such^Object );
CALL FILEINFO ( ,File^Error, Internal^File^Name );
IF <> THEN
BEGIN
Return^Error^Detail := File^Error;
RETURN ( Zerr^Stat^No^Such^Object );
END;
RETURN ( Z^All^Ok^Code );
END; ! Check^Valid^File^Name
?PAGE "CHECK^VALID^DISK^NAME"
INT PROC Check^Valid^Disk^Name ( Request, Reply );
INT .EXT Request ( Zvpt^Check^Item^Request^Def ); ! Input
INT .EXT Reply; ! Output
BEGIN
-------------------------------------------------------------------------------
--
-- Procedure checks that the Disk Name is valid and existing on this system.
--
-------------------------------------------------------------------------------
STRUCT .Item^Name ( Zvpt^Item^Name^Def );
INT .Disk^Name [ 0:Fname^Wsz - 1 ];
INT DevType;
INT DevRecSize;
Return^Error := 0;
Return^Error^Detail :=0;
Item^Name ':=' Request.Z^Status^Item.Z^Item^Name
FOR Len^Wsz ( Item^Name ) WORDS;
Disk^Name ':=' " " & Disk^Name FOR 11 WORDS;
Disk^Name ':=' Item^Name.Z^Object^Name FOR 12 WORDS;
CALL DEVICEINFO ( Disk^Name, DevType, DevRecSize );
IF DevType.<4:9> <> 3 THEN RETURN ( Zerr^Stat^No^Such^Object )
ELSE RETURN ( Z^All^Ok^Code );
END; ! Check^Valid^Disk^Name
?PAGE "SAMPLE^PROCESS^BUSY"
INT PROC Sample^Process^Busy ( Request, Reply );
INT .EXT Request ( Zvpt^Sample^Item^Request^Def ); ! Input
INT .EXT Reply ( Zvpt^Sample^Item^Reply^Def ); ! Output
BEGIN
-------------------------------------------------------------------------------
--
-- Computes cpu-busy-time for this process or process pair using the
-- PROCESSINFO call.