CODE EXAMPLE
#include <sys/types.h>
{
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 ==
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)