CODE EXAMPLE 1-1 System Watchdog Node Management Code Example (Continued)
tflg = 1;
(void) strlcpy(timeout, optarg,
PICL_CLASSNAMELEN_MAX); break;
case ’a’:
aflg = 1;
(void) strlcpy(action, optarg,
PICL_CLASSNAMELEN_MAX); break;
case ’h’:
(void) printf("%s\n", USAGE_STR);
(void) printf("%s", DETAILED_HELP); exit(0);
case ’?’: /*FALLTHROUGH*/ default:
usage();
/*NOTREACHED*/
}
}
/* check if more than one action is specified */ if ((lflg + cflg + mflg) > 1) {
(void) printf("wdadm: more than one action " "specified
usage();
}
if ((lflg + cflg + mflg) == 0) {
/* if no args are specified, default action is listing */ lflg++;
}
err = picl_initialize(); if (err != PICL_SUCCESS) {
print_errmsg(gettext(err_msg[EM_INIT]), picl_strerror(err)); exit(1);
}
err = picl_get_root(&rooth); if (err != PICL_SUCCESS) {
print_errmsg(gettext(err_msg[EM_GETROOT]), picl_strerror(err));
(void) picl_shutdown(); exit(1);
}
if (lflg) {
Chapter 1 Watchdog Timer 19