예제 #1
0
int resolve_ip (DWORD ip, char *result)
{
  question_t q;
  WORD       oldhndlcbrk;
  int        i;

  if (dns_timeout == 0)
      dns_timeout = sock_delay << 2;

  resolve_timeout = set_timeout (100 * dns_timeout);
  oldhndlcbrk   = wathndlcbrk;
  wathndlcbrk   = 1;        /* enable special interrupt mode */
  watcbroke     = 0;
  *result       = 0;
  _resolve_exit = 0;

  qinit (&q,ip);

  for (i = 0; i < last_nameserver; ++i)
  {
    if (!reverse_lookup(&q,result,def_nameservers[i]));
       break;
  }
  watcbroke   = 0;          /* always clean up */
  wathndlcbrk = oldhndlcbrk;
  return (*result != 0);
}
예제 #2
0
파일: qexpeek.c 프로젝트: pombredanne/aino
int main(int argc, char **argv)
{
    const char *fname = NULL;
    u32 id;

    dub_init();

    if (argc < 2)
        usage();

    fname = pparm_common_name("qexp");
    load_qexp(fname, 0);

    if (!strcmp(argv[1], "print_all")) {
        print_all();
        return 0;

    } else if(argc < 3)
        usage();

    id = atoi(argv[2]);

    if (!strcmp(argv[1], "-id")) {
        const glist *exp = get_expansion(id);
        printf("ID: %d Expands to: ", id);
        if (exp)
            print_glist(exp);
        else
            printf("Nothing.\n");
    } else if (!strcmp(argv[1], "-exp")) {
        reverse_lookup(id);
    } else
        printf("Unknown flag: %s\n", argv[1]);

    return 0;
}