diff options
Diffstat (limited to 'src/lib/libc/net/getservent.3')
| -rw-r--r-- | src/lib/libc/net/getservent.3 | 62 |
1 files changed, 23 insertions, 39 deletions
diff --git a/src/lib/libc/net/getservent.3 b/src/lib/libc/net/getservent.3 index 9e0656be00..85e0d65352 100644 --- a/src/lib/libc/net/getservent.3 +++ b/src/lib/libc/net/getservent.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $NetBSD: getservent.3,v 1.3 1995/02/25 06:20:38 cgd Exp $ | 1 | .\" $OpenBSD: getservent.3,v 1.11 2000/12/24 00:30:56 aaron 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. |
| @@ -31,11 +31,9 @@ | |||
| 31 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 31 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | .\" SUCH DAMAGE. | 32 | .\" SUCH DAMAGE. |
| 33 | .\" | 33 | .\" |
| 34 | .\" @(#)getservent.3 8.3 (Berkeley) 1/12/94 | ||
| 35 | .\" | ||
| 36 | .Dd January 12, 1994 | 34 | .Dd January 12, 1994 |
| 37 | .Dt GETSERVENT 3 | 35 | .Dt GETSERVENT 3 |
| 38 | .Os BSD 4.2 | 36 | .Os |
| 39 | .Sh NAME | 37 | .Sh NAME |
| 40 | .Nm getservent , | 38 | .Nm getservent , |
| 41 | .Nm getservbyport , | 39 | .Nm getservbyport , |
| @@ -46,26 +44,23 @@ | |||
| 46 | .Sh SYNOPSIS | 44 | .Sh SYNOPSIS |
| 47 | .Fd #include <netdb.h> | 45 | .Fd #include <netdb.h> |
| 48 | .Ft struct servent * | 46 | .Ft struct servent * |
| 49 | .Fn getservent | 47 | .Fn getservent "void" |
| 50 | .Ft struct servent * | 48 | .Ft struct servent * |
| 51 | .Fn getservbyname "char *name" "char *proto" | 49 | .Fn getservbyname "char *name" "char *proto" |
| 52 | .Ft struct servent * | 50 | .Ft struct servent * |
| 53 | .Fn getservbyport "int port" proto | 51 | .Fn getservbyport "int port" "char *proto" |
| 54 | .Ft void | 52 | .Ft void |
| 55 | .Fn setservent "int stayopen" | 53 | .Fn setservent "int stayopen" |
| 56 | .Ft void | 54 | .Ft void |
| 57 | .Fn endservent void | 55 | .Fn endservent "void" |
| 58 | .Sh DESCRIPTION | 56 | .Sh DESCRIPTION |
| 59 | The | 57 | The |
| 60 | .Fn getservent , | 58 | .Fn getservent , |
| 61 | .Fn getservbyname , | 59 | .Fn getservbyname , |
| 62 | and | 60 | and |
| 63 | .Fn getservbyport | 61 | .Fn getservbyport |
| 64 | functions | 62 | functions each return a pointer to an object with the following structure |
| 65 | each return a pointer to an object with the | 63 | containing the broken-out fields of a line in the network services database, |
| 66 | following structure | ||
| 67 | containing the broken-out | ||
| 68 | fields of a line in the network services data base, | ||
| 69 | .Pa /etc/services . | 64 | .Pa /etc/services . |
| 70 | .Bd -literal -offset indent | 65 | .Bd -literal -offset indent |
| 71 | struct servent { | 66 | struct servent { |
| @@ -81,59 +76,50 @@ The members of this structure are: | |||
| 81 | .It Fa s_name | 76 | .It Fa s_name |
| 82 | The official name of the service. | 77 | The official name of the service. |
| 83 | .It Fa s_aliases | 78 | .It Fa s_aliases |
| 84 | A zero terminated list of alternate names for the service. | 79 | A zero-terminated list of alternate names for the service. |
| 85 | .It Fa s_port | 80 | .It Fa s_port |
| 86 | The port number at which the service resides. | 81 | The port number at which the service resides. |
| 87 | Port numbers are returned in network byte order. | 82 | Port numbers are returned in network byte order. |
| 88 | .It Fa s_proto | 83 | .It Fa s_proto |
| 89 | The name of the protocol to use when contacting the | 84 | The name of the protocol to use when contacting the service. |
| 90 | service. | ||
| 91 | .El | 85 | .El |
| 92 | .Pp | 86 | .Pp |
| 93 | The | 87 | The |
| 94 | .Fn getservent | 88 | .Fn getservent |
| 95 | function | 89 | function reads the next line of the file, opening the file if necessary. |
| 96 | reads the next line of the file, opening the file if necessary. | ||
| 97 | .Pp | 90 | .Pp |
| 98 | The | 91 | The |
| 99 | .Fn setservent | 92 | .Fn setservent |
| 100 | function | 93 | function opens and rewinds the file. |
| 101 | opens and rewinds the file. If the | 94 | If the |
| 102 | .Fa stayopen | 95 | .Fa stayopen |
| 103 | flag is non-zero, | 96 | flag is non-zero, |
| 104 | the net data base will not be closed after each call to | 97 | the net database will not be closed after each call to |
| 105 | .Fn getservbyname | 98 | .Fn getservbyname |
| 106 | or | 99 | or |
| 107 | .Fn getservbyport . | 100 | .Fn getservbyport . |
| 108 | .Pp | 101 | .Pp |
| 109 | The | 102 | The |
| 110 | .Fn endservent | 103 | .Fn endservent |
| 111 | function | 104 | function closes the file. |
| 112 | closes the file. | ||
| 113 | .Pp | 105 | .Pp |
| 114 | The | 106 | The |
| 115 | .Fn getservbyname | 107 | .Fn getservbyname |
| 116 | and | 108 | and |
| 117 | .Fn getservbyport | 109 | .Fn getservbyport |
| 118 | functions | 110 | functions sequentially search from the beginning of the file until a |
| 119 | sequentially search from the beginning | 111 | matching protocol name or port number (specified in network byte order) |
| 120 | of the file until a matching | 112 | is found, or until |
| 121 | protocol name or | ||
| 122 | port number is found, | ||
| 123 | or until | ||
| 124 | .Dv EOF | 113 | .Dv EOF |
| 125 | is encountered. | 114 | is encountered. |
| 126 | If a protocol name is also supplied (non- | 115 | If a protocol name is also supplied (non-null), |
| 127 | .Dv NULL ) , | ||
| 128 | searches must also match the protocol. | 116 | searches must also match the protocol. |
| 129 | .ne 1i | ||
| 130 | .Sh FILES | 117 | .Sh FILES |
| 131 | .Bl -tag -width /etc/services -compact | 118 | .Bl -tag -width /etc/services -compact |
| 132 | .It Pa /etc/services | 119 | .It Pa /etc/services |
| 133 | .El | 120 | .El |
| 134 | .Sh DIAGNOSTICS | 121 | .Sh DIAGNOSTICS |
| 135 | Null pointer | 122 | Null pointer (0) returned on |
| 136 | (0) returned on | ||
| 137 | .Dv EOF | 123 | .Dv EOF |
| 138 | or error. | 124 | or error. |
| 139 | .Sh SEE ALSO | 125 | .Sh SEE ALSO |
| @@ -147,11 +133,9 @@ The | |||
| 147 | .Fn setservent , | 133 | .Fn setservent , |
| 148 | and | 134 | and |
| 149 | .Fn endservent | 135 | .Fn endservent |
| 150 | functions appeared in | 136 | functions appeared in |
| 151 | .Bx 4.2 . | 137 | .Bx 4.2 . |
| 152 | .Sh BUGS | 138 | .Sh BUGS |
| 153 | These functions use static data storage; | 139 | These functions use static data storage; if the data is needed for future use, |
| 154 | if the data is needed for future use, it should be | 140 | it should be copied before any subsequent calls overwrite it. |
| 155 | copied before any subsequent calls overwrite it. | 141 | Expecting port numbers to fit in a 32-bit quantity is probably naive. |
| 156 | Expecting port numbers to fit in a 32 bit | ||
| 157 | quantity is probably naive. | ||
