Chapter Contents |
Previous |
Next |
wmifilte, wmifiltn |
Portability: | SAS/C |
SYNOPSIS | |
DESCRIPTION | |
IMPLEMENTATION | |
EXAMPLE | |
RELATED FUNCTIONS | |
SEE ALSO |
SYNOPSIS |
#include <wmi.h> enum wmi_outcome wmifilte(int msgnum, int errnoval, struct wmi_msg_info *info, void *arg); enum wni_outcome wmifiltn(int msgnum, int errnoval, struct wmi_msg_info *info, void *arg);
DESCRIPTION |
wmifilte
and wmifiltn
are two message exit routines supplied by the library
to allow selective suppression of library messages by errno
value or by message number. These functions are not intended
to be called directly by the application program. Rather, they are intended
to be defined (with the wmi_set
function) as
message exits with an argument specifying the messages to be suppressed.
A typical use of msgfiltn
or msgfilte
in this way might look like the following:
int errorlist[] = { /* list of error or message numbers */ }; wmi_token filter; filter = wmi_set(&wmifiltn, (void *) &errorlist); /* perform processing */ wmi_del(filter);
The second argument passed to wmi_set
for these functions should point to an array of integers,
terminated by a zero entry. For wmifilte
,
the list contains one or more errno
values.
For wmifiltn
, it should contain one or more
message numbers.
IMPLEMENTATION |
These functions are very simple applications of the SAS/C message exit facility. Their source code is as follows:
enum wmi_outcome wmifilte(int msgnum, int errnoval, struct wmi_msg_info *info, void *arg) { int *list; list = (int *) arg; while(*list) if (*list++ == errnoval) return WMI_SUPPRESS; return WMI_PASS; } enum wmi_outcome wmifiltn(int msgnum, int errnoval, struct wmi_msg_info *info, void *arg) { int *list; list = (int *) arg; while(*list) if (*list++ == msgnum) return WMI_SUPPRESS; return WMI_PASS; }
EXAMPLE |
The following code calls the fopen
function, suppressing any message for the errno
ENFOUND
.
#include <wmi.h> #include <stdio.h> #include <errno.h> char *filename; int ENFOUND_list[] = { ENFOUND, 0 }; wmi_token filt_token; filt_token = wmi_set(&wmifilte, &ENFOUND_list); fopen(filename, "r"); wmi_del(filt_token);
The following is similar code that is specific to OS/390, and which deletes messages indicating file not found by message number.
#include <wmi.h> #include <stdio.h> char *filename; int not_found_list[] = { 500, 503, 504, 509, 544, 557, 878, 0 }; wmi_token filt_token; filt_token = wmi_set(&wmifiltn, &_found_list); fopen(filename, "r"); wmi_del(filt_token);
RELATED FUNCTIONS |
wmi_set
, wmi_del
SEE ALSO |
"Diagnostic Control Functions" in Chapter 2, "Function Categories."
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2004 by SAS Institute Inc., Cary, NC, USA. All rights reserved.