Commit | Line | Data |
---|---|---|
8bb980a3 C |
1 | GETNETENT(3) BSD Programmer's Manual GETNETENT(3) |
2 | ||
3 | N\bNA\bAM\bME\bE | |
4 | 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 | |
5 | entry | |
6 | ||
7 | S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS | |
8 | #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<n\bne\bet\btd\bdb\bb.\b.h\bh>\b> | |
9 | ||
10 | _\bs_\bt_\br_\bu_\bc_\bt _\bn_\be_\bt_\be_\bn_\bt _\b* | |
11 | g\bge\bet\btn\bne\bet\bte\ben\bnt\bt(); | |
12 | ||
13 | _\bs_\bt_\br_\bu_\bc_\bt _\bn_\be_\bt_\be_\bn_\bt _\b* | |
14 | g\bge\bet\btn\bne\bet\btb\bby\byn\bna\bam\bme\be(_\bc_\bh_\ba_\br _\b*_\bn_\ba_\bm_\be); | |
15 | ||
16 | _\bs_\bt_\br_\bu_\bc_\bt _\bn_\be_\bt_\be_\bn_\bt _\b* | |
17 | 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); | |
18 | ||
19 | s\bse\bet\btn\bne\bet\bte\ben\bnt\bt(_\bi_\bn_\bt _\bs_\bt_\ba_\by_\bo_\bp_\be_\bn); | |
20 | ||
21 | e\ben\bnd\bdn\bne\bet\bte\ben\bnt\bt(); | |
22 | ||
23 | D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN | |
24 | 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 | |
25 | a pointer to an object with the following structure containing the bro- | |
26 | ken-out fields of a line in the network data base, _\b/_\be_\bt_\bc_\b/_\bn_\be_\bt_\bw_\bo_\br_\bk_\bs. | |
27 | ||
28 | struct netent { | |
29 | char *n_name; /* official name of net */ | |
30 | char **n_aliases; /* alias list */ | |
31 | int n_addrtype; /* net number type */ | |
32 | unsigned long n_net; /* net number */ | |
33 | }; | |
34 | ||
35 | The members of this structure are: | |
36 | ||
37 | _\bn_\b__\bn_\ba_\bm_\be The official name of the network. | |
38 | ||
39 | _\bn_\b__\ba_\bl_\bi_\ba_\bs_\be_\bs A zero terminated list of alternate names for the network. | |
40 | ||
41 | _\bn_\b__\ba_\bd_\bd_\br_\bt_\by_\bp_\be The type of the network number returned; currently only | |
42 | AF_INET. | |
43 | ||
44 | _\bn_\b__\bn_\be_\bt The network number. Network numbers are returned in machine | |
45 | byte order. | |
46 | ||
47 | The g\bge\bet\btn\bne\bet\bte\ben\bnt\bt() function reads the next line of the file, opening the | |
48 | file if necessary. | |
49 | ||
50 | 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 | |
51 | flag is non-zero, the net data base will not be closed after each call to | |
52 | 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(). | |
53 | ||
54 | The e\ben\bnd\bdn\bne\bet\bte\ben\bnt\bt() function closes the file. | |
55 | ||
56 | 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 | |
57 | the beginning of the file until a matching net name or net address and | |
58 | type is found, or until EOF is encountered. Network numbers are supplied | |
59 | in host order. | |
60 | ||
61 | F\bFI\bIL\bLE\bES\bS | |
62 | /etc/networks | |
63 | ||
64 | D\bDI\bIA\bAG\bGN\bNO\bOS\bST\bTI\bIC\bCS\bS | |
65 | Null pointer (0) returned on EOF or error. | |
66 | ||
67 | S\bSE\bEE\bE A\bAL\bLS\bSO\bO | |
68 | networks(5) | |
69 | ||
70 | H\bHI\bIS\bST\bTO\bOR\bRY\bY | |
71 | 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 | |
72 | e\ben\bnd\bdn\bne\bet\bte\ben\bnt\bt() functions appeared in 4.2BSD. | |
73 | ||
74 | B\bBU\bUG\bGS\bS | |
75 | The data space used by these functions is static; if future use requires | |
76 | the data, it should be copied before any subsequent calls to these func- | |
77 | tions overwrite it. Only Internet network numbers are currently under- | |
78 | stood. Expecting network numbers to fit in no more than 32 bits is prob- | |
79 | ably naive. | |
80 | ||
81 | 4.2 Berkeley Distribution June 4, 1993 2 |