|
|
CC ... -lsysadm -lvtcl -ltclx -ltcl -lsocket -lgen -lm#include <scoadmin/basicIncl.h> #include <scoadmin/callBack.h> #include <scoadmin/statusLst.h> #include <scoadmin/CAPI.h>
bool_t FWExamineNextObject(bmipSubmission_cl *bmipSubmissionPtr, errStatus_cl *errStatusPtr);
bool_t FWExamineNextObjectGet(bmipSubmission_cl *bmipSubmissionPtr, attributeList_pt *attributeListPtr, errStatus_cl *errStatusPtr);
bool_t FWExamineNextObjectAction(bmipSubmission_cl *bmipSubmissionPtr, actionInfo_pt *actionInfoPtr, errStatus_cl *errStatusPtr);
FWExamineNextObject() simply checks if an additional response is present.
FWExamineNextObjectGet() will assign the parameter attributeListPtr to point to the next response's Tcl keyed list of attribute-value pairs.
FWExamineNextObjectAction() will assign the parameter actionInfoPtr to point to the next response's "action" information.
/* Obtain the information about all CD-ROM devices on the system */#include <scoadmin/basicIncl.h> #include <scoadmin/callBack.h> #include <scoadmin/statusLst.h> #include <scoadmin/CAPI.h>
main() { frameWorkCClientData_cl *clientDataPtr; bmipSubmission_cl *bmipSubmissionPtr;
/* Set scoping and filtering parameters for later use. */ scopeParameter_pt scope ="1"; filterParameter_pt filter="type eq cdrom";
/* * Since we are looking at all of the devices, there is no specific * instance. */ objectInstance_pt instance="NULL";
/* Specifically look at the desc and mountpt attributes. */ char **attributes={"desc", "mountpt", "\0"};
/* Initialize the SCOadmin error stack. */ errStatus_cl *errStatusPtr=ErrorNew();
/* Variable used for the return value of ObjectGet(). */ attributeList_pt *attributeList;
/* Initialize general SCOadmin data structure. */ clientDataPtr=FWInitializeFrameWork();
/* Initialize class-specific SCOadmin data structures. */
/* Initialize communications to the "sco devices" class. */ bmipSubmissionPtr=FWInitObjectSubmission(clientDataPtr, "sco devices");
/* Identify this as a scoped request */ FWSetScope(bmipSubmissionPtr, scope);
/* Filter against the "type" attribute. Search only for type "cdrom". */ FWSetFilter(bmipSubmissionPtr, filter);
/* Actually get information from the object classes. */ attributeList=ObjectGet(bmipSubmissionPtr,instance,attributes,errStatusPtr); if( ! ErrorIsOk(errStatusPtr) ) { ErrorOutput(errStatusPtr, stderr, 0, argv[0]); exit(1); }
/* Output TCL keyedlist of attribute-values for each device */ while( FWExamineNextObjectGet( bmipSubmissionPtr, attributeList, errStatusPtr) == TRUE ) { if( ! ErrorIsOk(errStatusPtr) ) { puts(attributeList); } else { ErrorOutput(errStatusPtr, stderr, 0, argv[0]); } }
/* Unset filter parameters. */ FWUnSetScope(bmipSubmissionPtr); FWUnSetFilter(bmipSubmissionPtr);
/* Cleanup */ FWShutdownObjectSubmission(bmipSubmissionPtr); FWShutdownFrameWork(clientDataPtr); }