KCMS Application Developer's Guide

Example


Example 4-1 KcsConnectProfiles()

KcsProfileDesc				scannerDesc, monitorDesc, completeDesc;
 KcsProfileId				scannerProfile, monitorProfile;
 KcsProfileId				profileSequence[2], completeProfile;
 KcsStatusId				status;
 KcsErrDesc 				errDesc;
 u_long				failedProfileNum;
 KcsOperationType=(KcsOpForward+KcsContImage);
 /*file names input a program arguments */

 scannerDesc.type = KcsSolarisProfile;
 scannerDesc.desc.solarisFile.fileName = argv[1];
 scannerDesc.desc.solarisFile.hostName = NULL;
 scannerDesc.desc.solarisFile.oflag = O_RDONLY;
 scannerDesc.desc.solarisFile.mode = 0;
 
 monitorDesc.type = KcsSolarisProfile;
 monitorDesc.desc.solarisFile.fileName = argv[2];
 monitorDesc.desc.solarisFile.hostName = NULL;
 monitorDesc.desc.solarisFile.oflag = O_RDONLY;
 monitorDesc.desc.solarisFile.mode = 0;

 status = KcsLoadProfile(&scannerProfile, &scannerDesc, KcsLoadAllNow);

 if(status != KCS_SUCCESS) {
 	KcsGetLastError(&errDesc);
 	printf("Scanner LoadProfile error: %s\n", errDesc.desc);
 	exit(1);
 }

 status = KcsLoadProfile(&monitorProfile, &monitorDesc, KcsLoadAllNow);

 if(status != KCS_SUCCESS) {
 	KcsGetLastError(&errDesc);
 	printf("Monitor LoadProfile error: %s\n", errDesc.desc);
 	exit(1);
 }

 /* See if we can combine them */
 profileSequence[0] = scannerProfile;
 profileSequence[1] = monitorProfile;

 status = KcsConnectProfiles(&completeProfile, 2, profileSequence, op,
 		&failedProfileNum);

 if(status != KCS_SUCCESS) {
 	KcsGetLastError(&errDesc);
 	printf("ConnectProfile error: %s\n", errDesc.desc);
 	fprintf(stderr, "Failed in profile number %d\n", failedProfileNum);
 	exit(1);
 }