getnetbyname(3) [osf1 man page]
getnetbyname(3) Library Functions Manual getnetbyname(3) NAME
getnetbyname, getnetbyname_r - Get a network entry by name LIBRARY
Standard C Library (libc.so, libc.a) 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 oper- ating system. You should not use it in new designs. int getnetbyname_r( const char *name, struct netent *net, struct netent_data *net_data); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: getnetbyname(): XNS4.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the official network name or alias. [Tru64 UNIX] For getnetbyname_r() only, this points to the netent structure. The netdb.h header file defines the netent structure. [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 flag 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: The net or net_data parameter is invalid. The search failed. FILES
This file is the DARPA Internet network name database file. Each record in the file occupies a single line and has three fields: the offi- cial network name, the network number, and alias. RELATED INFORMATION
Functions: endnetent(3), getnetent(3), getnetbyaddr(3), setnetent(3). Files: networks(4), svc.conf(4). Networks: nis_intro(7). Standards: standards(5). delim off getnetbyname(3)
Check Out this Related Man Page
setnetent(3) Library Functions Manual setnetent(3) NAME
setnetent, setnetent_r, endnetent, endnetent_r - Opens, rewinds, or closes the networks file LIBRARY
Standard C Library (libc.so, libc.a) SYNOPSIS
#include <netdb.h> void setnetent( int stay_open); void endnetent(void); [Tru64 UNIX] The following functions are supported in order to maintain backward compatibility with previous versions of the operating system. int setnetent_r( int stay_open, struct netent_data *net_data); void endnetent_r( struct netent_data *net_data); The following definition of the setnetent() function does not conform to current standards and is supported only for backward compatibility (see standards(5)): int setnetent( int stay_open); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: setnetent(): XNS4.0 endnetent(): XNS4.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies a value that indicates when to close the networks file. Specifying a value of 0 (zero) closes the networks file after each call to the getnetent() function. Specifying a nonzero value leaves the networks database file open after each call. [Tru64 UNIX] For setne- tent_r() and endnetent_r() only, this points at a structure where setnetent_r() and endnetent_r() store information about the networks file. DESCRIPTION
The setnetent() (set network entry) function opens the either the local /etc/networks file or the NIS distributed networks file and sets the file marker at the beginning of the file. To determine which file or files to search, and in which order, the system uses the switches in the /etc/svc.conf file. The endnetent() function closes the networks file, previously opened with the getnetent(), getnetbyaddr(), setnetent(), or getnetbyname() function. If the setnetent() function is called with a non-zero stay_open parameter, the connection remains until the endnetent() or exit() functions are called. NOTES
[Tru64 UNIX] The setnetent_r() function is the reentrant version of the setnetent() function. It is supported in order to maintain back- ward compatibility with previous versions of the operating system. Upon successful completion, the setnetent_r() function returns a value of 0 (zero). Otherwise, it returns a value of -1. [Tru64 UNIX] Note that when you first call the setnetent_r() function, you must set to NULL the net_fp field of the netent_data structure. The netdb.h header file defines the netent_data structure. [Tru64 UNIX] The endnetent_r() function is the reentrant version of the endnetent() function. It is supported in order to maintain back- ward compatibility with previous versions of the operating system. The netdb.h header file defines the netent_data structure. RETURN VALUES
Upon successful completion, the backward compatible version of the setnetent() function returns a value of 1. Otherwise, it returns a value of 0 (zero). The setnetent, endnetent(), and endnetent_r() functions do not return a value. ERRORS
Current industry standards do not define error values for the setnetent() and endnetent functions. [Tru64 UNIX] If any of the following conditions occurs, the setnetent_r() function sets errno to the corresponding value: If net_data is invalid. In addition, the setnetent(), backward compatible version of setnetent(), and setnetent_r() functions can fail to open the file. In this case, errno will be set to the appropriate value. FILES
This file is the DARPA Internet network name database file. Each record in the file occupies a single line and has three fields: the offi- cial network name, the network number, and alias. The database service selection configuration file. RELATED INFORMATION
Functions: getnetbyaddr(3), getnetbyname(3), getnetent(3). Files: networks(4), svc.conf(4). Networks: nis_intro(7). Standards: standards(5). delim off setnetent(3)