FreeBSD/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.c
/* Try to find command in specified category */
Try to find command in specified category
Try to find command in specified category
static struct bthid_command *
find_bthid_command(char const *command, struct bthid_command *category)
{ 
	struct bthid_command	*c = NULL;
	for (c = category; c->command != NULL; c++) {
		char	*c_end = strchr(c->command, ' ');
		if (c_end != NULL) {
			int	len = c_end - c->command;
			if (strncasecmp(command, c->command, len) == 0)
				return (c);
		} else if (strcasecmp(command, c->command) == 0)
				return (c);
	}
	return (NULL);
}
static struct bthid_command * find_bthid_command ( char const * command , struct bthid_command * category ) { struct bthid_command * c = NULL ; for ( c = category ; c -> command != NULL ; c ++ ) { char * c_end = strchr ( c -> command , ' ' ) ; if ( c_end != NULL ) { int len = c_end - c -> command ; if ( strncasecmp ( command , c -> command , len ) == 0 ) return ( c ) ; } else if ( strcasecmp ( command , c -> command ) == 0 ) return ( c ) ; } return ( NULL ) ; }
Try to find command in specified category
Try to find command in specified category