beautypg.com

Sun Microsystems Netra CP2500 User Manual

Page 32

background image

18

Netra CP2500 Board Programming Guide • March 2007

return (err);

}

int

main(int argc, char **argv)

{

int err;

int c, rc = 0;

char cntrl_name[PICL_CLASSNAMELEN_MAX];

char op[PICL_CLASSNAMELEN_MAX];

char wd_name[PICL_CLASSNAMELEN_MAX];

char timeout[PICL_CLASSNAMELEN_MAX];

char action[PICL_CLASSNAMELEN_MAX];

int cflg = 0, oflg = 0, lflg = 0;

int mflg = 0, tflg = 0, aflg = 0;

(void) setlocale(LC_ALL, "");

if ((prog = strrchr(argv[0], ’/’)) == NULL)

prog = argv[0];

else

prog++;

bzero(timeout, PICL_CLASSNAMELEN_MAX);

bzero(action, PICL_CLASSNAMELEN_MAX);

while ((c = getopt(argc, argv, "hlc:o:m:t:a:")) != EOF) {

switch (c) {

case ’l’:

lflg = 1;

break;

case ’c’:

cflg = 1;

(void) strlcpy(cntrl_name, optarg,

PICL_CLASSNAMELEN_MAX);

break;

case ’o’:

oflg = 1;

(void) strlcpy(op, optarg,

PICL_CLASSNAMELEN_MAX);

break;

case ’m’:

mflg = 1;

(void) strlcpy(wd_name, optarg,

PICL_CLASSNAMELEN_MAX);

break;

case ’t’:

CODE EXAMPLE 1-1

System Watchdog Node Management Code Example (Continued)