Searches the networks database for a network record with a specified name or alias. If the network record is not found, this function may invoke the BIND resolver to search TCPIP$SYSTEM:NETWORKS.DAT. The $QIO equivalent is the IO$_ACPCONTROL function with the INETACP_FUNC$C_GETNETBYNAME subfunction code. Format #include <netdb.h> struct netent *getnetbyname ( char *name );
1 – Argument
name A pointer to a null-terminated character string containing either the network name or an alias for the network name.
2 – Description
This function finds the first network record in the networks database with the given name or alias. The getnetbyaddr() and getnetbyname() functions use a common static area for their return values. Subsequent calls to any of these functions overwrite previously returned network entries. You must make a copy of the network entry if you want to save it.
3 – Return Values
NULL Indicates end of file or an error. x A pointer to an object having the netent structure.
4 – Errors
EFAULT The buffer described by name is not a valid, writable part of the user address space. EINVAL The name argument is invalid. ESRCH The search failed.