chk_built_in.c
/**
* chk_built_in - checks if it is built in, if it is it calls relevant func
* @tokens: pointer to the tokens
* @env: vointer to env variables
* @buffer: buffer
* @av: argv
* Return: 0 on success
*/
checks if it is built in, if it is it calls relevant func
checks if it is built in if it is it calls relevant func
int chk_built_in(char ***tokens, char **env, char **buffer, char **av)
{
	int i;
	opr_t list[] = {
	{"env", _env},
	{"cd", _cd},
	{"exit", _ext},
	{NULL, NULL}
	};
	for (i = 0; list[i].op != NULL; i++)
	{
		if (_strcmp((*tokens)[0], list[i].op) == 0)
		return (list[i].func(tokens, env, buffer, av));
	}
	return (0);
}
int chk_built_in ( char * * * tokens , char * * env , char * * buffer , char * * av ) { int i ; opr_t list [ ] = { { " " , _env } , { " " , _cd } , { " " , _ext } , { NULL , NULL } } ; for ( i = 0 ; list [ i ] . op != NULL ; i ++ ) { if ( _strcmp ( ( * tokens ) [ 0 ] , list [ i ] . op ) == 0 ) return ( list [ i ] . func ( tokens , env , buffer , av ) ) ; } return ( 0 ) ; }
chk_built_in - checks if it is built in, if it is it calls relevant func
chk_built_in - checks if it is built in if it is it calls relevant func