gethostent_r 子例程

用途

检索网络主机条目。

Standard C Library (libc.a) 
(libbind) 
(libnis) 
(liblocal)

语法

#include <netdb.h>
 
int gethostent_r (htent, ht_data)
struct hostent *htent;
struct hostent_data *ht_data;

描述

当使用 DNS/BIND 名称服务解析时,未定义 盖托斯滕特尔 子例程。

当使用 NIS 名称服务解析或搜索本地 /etc/hosts 文件时, gethostent_r 子例程将读取 /etc/hosts 文件的下一行,并在必要时打开该文件。

盖托斯滕特尔 子例程在内部调用 盖托支架 子例程,并将值存储在 htent 和 ht_data 结构中。

盖托支架 子例程覆盖后续调用中返回的静态数据。 盖托斯滕特尔 子例程不存在。

参数

描述
赫滕特 指向 主机 结构。
ht_data 指向 霍斯滕数据 结构。

返回值

如果成功,则返回 0;如果不成功,则返回-1。

文件

描述
/etc/hosts 包含主机名数据库。
/etc/netsvc.conf 包含名称服务排序。
/usr/include/netdb.h 包含网络数据库结构。