int process_arguments (int argc, char **argv) {
    int c;
    int option = 0;

    static struct option long_opts[] = {
        MP_LONGOPTS_DEFAULT,
        MP_LONGOPTS_HOST,
        LDNS_LONGOPTS,
        {"domain", required_argument, 0, 'D'},
        {"trace-from", required_argument, 0, 'T'},
        {"trusted-keys", required_argument, 0, 'k'},
        {"resolver", required_argument, 0, 'R'},
        MP_LONGOPTS_END
    };

    if (argc < 2) {
        print_help();
        exit (STATE_OK);
    }

    while (1) {
        c = mp_getopt(&argc, &argv, MP_OPTSTR_DEFAULT"H:D:T:k:R:"LDNS_OPTSTR, long_opts, &option);
        if (c == -1 || c == EOF)
            break;

        getopt_ldns(c);

        switch (c) {
            /* Host opt */
            case 'H':
                getopt_host_ip(optarg, &hostname);
                break;
            case 'D':
                if (!is_hostname(optarg))
                    usage("Illegal domain name.");
                domainname = optarg;
                break;
            case 'k':
                trusted_keys = loadKeyfile(optarg);
                if (trusted_keys == NULL)
                    usage("Parsing keyfile failed.");
                break;
            case 'T':
                if (!is_hostname(optarg))
                    usage("Illegal trace domain name.");
                domaintrace = optarg;
                break;
            case 'R':
                getopt_host_ip(optarg, &resolver);
                break;
        }
    }

    /* Check requirements */
    if(!domainname)
        usage("Domain is mandatory");

    return OK;
}
int process_arguments (int argc, char **argv) {
    int c;
    int option = 0;

    static struct option longopts[] = {
        MP_LONGOPTS_DEFAULT,
        MP_LONGOPTS_HOST,
        {"domainname", required_argument, 0, 'D'},
        {"norecursion", no_argument, &recursion, 0},
        {"notcp", no_argument, &tcp, 0},
        {"noudp", no_argument, &udp, 0},
        {"noaxfr", no_argument, &axfr, 0},
        MP_LONGOPTS_END
    };


    if (argc < 2) {
        print_help();
        exit(STATE_OK);
    }

    while (1) {
        c = mp_getopt(&argc, &argv, MP_OPTSTR_DEFAULT"H:D:", longopts, &option);

        if (c == -1 || c == EOF)
            break;

        switch (c) {
            /* Host opt */
            case 'H':
                getopt_host_ip(optarg, &hostname);
                break;
            case 'D':
                domainname = optarg;
                break;
        }
    }

    /* Check requirements */
    if (!domainname)
        usage("A domainname is mandatory.");

    return(OK);
}