EMS Manual
Example of Retrieving Event Messages
EMS Manual—426909-005
A-32
C Source File
 zems_val_ssid.z_version = ZEMS_VAL_VERSION;
 cptr = strncpy(myssid.u_z_filler.z_filler, MYAP_VAL_OWNER, 8);
 myssid.z_number = MYAP_SSN_MYAP;
 myssid.z_version = MYAP_VAL_VERSION;
 /* malloc some memory for spi buffers */
 spi_buf = (EMSBUFDEF *) malloc( sizeof(EMSBUFDEF) );
 if (spi_buf == NULL)
 DEBUG();
 sav_buf = (EMSBUFDEF *) malloc( sizeof(EMSBUFDEF) );
 if (sav_buf == NULL)
 DEBUG();
 err_buf = (SPIERRDEF *) malloc( sizeof(SPIERRDEF) );
 if (err_buf == NULL)
 DEBUG();
 /* Not necessary to open home term in C. */
 /* Not necessary to read startup message from C. Stored in 
 env ptrs */
 /* Initialize startup struct areas that will contain 
 volume */
 /* and subvol names to spaces for passing to new process */
 startup = init_startup();
 /* Create a name for the distributor process */
 ccval = CREATEPROCESSNAME( (int *)distr_proc_name );
 if (ccval != CCE) {
 printf("\n Unable to Create process name.\n");
 DEBUG();
 }
 NEWPROCESS( (int *)distr_prog_file, , , , ,(int *)&error,
 (int *)distr_proc_name);
 if ( (error > 8) != 0 ) {
 printf(" Newprocess returned %xh\n",error);
 DEBUG();
 }
 /* Open the newprocess to pass the startup message */
 ccval = OPEN( (int *)distr_proc_name, (int *)&distr );
 if (ccval != CCE) {
 printf(" Open returned non-zero ccval: %d.\n",ccval);
 DEBUG();
 }
 /* Add "TYPE CONSUMER" to startup msg to send to 
 EMSDIST. */
 strcat(startup->params, "TYPE CONSUMER");
 /* Now write the startup struct */
 ccval = WRITE( distr, (int *)startup, sizeof(CISTART) );
 FILEINFO(distr, (int *)&error);










