CÓDIGO EJEMPLO B-1
alarm_type = TSALARM_MAJOR;
else if (strncmp(argv[2], "minor", 2) == 0)
alarm_type = TSALARM_MINOR;
else if (strncmp(argv[2], "user", 1) == 0)
alarm_type = TSALARM_USER;
else
help(argv[0]);
if (strncmp(argv[1], "get", 1) == 0) {
tsalarm_get(alarm_type, &alarm_state);
printf("alarm = %d\tstate = %d\n", alarm_type, alarm_state);
}
else if (strncmp(argv[1], "set", 1) == 0) {
if (strncmp(argv[3], "on", 2) == 0)
else if (strncmp(argv[3], "off", 2) == 0)
else
tsalarm_set(alarm_type, alarm_state);
}
else {
help(argv[0]);
}
return 0;
}
82
Guía de administración del servidor Sun Netra T5220 • Enero de 2008
Aplicación utilizando la biblioteca libtsalarm (continuación)
alarm_state = TSALARM_STATE_ON;
alarm_state = TSALARM_STATE_OFF;
help(argv[0]);