Ejemplo n.º 1
0
int zmq::plain_mechanism_t::next_handshake_message (msg_t *msg_)
{
    int rc = 0;

    switch (state) {
        case sending_hello:
            rc = hello_command (msg_);
            if (rc == 0)
                state = waiting_for_welcome;
            break;
        case sending_welcome:
            rc = welcome_command (msg_);
            if (rc == 0)
                state = waiting_for_initiate;
            break;
        case sending_initiate:
            rc = initiate_command (msg_);
            if (rc == 0)
                state = waiting_for_ready;
            break;
        case sending_ready:
            rc = ready_command (msg_);
            if (rc == 0)
                state = ready;
            break;
        default:
            errno = EAGAIN;
            rc = -1;
    }
    return rc;
}
Ejemplo n.º 2
0
int			env_check_is_dirfile(char **path, char **env)
{
	struct stat	file_prop;

	if (ft_strchr(path[0], '/'))
		if (stat(path[0], &file_prop) == 0)
		{
			if (S_ISDIR(file_prop.st_mode))
				return (catch_env_error(1, path[0]));
			else if (file_x_access(path[0]) == 0)
				return (catch_env_error(2, path[0]));
			else
				return (initiate_command(NULL, path, env));
		}
	return (0);
}