Commit | Line | Data |
---|---|---|
8bb980a3 C |
1 | GETPROTOENT(3) BSD Programmer's Manual GETPROTOENT(3) |
2 | ||
3 | N\bNA\bAM\bME\bE | |
4 | g\bge\bet\btp\bpr\bro\bot\bto\boe\ben\bnt\bt, g\bge\bet\btp\bpr\bro\bot\bto\bob\bby\byn\bnu\bum\bmb\bbe\ber\br, g\bge\bet\btp\bpr\bro\bot\bto\bob\bby\byn\bna\bam\bme\be, s\bse\bet\btp\bpr\bro\bot\bto\boe\ben\bnt\bt, e\ben\bnd\bdp\bpr\bro\bot\bto\boe\ben\bnt\bt - | |
5 | get protocol 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 _\bp_\br_\bo_\bt_\bo_\be_\bn_\bt _\b* | |
11 | g\bge\bet\btp\bpr\bro\bot\bto\boe\ben\bnt\bt(); | |
12 | ||
13 | _\bs_\bt_\br_\bu_\bc_\bt _\bp_\br_\bo_\bt_\bo_\be_\bn_\bt _\b* | |
14 | g\bge\bet\btp\bpr\bro\bot\bto\bob\bby\byn\bna\bam\bme\be(_\bc_\bh_\ba_\br _\b*_\bn_\ba_\bm_\be); | |
15 | ||
16 | _\bs_\bt_\br_\bu_\bc_\bt _\bp_\br_\bo_\bt_\bo_\be_\bn_\bt _\b* | |
17 | g\bge\bet\btp\bpr\bro\bot\bto\bob\bby\byn\bnu\bum\bmb\bbe\ber\br(_\bi_\bn_\bt _\bp_\br_\bo_\bt_\bo); | |
18 | ||
19 | s\bse\bet\btp\bpr\bro\bot\bto\boe\ben\bnt\bt(_\bi_\bn_\bt _\bs_\bt_\ba_\by_\bo_\bp_\be_\bn); | |
20 | ||
21 | e\ben\bnd\bdp\bpr\bro\bot\bto\boe\ben\bnt\bt(); | |
22 | ||
23 | D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN | |
24 | The g\bge\bet\btp\bpr\bro\bot\bto\boe\ben\bnt\bt(), g\bge\bet\btp\bpr\bro\bot\bto\bob\bby\byn\bna\bam\bme\be(), and g\bge\bet\btp\bpr\bro\bot\bto\bob\bby\byn\bnu\bum\bmb\bbe\ber\br() functions | |
25 | each return a pointer to an object with the following structure contain- | |
26 | ing the broken-out fields of a line in the network protocol data base, | |
27 | _\b/_\be_\bt_\bc_\b/_\bp_\br_\bo_\bt_\bo_\bc_\bo_\bl_\bs. | |
28 | ||
29 | ||
30 | struct protoent { | |
31 | char *p_name; /* official name of protocol */ | |
32 | char **p_aliases; /* alias list */ | |
33 | int p_proto; /* protocol number */ | |
34 | }; | |
35 | ||
36 | The members of this structure are: | |
37 | ||
38 | _\bp_\b__\bn_\ba_\bm_\be The official name of the protocol. | |
39 | ||
40 | _\bp_\b__\ba_\bl_\bi_\ba_\bs_\be_\bs A zero terminated list of alternate names for the protocol. | |
41 | ||
42 | _\bp_\b__\bp_\br_\bo_\bt_\bo The protocol number. | |
43 | ||
44 | The g\bge\bet\btp\bpr\bro\bot\bto\boe\ben\bnt\bt() function reads the next line of the file, opening the | |
45 | file if necessary. | |
46 | ||
47 | The s\bse\bet\btp\bpr\bro\bot\bto\boe\ben\bnt\bt() function opens and rewinds the file. If the _\bs_\bt_\ba_\by_\bo_\bp_\be_\bn | |
48 | flag is non-zero, the net data base will not be closed after each call to | |
49 | g\bge\bet\btp\bpr\bro\bot\bto\bob\bby\byn\bna\bam\bme\be() or g\bge\bet\btp\bpr\bro\bot\bto\bob\bby\byn\bnu\bum\bmb\bbe\ber\br(). | |
50 | ||
51 | The e\ben\bnd\bdp\bpr\bro\bot\bto\boe\ben\bnt\bt() function closes the file. | |
52 | ||
53 | The g\bge\bet\btp\bpr\bro\bot\bto\bob\bby\byn\bna\bam\bme\be() function and g\bge\bet\btp\bpr\bro\bot\bto\bob\bby\byn\bnu\bum\bmb\bbe\ber\br() sequentially search | |
54 | from the beginning of the file until a matching protocol name or protocol | |
55 | number is found, or until EOF is encountered. | |
56 | ||
57 | R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS | |
58 | Null pointer (0) returned on EOF or error. | |
59 | ||
60 | F\bFI\bIL\bLE\bES\bS | |
61 | /etc/protocols | |
62 | ||
63 | S\bSE\bEE\bE A\bAL\bLS\bSO\bO | |
64 | protocols(5) | |
65 | ||
66 | H\bHI\bIS\bST\bTO\bOR\bRY\bY | |
67 | The g\bge\bet\btp\bpr\bro\bot\bto\boe\ben\bnt\bt(), g\bge\bet\btp\bpr\bro\bot\bto\bob\bby\byn\bnu\bum\bmb\bbe\ber\br(), g\bge\bet\btp\bpr\bro\bot\bto\bob\bby\byn\bna\bam\bme\be(), s\bse\bet\btp\bpr\bro\bot\bto\boe\ben\bnt\bt(), | |
68 | and e\ben\bnd\bdp\bpr\bro\bot\bto\boe\ben\bnt\bt() functions appeared in 4.2BSD. | |
69 | ||
70 | B\bBU\bUG\bGS\bS | |
71 | These functions use a static data space; if the data is needed for future | |
72 | use, it should be copied before any subsequent calls overwrite it. Only | |
73 | the Internet protocols are currently understood. | |
74 | ||
75 | 4.2 Berkeley Distribution June 4, 1993 2 |