⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lookup.c

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 C
字号:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "wattcp.h"
#include "strings.h"
#include "udp_nds.h"
#include "udp_dom.h"
#include "pcconfig.h"
#include "pcbsd.h"
#include "pctcp.h"

DWORD lookup_host (const char *host, char *ip_str)
{
  DWORD ip;

  if (isaddr(host))
     ip = aton (host);
  else
  {
#if defined(USE_DEBUG)
    char buf[20];

    (*_printf) ("Resolving `%s'...", host);
    fflush (stdout);
    ip = resolve (host);
    if (ip)
       (*_printf) ("[%s]\r\n", _inet_ntoa(buf,ip));
#else
    ip = resolve (host);
#endif
  }

  /* Don't use is_local_addr(); an loopback address is valid here.
   */
  if (ip - my_ip_addr <= multihomes)
  {
#if defined(USE_DEBUG)
    (*_printf) ("Can not connect to ourself\r\n");
#endif
    exit (1);
  }

  if (ip_str)
     _inet_ntoa (ip_str, ip);
  return (ip);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -