[comp.bugs.4bsd] getservent

gww@marduk.UUCP (Gary Winiger) (09/05/87)

Subject: getservent(3N) has undefined external reference. +Fix
Index:	libc/netinet/getservent.c 4.3BSD +Fix

Description:
	When calling getservent(3N) from libc on a machine where network
	and host byte order are the same, htons is an undefined external
	reference in libc.a.
Repeat-By:
	Call getservent on a machine without a libc/<machine>/netinet entry
	for htons.
Fix:
	Add the appropriate include file to define htons.
	The attached code resolves this problem at Elxsi.

Gary..
{ucbvax!sun,lll-lcc!lll-tis,amdahl!altos86,bridge2}!elxsi!gww
--------- cut --------- snip --------- :.,$w diff -------------
*** /tmp/,RCSt1013645	Thu Feb 26 19:50:04 1987
--- getservent.c	Thu Feb 26 19:49:27 1987
***************
*** 1,5 ****
--- 1,8 ----
  /*
   * $Log:	getservent.c,v $
+  * Revision 1.2  87/02/26  19:42:11  gww
+  * Add missing include file.
+  * 
   * Revision 1.1  87/01/13  15:52:34  gww
   * Initial revision
   * 
***************
*** 11,17 ****
   */
  
  #if defined(LIBC_SCCS) && !defined(lint)
! static char *ERcsId = "$Header: getservent.c,v 1.1 87/01/13 15:52:34 gww Exp $ ENIX BSD";
  static char sccsid[] = "@(#)getservent.c	5.3 (Berkeley) 5/19/86";
  #endif LIBC_SCCS and not lint
  
--- 14,20 ----
   */
  
  #if defined(LIBC_SCCS) && !defined(lint)
! static char *ERcsId = "$Header: getservent.c,v 1.2 87/02/26 19:42:11 gww Exp $ ENIX BSD";
  static char sccsid[] = "@(#)getservent.c	5.3 (Berkeley) 5/19/86";
  #endif LIBC_SCCS and not lint
  
***************
*** 20,25 ****
--- 23,29 ----
  #include <sys/socket.h>
  #include <netdb.h>
  #include <ctype.h>
+ #include <netinet/in.h>
  
  #define	MAXALIASES	35