getservent.3
来自「minix操作系统最新版本(3.1.1)的源代码」· 3 代码 · 共 113 行
3
113 行
.\" Copyright (c) 1983 Regents of the University of California..\" All rights reserved. The Berkeley software License Agreement.\" specifies the terms and conditions for redistribution..\".\" @(#)getservent.3n 6.3 (Berkeley) 5/19/86.\".TH GETSERVENT 3 "May 19, 1986".UC 5.SH NAMEgetservent, getservbyport, getservbyname, setservent, endservent \- get service entry.SH SYNOPSIS.nf.ft B#include <netdb.h>.PP.ft Bstruct servent *getservent().PP.ft Bstruct servent *getservbyname(name, proto)char *name, *proto;.PP.ft Bstruct servent *getservbyport(port, proto)int port; char *proto;.PP.ft Bsetservent(stayopen)int stayopen.PP.ft Bendservent().fi.SH DESCRIPTION.IR Getservent ,.IR getservbyname ,and.I getservbyporteach return a pointer to an object with thefollowing structurecontaining the broken-outfields of a line in the network services data base,.IR /etc/services ..RS.PP.nfstruct servent { char *s_name; /* official name of service */ char **s_aliases; /* alias list */ int s_port; /* port service resides at */ char *s_proto; /* protocol to use */};.ft R.ad.fi.RE.PPThe members of this structure are:.TP \w's_aliases'u+2ns_nameThe official name of the service..TP \w's_aliases'u+2ns_aliasesA zero terminated list of alternate names for the service..TP \w's_aliases'u+2ns_portThe port number at which the service resides.Port numbers are returned in network byte order..TP \w's_aliases'u+2ns_protoThe name of the protocol to use when contacting theservice..PP.I Getserventreads the next line of the file, opening the file if necessary..PP.I Setserventopens and rewinds the file. If the.I stayopenflag is non-zero,the net data base will not be closed after each call to .I getservbynameor.IR getservbyport ..PP.I Endserventcloses the file..PP.I Getservbynameand.I getservbyportsequentially search from the beginningof the file until a matchingprotocol name orport number is found,or until EOF is encountered.If a protocol name is also supplied (non-NULL),searches must also match the protocol..SH FILES/etc/services.SH "SEE ALSO"getprotoent(3), services(5).SH DIAGNOSTICSNull pointer(0) returned on EOF or error..SH BUGSAll informationis contained in a static areaso it must be copied if it isto be saved. Expecting portnumbers to fit in a 32 bitquantity is probably naive.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?