diff options
Diffstat (limited to 'src/lib/libc/net/getnetent.3')
| -rw-r--r-- | src/lib/libc/net/getnetent.3 | 83 |
1 files changed, 35 insertions, 48 deletions
diff --git a/src/lib/libc/net/getnetent.3 b/src/lib/libc/net/getnetent.3 index d4f0bedbf9..00fd543ec4 100644 --- a/src/lib/libc/net/getnetent.3 +++ b/src/lib/libc/net/getnetent.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $NetBSD: getnetent.3,v 1.3 1995/02/25 06:20:32 cgd Exp $ | 1 | .\" $OpenBSD: getnetent.3,v 1.15 2007/05/31 19:19:30 jmc Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 1983, 1991, 1993 | 3 | .\" Copyright (c) 1983, 1991, 1993 |
| 4 | .\" The Regents of the University of California. All rights reserved. | 4 | .\" The Regents of the University of California. All rights reserved. |
| @@ -11,11 +11,7 @@ | |||
| 11 | .\" 2. Redistributions in binary form must reproduce the above copyright | 11 | .\" 2. Redistributions in binary form must reproduce the above copyright |
| 12 | .\" notice, this list of conditions and the following disclaimer in the | 12 | .\" notice, this list of conditions and the following disclaimer in the |
| 13 | .\" documentation and/or other materials provided with the distribution. | 13 | .\" documentation and/or other materials provided with the distribution. |
| 14 | .\" 3. All advertising materials mentioning features or use of this software | 14 | .\" 3. Neither the name of the University nor the names of its contributors |
| 15 | .\" must display the following acknowledgement: | ||
| 16 | .\" This product includes software developed by the University of | ||
| 17 | .\" California, Berkeley and its contributors. | ||
| 18 | .\" 4. Neither the name of the University nor the names of its contributors | ||
| 19 | .\" may be used to endorse or promote products derived from this software | 15 | .\" may be used to endorse or promote products derived from this software |
| 20 | .\" without specific prior written permission. | 16 | .\" without specific prior written permission. |
| 21 | .\" | 17 | .\" |
| @@ -31,11 +27,9 @@ | |||
| 31 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 27 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | .\" SUCH DAMAGE. | 28 | .\" SUCH DAMAGE. |
| 33 | .\" | 29 | .\" |
| 34 | .\" @(#)getnetent.3 8.1 (Berkeley) 6/4/93 | 30 | .Dd $Mdocdate: May 31 2007 $ |
| 35 | .\" | ||
| 36 | .Dd June 4, 1993 | ||
| 37 | .Dt GETNETENT 3 | 31 | .Dt GETNETENT 3 |
| 38 | .Os BSD 4.2 | 32 | .Os |
| 39 | .Sh NAME | 33 | .Sh NAME |
| 40 | .Nm getnetent , | 34 | .Nm getnetent , |
| 41 | .Nm getnetbyaddr , | 35 | .Nm getnetbyaddr , |
| @@ -46,31 +40,30 @@ | |||
| 46 | .Sh SYNOPSIS | 40 | .Sh SYNOPSIS |
| 47 | .Fd #include <netdb.h> | 41 | .Fd #include <netdb.h> |
| 48 | .Ft struct netent * | 42 | .Ft struct netent * |
| 49 | .Fn getnetent | 43 | .Fn getnetent "void" |
| 50 | .Ft struct netent * | 44 | .Ft struct netent * |
| 51 | .Fn getnetbyname "char *name" | 45 | .Fn getnetbyname "const char *name" |
| 52 | .Ft struct netent * | 46 | .Ft struct netent * |
| 53 | .Fn getnetbyaddr "long net" "int type" | 47 | .Fn getnetbyaddr "in_addr_t net" "int type" |
| 48 | .Ft void | ||
| 54 | .Fn setnetent "int stayopen" | 49 | .Fn setnetent "int stayopen" |
| 55 | .Fn endnetent | 50 | .Ft void |
| 51 | .Fn endnetent "void" | ||
| 56 | .Sh DESCRIPTION | 52 | .Sh DESCRIPTION |
| 57 | The | 53 | The |
| 58 | .Fn getnetent , | 54 | .Fn getnetent , |
| 59 | .Fn getnetbyname , | 55 | .Fn getnetbyname , |
| 60 | and | 56 | and |
| 61 | .Fn getnetbyaddr | 57 | .Fn getnetbyaddr |
| 62 | functions | 58 | functions each return a pointer to an object with the following structure |
| 63 | each return a pointer to an object with the | 59 | containing the broken-out fields of a line in the network database, |
| 64 | following structure | ||
| 65 | containing the broken-out | ||
| 66 | fields of a line in the network data base, | ||
| 67 | .Pa /etc/networks . | 60 | .Pa /etc/networks . |
| 68 | .Bd -literal -offset indent | 61 | .Bd -literal -offset indent |
| 69 | struct netent { | 62 | struct netent { |
| 70 | char *n_name; /* official name of net */ | 63 | char *n_name; /* official name of net */ |
| 71 | char **n_aliases; /* alias list */ | 64 | char **n_aliases; /* alias list */ |
| 72 | int n_addrtype; /* net number type */ | 65 | int n_addrtype; /* net number type */ |
| 73 | unsigned long n_net; /* net number */ | 66 | in_addr_t n_net; /* net number */ |
| 74 | }; | 67 | }; |
| 75 | .Ed | 68 | .Ed |
| 76 | .Pp | 69 | .Pp |
| @@ -79,45 +72,42 @@ The members of this structure are: | |||
| 79 | .It Fa n_name | 72 | .It Fa n_name |
| 80 | The official name of the network. | 73 | The official name of the network. |
| 81 | .It Fa n_aliases | 74 | .It Fa n_aliases |
| 82 | A zero terminated list of alternate names for the network. | 75 | A null-terminated list of alternate names for the network. |
| 83 | .It Fa n_addrtype | 76 | .It Fa n_addrtype |
| 84 | The type of the network number returned; currently only AF_INET. | 77 | The type of the network number returned; currently only |
| 78 | .Dv AF_INET . | ||
| 85 | .It Fa n_net | 79 | .It Fa n_net |
| 86 | The network number. Network numbers are returned in machine byte | 80 | The network number. |
| 87 | order. | 81 | Network numbers are returned in machine byte order. |
| 88 | .El | 82 | .El |
| 89 | .Pp | 83 | .Pp |
| 90 | The | 84 | The |
| 91 | .Fn getnetent | 85 | .Fn getnetent |
| 92 | function | 86 | function reads the next line of the file, opening the file if necessary. |
| 93 | reads the next line of the file, opening the file if necessary. | ||
| 94 | .Pp | 87 | .Pp |
| 95 | The | 88 | The |
| 96 | .Fn setnetent | 89 | .Fn setnetent |
| 97 | function | 90 | function opens and rewinds the file. |
| 98 | opens and rewinds the file. If the | 91 | If the |
| 99 | .Fa stayopen | 92 | .Fa stayopen |
| 100 | flag is non-zero, | 93 | flag is non-zero, |
| 101 | the net data base will not be closed after each call to | 94 | the net database will not be closed after each call to |
| 102 | .Fn getnetbyname | 95 | .Fn getnetbyname |
| 103 | or | 96 | or |
| 104 | .Fn getnetbyaddr . | 97 | .Fn getnetbyaddr . |
| 105 | .Pp | 98 | .Pp |
| 106 | The | 99 | The |
| 107 | .Fn endnetent | 100 | .Fn endnetent |
| 108 | function | 101 | function closes the file. |
| 109 | closes the file. | ||
| 110 | .Pp | 102 | .Pp |
| 111 | The | 103 | The |
| 112 | .Fn getnetbyname | 104 | .Fn getnetbyname |
| 113 | function | ||
| 114 | and | 105 | and |
| 115 | .Fn getnetbyaddr | 106 | .Fn getnetbyaddr |
| 116 | sequentially search from the beginning | 107 | functions search the domain name server if the system is configured to use one. |
| 117 | of the file until a matching | 108 | If the search fails, or no name server is configured, they sequentially |
| 118 | net name or | 109 | search from the beginning of the file until a matching net name or |
| 119 | net address and type is found, | 110 | net address and type is found, or until |
| 120 | or until | ||
| 121 | .Dv EOF | 111 | .Dv EOF |
| 122 | is encountered. | 112 | is encountered. |
| 123 | Network numbers are supplied in host order. | 113 | Network numbers are supplied in host order. |
| @@ -126,11 +116,11 @@ Network numbers are supplied in host order. | |||
| 126 | .It Pa /etc/networks | 116 | .It Pa /etc/networks |
| 127 | .El | 117 | .El |
| 128 | .Sh DIAGNOSTICS | 118 | .Sh DIAGNOSTICS |
| 129 | Null pointer | 119 | Null pointer (0) returned on |
| 130 | (0) returned on | ||
| 131 | .Dv EOF | 120 | .Dv EOF |
| 132 | or error. | 121 | or error. |
| 133 | .Sh SEE ALSO | 122 | .Sh SEE ALSO |
| 123 | .Xr resolver 3 , | ||
| 134 | .Xr networks 5 | 124 | .Xr networks 5 |
| 135 | .Sh HISTORY | 125 | .Sh HISTORY |
| 136 | The | 126 | The |
| @@ -140,14 +130,11 @@ The | |||
| 140 | .Fn setnetent , | 130 | .Fn setnetent , |
| 141 | and | 131 | and |
| 142 | .Fn endnetent | 132 | .Fn endnetent |
| 143 | functions appeared in | 133 | functions appeared in |
| 144 | .Bx 4.2 . | 134 | .Bx 4.2 . |
| 145 | .Sh BUGS | 135 | .Sh BUGS |
| 146 | The data space used by | 136 | The data space used by these functions is static; if future use |
| 147 | these functions is static; if future use requires the data, it should be | 137 | requires the data, it should be copied before any subsequent calls |
| 148 | copied before any subsequent calls to these functions overwrite it. | 138 | to these functions overwrite it. |
| 149 | Only Internet network | 139 | Only Internet network numbers are currently understood. |
| 150 | numbers are currently understood. | 140 | Expecting network numbers to fit in no more than 32 bits is naive. |
| 151 | Expecting network numbers to fit | ||
| 152 | in no more than 32 bits is probably | ||
| 153 | naive. | ||
