diff options
| author | cvs2svn <admin@example.com> | 2012-07-13 17:49:56 +0000 |
|---|---|---|
| committer | cvs2svn <admin@example.com> | 2012-07-13 17:49:56 +0000 |
| commit | ee04221ea8063435416c7e6369e6eae76843aa71 (patch) | |
| tree | 821921a1dd0a5a3cece91121e121cc63c4b68128 /src/lib/libc/net/getservent.3 | |
| parent | adf6731f6e1d04718aee00cb93435143046aee9a (diff) | |
| download | openbsd-eric_g2k12.tar.gz openbsd-eric_g2k12.tar.bz2 openbsd-eric_g2k12.zip | |
This commit was manufactured by cvs2git to create tag 'eric_g2k12'.eric_g2k12
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libc/net/getservent.3 | 220 |
1 files changed, 0 insertions, 220 deletions
diff --git a/src/lib/libc/net/getservent.3 b/src/lib/libc/net/getservent.3 deleted file mode 100644 index 7888b5f1b8..0000000000 --- a/src/lib/libc/net/getservent.3 +++ /dev/null | |||
| @@ -1,220 +0,0 @@ | |||
| 1 | .\" $OpenBSD: getservent.3,v 1.20 2007/05/31 19:19:30 jmc Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 1983, 1991, 1993 | ||
| 4 | .\" The Regents of the University of California. All rights reserved. | ||
| 5 | .\" | ||
| 6 | .\" Redistribution and use in source and binary forms, with or without | ||
| 7 | .\" modification, are permitted provided that the following conditions | ||
| 8 | .\" are met: | ||
| 9 | .\" 1. Redistributions of source code must retain the above copyright | ||
| 10 | .\" notice, this list of conditions and the following disclaimer. | ||
| 11 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
| 12 | .\" notice, this list of conditions and the following disclaimer in the | ||
| 13 | .\" documentation and/or other materials provided with the distribution. | ||
| 14 | .\" 3. Neither the name of the University nor the names of its contributors | ||
| 15 | .\" may be used to endorse or promote products derived from this software | ||
| 16 | .\" without specific prior written permission. | ||
| 17 | .\" | ||
| 18 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||
| 19 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 20 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 21 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
| 22 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 23 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 24 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 25 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 26 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 27 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 28 | .\" SUCH DAMAGE. | ||
| 29 | .\" | ||
| 30 | .Dd $Mdocdate: May 31 2007 $ | ||
| 31 | .Dt GETSERVENT 3 | ||
| 32 | .Os | ||
| 33 | .Sh NAME | ||
| 34 | .Nm getservent , | ||
| 35 | .Nm getservent_r , | ||
| 36 | .Nm getservbyport , | ||
| 37 | .Nm getservbyport_r , | ||
| 38 | .Nm getservbyname , | ||
| 39 | .Nm getservbyname_r , | ||
| 40 | .Nm setservent , | ||
| 41 | .Nm setservent_r , | ||
| 42 | .Nm endservent , | ||
| 43 | .Nm endservent_r | ||
| 44 | .Nd get service entry | ||
| 45 | .Sh SYNOPSIS | ||
| 46 | .Fd #include <netdb.h> | ||
| 47 | .Ft struct servent * | ||
| 48 | .Fn getservent "void" | ||
| 49 | .Ft int | ||
| 50 | .Fn getservent_r "struct servent *servent" "struct servent_data *servent_data" | ||
| 51 | .Ft struct servent * | ||
| 52 | .Fn getservbyname "const char *name" "const char *proto" | ||
| 53 | .Ft int | ||
| 54 | .Fn getservbyname_r "const char *name" "const char *proto" "struct servent *servent" "struct servent_data *servent_data" | ||
| 55 | .Ft struct servent * | ||
| 56 | .Fn getservbyport "int port" "const char *proto" | ||
| 57 | .Ft int | ||
| 58 | .Fn getservbyport_r "int port" "const char *proto" "struct servent *servent" "struct servent_data *servent_data" | ||
| 59 | .Ft void | ||
| 60 | .Fn setservent "int stayopen" | ||
| 61 | .Ft void | ||
| 62 | .Fn setservent_r "int stayopen" "struct servent_data *servent_data" | ||
| 63 | .Ft void | ||
| 64 | .Fn endservent "void" | ||
| 65 | .Ft void | ||
| 66 | .Fn endservent_r "struct servent_data *servent_data" | ||
| 67 | .Sh DESCRIPTION | ||
| 68 | The | ||
| 69 | .Fn getservent , | ||
| 70 | .Fn getservbyname , | ||
| 71 | and | ||
| 72 | .Fn getservbyport | ||
| 73 | functions each return a pointer to an object with the following structure | ||
| 74 | containing the broken-out fields of a line in the network services database, | ||
| 75 | .Pa /etc/services . | ||
| 76 | .Bd -literal -offset indent | ||
| 77 | struct servent { | ||
| 78 | char *s_name; /* official name of service */ | ||
| 79 | char **s_aliases; /* alias list */ | ||
| 80 | int s_port; /* port service resides at */ | ||
| 81 | char *s_proto; /* protocol to use */ | ||
| 82 | }; | ||
| 83 | .Ed | ||
| 84 | .Pp | ||
| 85 | The members of this structure are: | ||
| 86 | .Bl -tag -width s_aliases | ||
| 87 | .It Fa s_name | ||
| 88 | The official name of the service. | ||
| 89 | .It Fa s_aliases | ||
| 90 | A null-terminated list of alternate names for the service. | ||
| 91 | .It Fa s_port | ||
| 92 | The port number at which the service resides. | ||
| 93 | Port numbers are returned in network byte order. | ||
| 94 | .It Fa s_proto | ||
| 95 | The name of the protocol to use when contacting the service. | ||
| 96 | .El | ||
| 97 | .Pp | ||
| 98 | The | ||
| 99 | .Fn getservent | ||
| 100 | function reads the next line of the file, opening the file if necessary. | ||
| 101 | .Pp | ||
| 102 | The | ||
| 103 | .Fn setservent | ||
| 104 | function opens and rewinds the file. | ||
| 105 | If the | ||
| 106 | .Fa stayopen | ||
| 107 | flag is non-zero, | ||
| 108 | the services database will not be closed after each call to | ||
| 109 | .Fn getservbyname | ||
| 110 | or | ||
| 111 | .Fn getservbyport . | ||
| 112 | .Pp | ||
| 113 | The | ||
| 114 | .Fn endservent | ||
| 115 | function closes the file. | ||
| 116 | .Pp | ||
| 117 | The | ||
| 118 | .Fn getservbyname | ||
| 119 | and | ||
| 120 | .Fn getservbyport | ||
| 121 | functions sequentially search from the beginning of the file until a | ||
| 122 | matching protocol name or port number (specified in network byte order) | ||
| 123 | is found, or until | ||
| 124 | .Dv EOF | ||
| 125 | is encountered. | ||
| 126 | If a protocol name is also supplied (non-null), | ||
| 127 | searches must also match the protocol. | ||
| 128 | .Pp | ||
| 129 | The | ||
| 130 | .Fn getservent_r , | ||
| 131 | .Fn getservbyport_r , | ||
| 132 | .Fn getservbyname_r , | ||
| 133 | .Fn setservent_r , | ||
| 134 | and | ||
| 135 | .Fn endservent_r | ||
| 136 | functions are reentrant versions of the above functions that take a | ||
| 137 | pointer to a | ||
| 138 | .Fa servent_data | ||
| 139 | structure which is used to store state information. | ||
| 140 | The structure must be zero-filled before it is used | ||
| 141 | and should be considered opaque for the sake of portability. | ||
| 142 | .Pp | ||
| 143 | The | ||
| 144 | .Fn getservent_r , | ||
| 145 | .Fn getservbyport_r , | ||
| 146 | and | ||
| 147 | .Fn getservbyname_r | ||
| 148 | functions | ||
| 149 | also take a pointer to a | ||
| 150 | .Fa servent | ||
| 151 | structure which is used to store the results of the database lookup. | ||
| 152 | .Sh RETURN VALUES | ||
| 153 | The | ||
| 154 | .Fn getservent , | ||
| 155 | .Fn getservbyport , | ||
| 156 | and | ||
| 157 | .Fn getservbyname | ||
| 158 | functions return a pointer to a | ||
| 159 | .Fa servent | ||
| 160 | structure on success or a null pointer if end-of-file | ||
| 161 | is reached or an error occurs. | ||
| 162 | .Pp | ||
| 163 | The | ||
| 164 | .Fn getservent_r , | ||
| 165 | .Fn getservbyport_r , | ||
| 166 | and | ||
| 167 | .Fn getservbyname_r | ||
| 168 | functions return 0 on success or \-1 if end-of-file | ||
| 169 | is reached or an error occurs. | ||
| 170 | .Sh FILES | ||
| 171 | .Bl -tag -width /etc/services -compact | ||
| 172 | .It Pa /etc/services | ||
| 173 | .El | ||
| 174 | .Sh SEE ALSO | ||
| 175 | .Xr getprotoent 3 , | ||
| 176 | .Xr services 5 | ||
| 177 | .Sh STANDARDS | ||
| 178 | The | ||
| 179 | .Fn getservent , | ||
| 180 | .Fn getservbynumber , | ||
| 181 | .Fn getservbyname , | ||
| 182 | .Fn setservent , | ||
| 183 | and | ||
| 184 | .Fn endservent | ||
| 185 | functions conform to | ||
| 186 | .St -p1003.1-2004 . | ||
| 187 | .Pp | ||
| 188 | The | ||
| 189 | .Fn getservent_r , | ||
| 190 | .Fn getservbyport_r , | ||
| 191 | .Fn getservbyname_r , | ||
| 192 | .Fn setservent_r , | ||
| 193 | and | ||
| 194 | .Fn endservent_r | ||
| 195 | functions are not currently standardized. | ||
| 196 | This implementation follows the API used by HP, IBM, and Digital. | ||
| 197 | .Sh HISTORY | ||
| 198 | The | ||
| 199 | .Fn getservent , | ||
| 200 | .Fn getservbyport , | ||
| 201 | .Fn getservbyname , | ||
| 202 | .Fn setservent , | ||
| 203 | and | ||
| 204 | .Fn endservent | ||
| 205 | functions appeared in | ||
| 206 | .Bx 4.2 . | ||
| 207 | .Pp | ||
| 208 | The | ||
| 209 | .Fn getservent_r , | ||
| 210 | .Fn getservbyport_r , | ||
| 211 | .Fn getservbyname_r , | ||
| 212 | .Fn setservent_r , | ||
| 213 | and | ||
| 214 | .Fn endservent_r | ||
| 215 | functions appeared in | ||
| 216 | .Ox 3.7 . | ||
| 217 | .Sh BUGS | ||
| 218 | The non-reentrant functions use static data storage; if the data is needed | ||
| 219 | for future use, it should be copied before any subsequent calls overwrite it. | ||
| 220 | Expecting port numbers to fit in a 32-bit quantity is probably naive. | ||
