home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / bsd / 5151 < prev    next >
Encoding:
Internet Message Format  |  1992-09-07  |  1.9 KB

  1. Xref: sparky comp.unix.bsd:5151 comp.protocols.tcp-ip:4311
  2. Newsgroups: comp.unix.bsd,comp.protocols.tcp-ip
  3. Path: sparky!uunet!cs.utexas.edu!hellgate.utah.edu!fcom.cc.utah.edu!cs.weber.edu!terry
  4. From: terry@cs.weber.edu (A Wizard of Earth C)
  5. Subject: Re: getnetmaskent()?
  6. Message-ID: <1992Sep5.005848.3022@fcom.cc.utah.edu>
  7. Sender: news@fcom.cc.utah.edu
  8. Organization: Weber State University  (Ogden, UT)
  9. References: <BOB.92Sep4120430@volitans.MorningStar.Com>
  10. Date: Sat, 5 Sep 92 00:58:48 GMT
  11. Lines: 32
  12.  
  13. In article <BOB.92Sep4120430@volitans.MorningStar.Com> bob@MorningStar.Com (Bob Sutterfield) writes:
  14. >BSD's getnetent() family of routines works with the contents of
  15. >/etc/networks.  Is there a similar getnetmaskent() family for the
  16. >information contained in /etc/netmasks?  I note that the Tahoe (or is
  17. >it Reno?) <netdb.h> has no mention of a subnet mask, nor of a file
  18. >where it might be found.
  19. >
  20. >Must I actually open() the file and parse it myself?  How barbaric! :-)
  21.  
  22. Actually, you need to look at the sources for ifconfig, which is capable
  23. of printing out the netmask.  The netmask is an artifact of the paramters
  24. to ifconfig initially, not an artifact of some attribute of your host
  25. address.  This is especially true if you are subnetting some class of
  26. subnet... for instance, 137.190.16.x as a subnet of the class B network
  27. 137.190.x.x.
  28.  
  29. One thing I generally do, but upon which you wouldn't be able to rely, is
  30. to make a /etc/hosts entry for the netmask based on the network name.  Then
  31. you can gethostent() it.
  32.  
  33.  
  34.                     Terry Lambert
  35.                     terry_lambert@gateway.novell.com
  36.                     terry@icarus.weber.edu
  37. ---
  38. Any opinions in this posting are my own and not those of my present
  39. or previous employers.
  40. -- 
  41. -------------------------------------------------------------------------------
  42.                                                        terry@icarus.weber.edu
  43.  "I have an 8 user poetic license" - me
  44. -------------------------------------------------------------------------------
  45.