OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [net/] [common/] [v2_0/] [doc/] [manpages/] [net/] [getservent.3] - Diff between revs 27 and 174

Only display areas with differences | Details | Blame | View Log

Rev 27 Rev 174
.\"     $OpenBSD: getservent.3,v 1.11 2000/12/24 00:30:56 aaron Exp $
.\"     $OpenBSD: getservent.3,v 1.11 2000/12/24 00:30:56 aaron Exp $
.\"
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" Copyright (c) 1983, 1991, 1993
.\"     The Regents of the University of California.  All rights reserved.
.\"     The Regents of the University of California.  All rights reserved.
.\"
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"    documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" 3. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"    must display the following acknowledgement:
.\"     This product includes software developed by the University of
.\"     This product includes software developed by the University of
.\"     California, Berkeley and its contributors.
.\"     California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" 4. Neither the name of the University nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"    without specific prior written permission.
.\"
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\" SUCH DAMAGE.
.\"
.\"
.Dd January 12, 1994
.Dd January 12, 1994
.Dt GETSERVENT 3
.Dt GETSERVENT 3
.Os
.Os
.Sh NAME
.Sh NAME
.Nm getservent ,
.Nm getservent ,
.Nm getservbyport ,
.Nm getservbyport ,
.Nm getservbyname ,
.Nm getservbyname ,
.Nm setservent ,
.Nm setservent ,
.Nm endservent
.Nm endservent
.Nd get service entry
.Nd get service entry
.Sh SYNOPSIS
.Sh SYNOPSIS
.Fd #include 
.Fd #include 
.Ft struct servent *
.Ft struct servent *
.Fn getservent "void"
.Fn getservent "void"
.Ft struct servent *
.Ft struct servent *
.Fn getservbyname "char *name" "char *proto"
.Fn getservbyname "char *name" "char *proto"
.Ft struct servent *
.Ft struct servent *
.Fn getservbyport "int port" "char *proto"
.Fn getservbyport "int port" "char *proto"
.Ft void
.Ft void
.Fn setservent "int stayopen"
.Fn setservent "int stayopen"
.Ft void
.Ft void
.Fn endservent "void"
.Fn endservent "void"
.Sh DESCRIPTION
.Sh DESCRIPTION
The
The
.Fn getservent ,
.Fn getservent ,
.Fn getservbyname ,
.Fn getservbyname ,
and
and
.Fn getservbyport
.Fn getservbyport
functions each return a pointer to an object with the following structure
functions each return a pointer to an object with the following structure
containing the broken-out fields of a line in the network services database,
containing the broken-out fields of a line in the network services database,
.Pa /etc/services .
.Pa /etc/services .
.Bd -literal -offset indent
.Bd -literal -offset indent
struct  servent {
struct  servent {
        char    *s_name;        /* official name of service */
        char    *s_name;        /* official name of service */
        char    **s_aliases;    /* alias list */
        char    **s_aliases;    /* alias list */
        int     s_port;         /* port service resides at */
        int     s_port;         /* port service resides at */
        char    *s_proto;       /* protocol to use */
        char    *s_proto;       /* protocol to use */
};
};
.Ed
.Ed
.Pp
.Pp
The members of this structure are:
The members of this structure are:
.Bl -tag -width s_aliases
.Bl -tag -width s_aliases
.It Fa s_name
.It Fa s_name
The official name of the service.
The official name of the service.
.It Fa s_aliases
.It Fa s_aliases
A zero-terminated list of alternate names for the service.
A zero-terminated list of alternate names for the service.
.It Fa s_port
.It Fa s_port
The port number at which the service resides.
The port number at which the service resides.
Port numbers are returned in network byte order.
Port numbers are returned in network byte order.
.It Fa s_proto
.It Fa s_proto
The name of the protocol to use when contacting the service.
The name of the protocol to use when contacting the service.
.El
.El
.Pp
.Pp
The
The
.Fn getservent
.Fn getservent
function reads the next line of the file, opening the file if necessary.
function reads the next line of the file, opening the file if necessary.
.Pp
.Pp
The
The
.Fn setservent
.Fn setservent
function opens and rewinds the file.
function opens and rewinds the file.
If the
If the
.Fa stayopen
.Fa stayopen
flag is non-zero,
flag is non-zero,
the net database will not be closed after each call to
the net database will not be closed after each call to
.Fn getservbyname
.Fn getservbyname
or
or
.Fn getservbyport .
.Fn getservbyport .
.Pp
.Pp
The
The
.Fn endservent
.Fn endservent
function closes the file.
function closes the file.
.Pp
.Pp
The
The
.Fn getservbyname
.Fn getservbyname
and
and
.Fn getservbyport
.Fn getservbyport
functions sequentially search from the beginning of the file until a
functions sequentially search from the beginning of the file until a
matching protocol name or port number (specified in network byte order)
matching protocol name or port number (specified in network byte order)
is found, or until
is found, or until
.Dv EOF
.Dv EOF
is encountered.
is encountered.
If a protocol name is also supplied (non-null),
If a protocol name is also supplied (non-null),
searches must also match the protocol.
searches must also match the protocol.
.Sh FILES
.Sh FILES
.Bl -tag -width /etc/services -compact
.Bl -tag -width /etc/services -compact
.It Pa /etc/services
.It Pa /etc/services
.El
.El
.Sh DIAGNOSTICS
.Sh DIAGNOSTICS
Null pointer (0) returned on
Null pointer (0) returned on
.Dv EOF
.Dv EOF
or error.
or error.
.Sh SEE ALSO
.Sh SEE ALSO
.Xr getprotoent 3 ,
.Xr getprotoent 3 ,
.Xr services 5
.Xr services 5
.Sh HISTORY
.Sh HISTORY
The
The
.Fn getservent ,
.Fn getservent ,
.Fn getservbyport ,
.Fn getservbyport ,
.Fn getservbyname ,
.Fn getservbyname ,
.Fn setservent ,
.Fn setservent ,
and
and
.Fn endservent
.Fn endservent
functions appeared in
functions appeared in
.Bx 4.2 .
.Bx 4.2 .
.Sh BUGS
.Sh BUGS
These functions use static data storage; if the data is needed for future use,
These functions use static data storage; if the data is needed for future use,
it should be copied before any subsequent calls overwrite it.
it should be copied before any subsequent calls overwrite it.
Expecting port numbers to fit in a 32-bit quantity is probably naive.
Expecting port numbers to fit in a 32-bit quantity is probably naive.
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.