rqa (struct query *z)
{
    int i = 0;

    for (i = QUERY_MAXALIAS - 1; i >= 0; --i)
    {
        if (z->alias[i])
        {
            if (!response_query (z->alias[i], z->type, z->class))
                return 0;
            while (i > 0)
            {
                if (!response_cname (z->alias[i],
                                     z->alias[i - 1], z->aliasttl[i]))
                    return 0;
                --i;
            }
            if (!response_cname (z->alias[0], z->name[0], z->aliasttl[0]))
                return 0;

            return 1;
        }
    }

    if (!response_query (z->name[0], z->type, z->class))
        return 0;

    return 1;
}
rqa (struct query *z)
{
    int i = 0;

    for (i = QUERY_MAXALIAS - 1; i >= 0; --i)
    {
        if (z->alias[i])
        {
            if (!response_query (z->alias[i], z->type, z->class))
                return 0;
            while (i > 0)
            {
                if (!response_cname (z->alias[i],
                                     z->alias[i - 1], z->aliasttl[i]))
                    return 0;
                --i;
            }
            if (!response_cname (z->alias[0], z->name[0], z->aliasttl[0]))
                return 0;

            return 1;
        }
    }

    if (!response_query (z->name[0], z->type, z->class))
        return 0;

    return 1;
}