home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / programm / 4515 < prev    next >
Encoding:
Text File  |  1992-09-02  |  2.3 KB  |  57 lines

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