Cover V05, I08
Article
Figure 1
Listing 1

aug96.tar


Listing 1: DISPATCHER.SH

# DISPATCHER.SH.  This program is called whenever
# one of the 24 Informix events are triggered.
# For the triggered event:
#   If execute flag is Y
#      If sub-program defined, execute it
#      else
#        execute the default program
#
# authors: Jon Alder, Ed Schaefer

echo ""|awk '
BEGIN {
default_prg="/usr/lbin/default.sh"
debug=0  # turn off debugging
imax=24
jmax=2
classid[1,1]="/usr/lbin/testsh.sh"
classid[1,2]="Y"
classid[2,1]=""
classid[2,2]="Y"
classid[3,1]=""
classid[3,2]="Y"
classid[4,1]=""
classid[4,2]="Y"
classid[5,1]=""
classid[5,2]="Y"
classid[6,1]=""
classid[6,2]="Y"
classid[7,1]=""
classid[7,2]="Y"
classid[8,1]=""
classid[8,2]="Y"
classid[9,1]=""
classid[9,2]="Y"
classid[10,1]=""
classid[10,2]="Y"
classid[11,1]=""
classid[11,2]="Y"
classid[12,1]=""
classid[12,2]="Y"
classid[13,1]=""
classid[13,2]="Y"
classid[14,1]=""
classid[14,2]="Y"
classid[15,1]=""
classid[15,2]="Y"
classid[16,1]=""
classid[16,2]="Y"
classid[17,1]=""
classid[17,2]="Y"
classid[18,1]=""
classid[18,2]="Y"
classid[19,1]=""
classid[19,2]="Y"
classid[20,1]=""
classid[20,2]="Y"
classid[21,1]=""
classid[21,2]="Y"
classid[22,1]=""
classid[22,2]="Y"
classid[23,1]="/usr/lbin/testsh.sh"
classid[23,2]="Y"
classid[24,1]=""
classid[24,2]="Y"
}
{
if(debug) # debugging only!
show_array()
else
if((classind, 1) in classid)
if(classid[classind, 2] == "Y")
{
if(classid[classind, 1] == "")
whatprg = default_prg # set the default program
else
whatprg = classid[classind, 1]

prg_exec = sprintf("%s \"%s\" \"%s\" \"%s\" \"%s\"
\"%s\"", \
whatprg, severity, classind, classmsg,
specmsg, seealso)
system(prg_exec)
}
}
function show_array() {
for(i=1;  i <= imax; i++)
{
for(j=1;  j <= jmax; j++)
if((i,j) in classid)
printf("%s ", classid[i,j])
printf("\n")
}
}
' severity="$1" classind="$2" classmsg="$3" specmsg="$4"
seealso="$5"

# End of File