The following code example demonstrates how you can log on and off and use cmc_query_configuration to get system information.
/* Local variables used */
CMC_return_code Status;
CMC_boolean UI_available; /* True if an interface is allowed */
CMC_session_id Session;
/* Find out if user interface (UI) is available with this
implementation before starting.*/
Status = cmc_query_configuration(
0, /* No session handle */
CMC_CONFIG_UI_AVAIL, /* See if UI is available. */
(void *)&UI_available, /* Return value */
NULL); /* No extensions */
/* Error handling */
/* Log onto system using UI. */
Status = cmc_logon(
NULL, /* Default service */
NULL, /* Prompt for user name */
NULL, /* Prompt for password */
NULL, /* Default character set */
0, /* Default UI ID */
CMC_VERSION, /* Version 1 CMC calls */
CMC_LOGON_UI_ALLOWED | /* Full logon UI */
CMC_ERROR_UI_ALLOWED, /* Use UI to display errors. */
&Session, /* Returned session ID */
NULL); /* No extensions */
/* Error handling */
/* Do various CMC calls. */
/* Log off from the implementation. */
Status = cmc_logoff(
Session, /* Session ID */
0, /* No UI will be used. */
0, /* No flags */
NULL); /* No extensions */
/* Error handling */