> > But there is the apropriate line in /etc/services... however the man
> > page for getservbyname() says that setservent(int) has to be callen
> > before getservbyname() which is used to determine the port
> > number. When I'm surrounding the getservbyname() call with
> > setservent(int) and endservent(), everything works fine. It looks
> > something like:
>
> Which platform is this? I noticed similar, but totaly clear,
> information in the Linux RedHat 6.2 man page. This is the first time
> I hear about the setservent() and endservent() functions. Do they
> exist on all platforms?
I re-read my 3.4R FreeBSD manual pages and the functions appeared
in 4.2BSD. The manual pages only state that the database files
(e.g. /etc/services) will stay open when setservent() was called
with a non-zero argument. They _do_not_ state that you
have to open the databse with setservent() when
using getservbyname().
> If anyone can verify this, I'll add it to the CVS repository. I find
> this very strange, as I know this have been working earlier.
According to the GNU C Library Reference Manual (2.00 beta)
one should use setservent() / endservent() when querying the
Services Database with getservent().
There is no reason to call the two functions when
using getservbyname() to retrieve records. Also Stevens in
his book 'UNIX Network Programming' didn't use the two
functions to surround getservbyname().
HTH
Martin
-- use Perl;-- Source code, list archive, and docs: http://www.mostang.com/sane/ To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com
This archive was generated by hypermail 2b29 : Tue Jun 06 2000 - 19:13:23 PDT