home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.programmer
- Path: sparky!uunet!mcsun!Germany.EU.net!Urmel.Informatik.RWTH-Aachen.DE!physik.tu-muenchen.de!berg
- From: berg@physik.tu-muenchen.de (Stephen R. van den Berg)
- Subject: getservbyname(), getprotobyname(), gethostbyname()
- Message-ID: <1992Sep2.184623.3900@Urmel.Informatik.RWTH-Aachen.DE>
- Originator: berg@tabaqui
- Sender: news@Urmel.Informatik.RWTH-Aachen.DE (Newsfiles Owner)
- Nntp-Posting-Host: tabaqui
- Organization: Rechnerbetrieb Informatik / RWTH Aachen
- Date: Wed, 2 Sep 92 18:46:23 GMT
- Lines: 44
-
- I am reposting this question because the last time it seems to have been lost
- in the noise (I mistakenly posted it as a reply to some earlier question of
- mine).
-
- ------------------------
-
- It's me again, sorry, but these portability problems always seem to
- come in herds :-).
-
- Let me explain the problem here. I have this program (procmail) which is
- trying to double as a /bin/mail substitute. Now, the only thing that I yet
- have to mimick is the biff/comsat notification which /bin/mail normally does.
-
- Now, in order to that, I have to find out the following:
-
- 1. gethostbyname("localhost.or.something.else")
- 2. getservbyname("biff")
- 3. getprotobyname("udp")
-
- Well, so far so good, the only trouble is, these calls are done every time
- when mail arrives. I was wondering, what is common practice in this case?
-
- a. Go by the book and make all three calls at runtime?
- b. Do 1. and 2. at runtime, 3. at compile time?
- c. Do 1. at runtime, 2. and 3. at compile time?
- d. Do all three at compile time? (By compile-time I mean: compile
- a separate program that makes these calls, and then use the output
- from this program to hardcode the number(s) in the real program).
-
- I personally like a., but I might suspect some performance penalty here
- (depending on the configuration every one of these calls causes several files
- to be opened and miscellaneous network-traffic to be generated).
-
- As a reasonable compromise I suspect that b. is the most eligible, since
- the protocOl number for udp is not likely to change, is it?
-
- What would you consider acceptable practice?
-
- Thanks.
- --
- Sincerely, berg@pool.informatik.rwth-aachen.de
- Stephen R. van den Berg (AKA BuGless). berg@physik.tu-muenchen.de
-
- Real programmers don't just die, they produce core dumps.
-