Gets network entry by name.
Standard C Library (libc.a)
#include <netdb.h>
int getnetbyname_r(Name, netent, net_data)
register const char *Name;
struct netent *netent;
struct netent_data *net_data;
The getnetbyname_r subroutine retrieves information from the /etc/networks file using the Name parameter as a search key.
The getnetbyname_r subroutine internally calls the getnetbyname subroutine and stores the information in the structure data.
The getnetbyname subroutine overwrites the static data returned in subsequent calls. The getnetbyname_r subroutine does not.
Use the endnetent_r subroutine to close the /etc/networks file.
Item | Description |
---|---|
Name | Points to a string containing the name of the network. |
netent | Points to the netent structure. |
net_data | Points to the net_data structure. |
The function returns a 0 if successful and a -1 if unsuccessful.
Item | Description |
---|---|
/etc/networks | Contains official network names. |