sbin/geom/core/geom.c
/*
 * Find given command in commands available for given class.
 */
Find given command in commands available for given class.
Find given command in commands available for given class .
static struct g_command *
find_command(const char *cmdstr, int flags)
{
	struct g_command *cmd;
	unsigned i;
	if ((flags & GEOM_CLASS_CMDS) != 0 && class_commands != NULL) {
		for (i = 0; ; i++) {
			cmd = &class_commands[i];
			if (cmd->gc_name == NULL)
				break;
			if (strcmp(cmd->gc_name, cmdstr) == 0)
				return (cmd);
		}
	}
	if ((flags & GEOM_STD_CMDS) != 0) {
		for (i = 0; ; i++) {
			cmd = &std_commands[i];
			if (cmd->gc_name == NULL)
				break;
			if (strcmp(cmd->gc_name, cmdstr) == 0)
				return (cmd);
		}
	}
	return (NULL);
}
static struct g_command * find_command ( const char * cmdstr , int flags ) { struct g_command * cmd ; unsigned i ; if ( ( flags & GEOM_CLASS_CMDS ) != 0 && class_commands != NULL ) { for ( i = 0 ; ; i ++ ) { cmd = & class_commands [ i ] ; if ( cmd -> gc_name == NULL ) break ; if ( strcmp ( cmd -> gc_name , cmdstr ) == 0 ) return ( cmd ) ; } } if ( ( flags & GEOM_STD_CMDS ) != 0 ) { for ( i = 0 ; ; i ++ ) { cmd = & std_commands [ i ] ; if ( cmd -> gc_name == NULL ) break ; if ( strcmp ( cmd -> gc_name , cmdstr ) == 0 ) return ( cmd ) ; } } return ( NULL ) ; }
Find given command in commands available for given class.
Find given command in commands available for given class .
/*
	 * First try to find command defined by loaded library.
	 */ /*
	 * Now try to find in standard commands.
	 */