Index Index for
Section 3
Index Alphabetical
listing for G
Bottom of page Bottom of
page

getnetbyname(3)

NAME

getnetbyname, getnetbyname_r - Get a network entry by name

SYNOPSIS

#include <netdb.h> struct netent *getnetbyname( const char *name ); [Tru64 UNIX] The following obsolete function is supported in order to maintain backward compatibility with previous versions of the operating system. You should not use it in new designs. int getnetbyname_r( const char *name, struct netent *net, struct netent_data *net_data );

LIBRARY

Standard C Library (libc)

STANDARDS

Interfaces documented on this reference page conform to industry standards as follows: getnetbyname(): XNS4.0, XNS5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags.

PARAMETERS

name Specifies the official network name or alias. net [Tru64 UNIX] For getnetbyname_r() only, this points to the netent structure. The netdb.h header file defines the netent structure. net_data [Tru64 UNIX] For getnetbyname_r() only, this is data for the networks database. The netdb.h header file defines the netent_data structure.

DESCRIPTION

The getnetbyname() function returns a pointer to a structure of type netent. Its members specify data in fields from either the local /etc/networks file or the NIS distributed network database. To determine which file or files to search, and in which order, the system uses the switches in the /etc/svc.conf file. The netdb.h header file defines the netent structure. The getnetbyname() function searches the networks file sequentially until a match with the name parameter occurs. When EOF (End-of-File) is reached without a match, an null pointer is returned by this function. Use the endnetent() function to close the networks file.

NOTES

The getnetbyname() function returns a pointer to thread-specific data. Subsequent calls to this or a related function from the same thread overwrite this data. [Tru64 UNIX] The getnetbyname_r() function is an obsolete reentrant version of the getnetbyname() function. It is supported in order to maintain backward compatibility with previous versions of the operating system and should not be used in new designs. Note that you must set the net_fp field of the netent_data structure to NULL before its first access by either the setnetent_r() or getnetbyname_r() function. You must initialize the _net_stayopen option of the netent_data structure if you are not using the setnetent() function.

RETURN VALUES

Upon successful completion, the getnetbyname() function returns a pointer to a netent structure. If it fails or reaches the end of the /etc/networks name file, it returns a null pointer. [Tru64 UNIX] Upon successful completion, the getnetbyname_r() function stores the netent structure in the location pointed to by net, and returns a value of 0 (zero). Upon failure, it returns a value of -1.

ERRORS

Current industry standards do not define error values for the getnetbyname() function. [Tru64 UNIX] If any of the following conditions occurs, the getnetbyname_r() function sets errno to the corresponding value: [EINVAL] The net or net_data parameter is invalid. [ESRCH] The search failed.

FILES

/etc/networks This file is the Internet network name database file. Each record in the file occupies a single line and has three fields: the official network name, the network number, and alias.

SEE ALSO

Functions: endnetent(3), getnetent(3), getnetbyaddr(3), setnetent(3). Files: networks(4), svc.conf(4). Networks: nis_intro(7). Standards: standards(5). Network Programmer's Guide

Index Index for
Section 3
Index Alphabetical
listing for G
Top of page Top of
page