FreeBSD/usr.sbin/watchdogd/watchdogd.c
/*
 * Take a comma separated list of actions and or the flags
 * together for the ioctl.
 */
Take a comma separated list of actions and or the flags
together for the ioctl.
Take a comma separated list of actions and or the flags together for the ioctl .
static int
timeout_act_str2int(const char *lopt, const char *acts)
{
	int i;
	char *dupacts, *tofree;
	char *o;
	int rv = 0;
	tofree = dupacts = strdup(acts);
	if (!tofree)
		err(EX_OSERR, "malloc");
	while ((o = strsep(&dupacts, ",")) != NULL) {
		for (i = 0; act_tbl[i].at_act != NULL; i++) {
			if (!strcmp(o, act_tbl[i].at_act)) {
				rv |= act_tbl[i].at_value;
				break;
			}
		}
		if (act_tbl[i].at_act == NULL)
			timeout_act_error(lopt, o);
	}
	free(tofree);
	return rv;
}
static int timeout_act_str2int ( const char * lopt , const char * acts ) { int i ; char * dupacts , * tofree ; char * o ; int rv = 0 ; tofree = dupacts = strdup ( acts ) ; if ( ! tofree ) err ( EX_OSERR , " " ) ; while ( ( o = strsep ( & dupacts , " " ) ) != NULL ) { for ( i = 0 ; act_tbl [ i ] . at_act != NULL ; i ++ ) { if ( ! strcmp ( o , act_tbl [ i ] . at_act ) ) { rv |= act_tbl [ i ] . at_value ; break ; } } if ( act_tbl [ i ] . at_act == NULL ) timeout_act_error ( lopt , o ) ; } free ( tofree ) ; return rv ; }
Take a comma separated list of actions and or the flags
 together for the ioctl.
Take a comma separated list of actions and or the flags together for the ioctl .