install C version of _doprnt
[unix-history] / usr / src / lib / libc / net / sethostent.c
index c546350..6888d10 100644 (file)
@@ -1,26 +1,35 @@
 /*
  * Copyright (c) 1985 Regents of the University of California.
 /*
  * Copyright (c) 1985 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and that due credit is given
+ * to the University of California at Berkeley. The name of the University
+ * may not be used to endorse or promote products derived from this
+ * software without specific prior written permission. This software
+ * is provided ``as is'' without express or implied warranty.
  */
 
  */
 
-#ifndef lint
-static char sccsid[] = "@(#)sethostent.c       1.2 (Berkeley) %G%";
-#endif not lint
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)sethostent.c       6.4 (Berkeley) %G%";
+#endif /* LIBC_SCCS and not lint */
 
 
-/*
- * These are dummy routines to allow old programs that used /etc/hosts
- * to compile and work with the BIND name server
- */
+#include <sys/types.h>
+#include <arpa/nameser.h>
+#include <netinet/in.h>
+#include <resolv.h>
 
 sethostent(stayopen)
 {
 
 sethostent(stayopen)
 {
-#ifdef lint
-stayopen = stayopen;
-#endif
+       if (stayopen)
+               _res.options |= RES_STAYOPEN | RES_USEVC;
 }
 
 }
 
-endhostent()   {}
+endhostent()
+{
+       _res.options &= ~(RES_STAYOPEN | RES_USEVC);
+       _res_close();
+}
 
 sethostfile(name)
 char *name;
 
 sethostfile(name)
 char *name;