74 Netra 440 Server System Administration Guide August 2004
{
int altype;
if (strcmp(alarm, "crit") == 0)
altype = ALARM_CRITICAL;
else
if (strcmp(alarm, "major") == 0)
altype = ALARM_MAJOR;
else
if (strcmp(alarm, "minor") == 0)
altype = ALARM_MINOR;
else
if (strcmp(alarm, "user") == 0)
altype = ALARM_USER;
else {
printf("invalid alarm value: %s\n", alarm);
altype = ALARM_INVALID;
}
return (altype);
}
static int
lom_ioctl(int ioc, char *buf)
{
int fd, ret;
fd = open(LOM_DEVICE, O_RDWR);
if (fd == -1) {
printf("Error opening device: %s\n", LOM_DEVICE);
exit (1);
}
ret = ioctl(fd, ioc, (void *)buf);
close (fd);
return (ret);
}
static char *
get_alarmval(int state)
{
if (state == ALARM_OFF)
CODE EXAMPLE B-1 Example Program for get/set Status of the Alarms (Continued)
#include <sys/types.h>