Ejemplo n.º 1
0
Archivo: cmd.c Proyecto: agadiffe/ft_sh
void			handle_cmds(t_state *state, char *line, char **cmds)
{
	if (check_builtins(state, cmds[0]))
		run_builtins(state, cmds, line);
	else if (!is_exist_cmd(state->pwd))
		print_no_such_file_or_dir(state, cmds[0], state->pwd);
	else if (!is_exec_cmd(state->pwd))
		print_permission_denied(state, cmds[0], state->pwd);
	else
		handle_validated_cmd(state, cmds);
}
Ejemplo n.º 2
0
/* runs command from cmd */
inline static int run_cmd(int s, struct binrpc_cmd* cmd, char* format)
{
	int ret;
	char* fmt;

	fmt=format;

	fix_cmd(cmd, &fmt);
	if (!(ret=run_builtins(s, cmd))){
		ret=run_binrpc_cmd(s, cmd, fmt);
	}
	return (ret>0)?0:ret;
}