EMS Manual
Example of Retrieving Event Messages
EMS Manual—426909-005
A-27
C Source File
 /* Note that the following code is order-dependent since 
 using FNAMEEXPAND to directly set the 'defaults' field 
 overwrites the front of 'infile' */
 strcpy((char *)TempDefaults, "$SYSTEM SYSTEM ");
 strcpy(ExternFile, (char *)getenv("DEFAULTS"));
 strcat(ExternFile, ".X");
 FNAMEEXPAND(ExternFile, ci_startup->defaults,
 TempDefaults);
 strcpy(ExternFile, (char *)getenv("STDIN"));
 FNAMEEXPAND(ExternFile, ci_startup->infile, TempDefaults);
 strcpy(ExternFile, (char *)getenv("STDOUT"));
 FNAMEEXPAND(ExternFile, ci_startup->outfile, TempDefaults);
 /* Don't forget to set the msgcode to -1 (startup msg) */
 ci_startup->msgcode = -1;
 /* Plant a NULL char at the beginning of the params */
 ci_startup->params[0] = 0;
 return(ci_startup);
}
#pragma PAGE "get_cpu_num()"
/* ---------- get_cpu_num -------------------
 * Prompts the user for a valid cpu number, which can be
 * passed as a parameter to the filter.
 */
void get_cpu_num(void)
{
 int errval;
 int got_it = FALSE;
 while ( !got_it ) {
 /* prompt the user for the cpu number to use */
 printf("\nCpu number?: ");
 errval = scanf("%d", &cpu_num);
 if (errval == EOF)
 STOP();
 if ( (errval != 0) && (cpu_num >= 0) )
 got_it = TRUE;
 }
}
#pragma PAGE "send_spi_cmd()"
/* ----------- send_spi_cmd -------------------
 * Puts the finishing touches on an SPI command that has 
 * been prepared by another procedure. Sends the command to 
 * the distributor and checks the command response.
 */
void send_spi_cmd(void)
{
 int ccval; /* for cc return from writeread */










