CODE EXAMPLE B-1Example Program for get/set Status of the Alarms (Continued)

#include <sys/types.h>

get_alarmvals();

exit(1);

}

if (strcmp(argv[1], "get") == 0) { if (argc != 3) {

usage(); exit (1);

}

get_alarm(argv[2]);

}

else

if (strcmp(argv[1], "set") == 0) { if (argc != 4) {

usage(); exit (1);

}

set_alarm(argv[2], argv[3]);

} else {

usage(); exit (1);

}

}

static void usage()

{

printf("usage: alarm [getset] [critmajorminoruser] [onoff]\n");

}

static void

get_alarm(const char *alarm)

{

ts_aldata_t ald;

int altype = parse_alarm(alarm); char *val;

if (altype == ALARM_INVALID) { usage();

exit (1);

}

ald.alarm_no = altype; ald.alarm_state = ALARM_OFF;

lom_ioctl(LOMIOCALSTATE, (char *)&ald);

72 Netra 440 Server System Administration Guide • August 2004

Page 86
Image 86
Sun Microsystems manual Netra 440 Server System Administration Guide August