BSD 4_4 development
[unix-history] / usr / share / man / cat3 / getnetent.0
GETNETENT(3) BSD Programmer's Manual GETNETENT(3)
N\bNA\bAM\bME\bE
g\bge\bet\btn\bne\bet\bte\ben\bnt\bt, g\bge\bet\btn\bne\bet\btb\bby\bya\bad\bdd\bdr\br, g\bge\bet\btn\bne\bet\btb\bby\byn\bna\bam\bme\be, s\bse\bet\btn\bne\bet\bte\ben\bnt\bt, e\ben\bnd\bdn\bne\bet\bte\ben\bnt\bt - get network
entry
S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
#\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<n\bne\bet\btd\bdb\bb.\b.h\bh>\b>
_\bs_\bt_\br_\bu_\bc_\bt _\bn_\be_\bt_\be_\bn_\bt _\b*
g\bge\bet\btn\bne\bet\bte\ben\bnt\bt();
_\bs_\bt_\br_\bu_\bc_\bt _\bn_\be_\bt_\be_\bn_\bt _\b*
g\bge\bet\btn\bne\bet\btb\bby\byn\bna\bam\bme\be(_\bc_\bh_\ba_\br _\b*_\bn_\ba_\bm_\be);
_\bs_\bt_\br_\bu_\bc_\bt _\bn_\be_\bt_\be_\bn_\bt _\b*
g\bge\bet\btn\bne\bet\btb\bby\bya\bad\bdd\bdr\br(_\bl_\bo_\bn_\bg _\bn_\be_\bt, _\bi_\bn_\bt _\bt_\by_\bp_\be);
s\bse\bet\btn\bne\bet\bte\ben\bnt\bt(_\bi_\bn_\bt _\bs_\bt_\ba_\by_\bo_\bp_\be_\bn);
e\ben\bnd\bdn\bne\bet\bte\ben\bnt\bt();
D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
The g\bge\bet\btn\bne\bet\bte\ben\bnt\bt(), g\bge\bet\btn\bne\bet\btb\bby\byn\bna\bam\bme\be(), and g\bge\bet\btn\bne\bet\btb\bby\bya\bad\bdd\bdr\br() functions each return
a pointer to an object with the following structure containing the bro-
ken-out fields of a line in the network data base, _\b/_\be_\bt_\bc_\b/_\bn_\be_\bt_\bw_\bo_\br_\bk_\bs.
struct netent {
char *n_name; /* official name of net */
char **n_aliases; /* alias list */
int n_addrtype; /* net number type */
unsigned long n_net; /* net number */
};
The members of this structure are:
_\bn_\b__\bn_\ba_\bm_\be The official name of the network.
_\bn_\b__\ba_\bl_\bi_\ba_\bs_\be_\bs A zero terminated list of alternate names for the network.
_\bn_\b__\ba_\bd_\bd_\br_\bt_\by_\bp_\be The type of the network number returned; currently only
AF_INET.
_\bn_\b__\bn_\be_\bt The network number. Network numbers are returned in machine
byte order.
The g\bge\bet\btn\bne\bet\bte\ben\bnt\bt() function reads the next line of the file, opening the
file if necessary.
The s\bse\bet\btn\bne\bet\bte\ben\bnt\bt() function opens and rewinds the file. If the _\bs_\bt_\ba_\by_\bo_\bp_\be_\bn
flag is non-zero, the net data base will not be closed after each call to
g\bge\bet\btn\bne\bet\btb\bby\byn\bna\bam\bme\be() or g\bge\bet\btn\bne\bet\btb\bby\bya\bad\bdd\bdr\br().
The e\ben\bnd\bdn\bne\bet\bte\ben\bnt\bt() function closes the file.
The g\bge\bet\btn\bne\bet\btb\bby\byn\bna\bam\bme\be() function and g\bge\bet\btn\bne\bet\btb\bby\bya\bad\bdd\bdr\br() sequentially search from
the beginning of the file until a matching net name or net address and
type is found, or until EOF is encountered. Network numbers are supplied
in host order.
F\bFI\bIL\bLE\bES\bS
/etc/networks
D\bDI\bIA\bAG\bGN\bNO\bOS\bST\bTI\bIC\bCS\bS
Null pointer (0) returned on EOF or error.
S\bSE\bEE\bE A\bAL\bLS\bSO\bO
networks(5)
H\bHI\bIS\bST\bTO\bOR\bRY\bY
The g\bge\bet\btn\bne\bet\bte\ben\bnt\bt(), g\bge\bet\btn\bne\bet\btb\bby\bya\bad\bdd\bdr\br(), g\bge\bet\btn\bne\bet\btb\bby\byn\bna\bam\bme\be(), s\bse\bet\btn\bne\bet\bte\ben\bnt\bt(), and
e\ben\bnd\bdn\bne\bet\bte\ben\bnt\bt() functions appeared in 4.2BSD.
B\bBU\bUG\bGS\bS
The data space used by these functions is static; if future use requires
the data, it should be copied before any subsequent calls to these func-
tions overwrite it. Only Internet network numbers are currently under-
stood. Expecting network numbers to fit in no more than 32 bits is prob-
ably naive.
4.2 Berkeley Distribution June 4, 1993 2