[PATCH] combine libbb/xgethostbyname*.c source files into one

Robert P. J. Day rpjday at mindspring.com
Mon Mar 27 12:12:35 UTC 2006


  (analogous to combining the create_icmp*_socket.c source files,
there seems to be little reason to have two separate source files for
these two functions.  i'm still not sure what variation of "diff" to
run to reflect deleted files -- is this the correct diff output?)


diff -pru busybox.orig/libbb/Makefile.in busybox/libbb/Makefile.in
--- busybox.orig/libbb/Makefile.in	2006-03-25 17:07:09.000000000 -0500
+++ busybox/libbb/Makefile.in	2006-03-27 07:08:43.000000000 -0500
@@ -29,7 +29,7 @@ LIBBB-y:= \
 	safe_strncpy.c setup_environment.c sha1.c simplify_path.c \
 	trim.c u_signal_names.c vdprintf.c verror_msg.c \
 	vherror_msg.c vperror_msg.c wfopen.c xconnect.c xgetcwd.c xstat.c \
-	xgethostbyname.c xgethostbyname2.c xreadlink.c xregcomp.c xgetlarg.c \
+	xgethostbyname.c xreadlink.c xregcomp.c xgetlarg.c \
 	get_terminal_width_height.c fclose_nonstdin.c fflush_stdout_and_exit.c \
 	getopt_ulflags.c default_error_retval.c wfopen_input.c speed_table.c \
 	perror_nomsg_and_die.c perror_nomsg.c skip_whitespace.c bb_askpass.c \
Only in busybox.orig/libbb: xgethostbyname2.c
diff -pru busybox.orig/libbb/xgethostbyname.c busybox/libbb/xgethostbyname.c
--- busybox.orig/libbb/xgethostbyname.c	2006-03-25 17:07:09.000000000 -0500
+++ busybox/libbb/xgethostbyname.c	2006-03-27 07:08:06.000000000 -0500
@@ -1,6 +1,6 @@
 /* vi: set sw=4 ts=4: */
 /*
- * Mini xgethostbyname implementation.
+ * Mini xgethostbyname and xgethostbyname2 implementations.
  *
  * Copyright (C) 2001 Matt Kraai <kraai at alumni.carnegiemellon.edu>.
  *
@@ -23,7 +23,6 @@
 #include <netdb.h>
 #include "libbb.h"

-
 struct hostent *xgethostbyname(const char *name)
 {
 	struct hostent *retval;
@@ -33,3 +32,15 @@ struct hostent *xgethostbyname(const cha

 	return retval;
 }
+
+#ifdef CONFIG_FEATURE_IPV6
+struct hostent *xgethostbyname2(const char *name, int af)
+{
+	struct hostent *retval;
+
+	if ((retval = gethostbyname2(name, af)) == NULL)
+		bb_herror_msg_and_die("%s", name);
+
+	return retval;
+}
+#endif

Signed off by:  Robert P. J. Day <rpjday at mindspring.com>




More information about the busybox mailing list