Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Event Manager Programmer's Guide: HP-UX 11i v3 Edition 1 > Chapter 4 Sample EVM Programming Operations

Matching Event Names

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

The EVM naming policy enables you to extend an event name with any number of trailing components, yet still match its base name. This means that you cannot depend on an event with exactly the name you expect it to have, because it may have extra trailing components.

To compare an event's name against a known name, you must not use the usual string comparison functions because they incorrectly fail to match the name if components are added. Instead, you must use EVM's name-matching functions. These functions match an event name against the pattern you supply, ignoring any trailing components in the candidate name. They also enable you to include wildcard characters in your name pattern.

Example 4-9 introduces the following functions and describes EVM name-matching functions:

  • EvmEventNameMatch — Takes the following input arguments: an event name string (which may contain wildcard characters) and an event. Returns an indication of whether the event matches the name string.

  • EvmEventNameMatchStr — Takes an event name in a character string, rather than extracting it from an event.

    The following function uses EvmEventNameMatch API:

Example 4-9  Matching Event Names

#include <stdio.h>
#include <evm/evm.h>
/*===============================================* Function: main()*===============================================*/
int main()
{	EvmStatus_t status;	 
EvmEvent_t event;	 
EvmBoolean_t match;	
char buff[80];	
/* This section of code reads events from stdin and displays only those events that match the wildcard string *.msg. 
This match will work even though events of this type usually have the name sys.unix.evm.msg.user or	sys.unix.evm.msg.admin. */	
while (EvmERROR_NONE ==EvmEventRead(fileno(stdin),&event)) 
{	EvmEventNameMatch("*.msg",event,&match);		
if (match) 
{EvmEventFormat(buff,sizeof(buff),event);	fprintf(stdout,"%s\n",buff);		}	}}
Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2007 Hewlett-Packard Development Company, L.P.