From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: From: Robert Schwebel Date: Sun, 30 Oct 2011 23:00:39 +0100 Message-Id: <1320012059-24971-8-git-send-email-r.schwebel@pengutronix.de> In-Reply-To: <1320012059-24971-1-git-send-email-r.schwebel@pengutronix.de> References: <20111030220011.GK14918@pengutronix.de> <1320012059-24971-1-git-send-email-r.schwebel@pengutronix.de> Subject: [ptxdist] [PATCH 08/28] bing: clean up patches Reply-To: ptxdist@pengutronix.de List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: ptxdist-bounces@pengutronix.de Errors-To: ptxdist-bounces@pengutronix.de To: ptxdist@pengutronix.de Cc: Robert Schwebel Signed-off-by: Robert Schwebel --- ...pt-makefile-for-Linux-add-destdir-support.patch | 66 +++++++++++ .../bing_src-1.1.3/0002-bing_1.1.3-2.diff.patch | 121 ++++++++++++++++++++ .../bing_src-1.1.3/adapt_makefile_for_linux.diff | 64 ---------- patches/bing_src-1.1.3/bing_1.1.3-2.diff | 109 ------------------ patches/bing_src-1.1.3/series | 2 - 5 files changed, 187 insertions(+), 175 deletions(-) create mode 100644 patches/bing_src-1.1.3/0001-Adapt-makefile-for-Linux-add-destdir-support.patch create mode 100644 patches/bing_src-1.1.3/0002-bing_1.1.3-2.diff.patch delete mode 100644 patches/bing_src-1.1.3/adapt_makefile_for_linux.diff delete mode 100644 patches/bing_src-1.1.3/bing_1.1.3-2.diff delete mode 100644 patches/bing_src-1.1.3/series diff --git a/patches/bing_src-1.1.3/0001-Adapt-makefile-for-Linux-add-destdir-support.patch b/patches/bing_src-1.1.3/0001-Adapt-makefile-for-Linux-add-destdir-support.patch new file mode 100644 index 0000000..745704f --- /dev/null +++ b/patches/bing_src-1.1.3/0001-Adapt-makefile-for-Linux-add-destdir-support.patch @@ -0,0 +1,66 @@ +From 46a7925ba445f1e92dfb467bd714073ea5c1459f Mon Sep 17 00:00:00 2001 +From: Marc Kleine-Budde +Date: Sat, 29 Oct 2011 18:55:06 +0200 +Subject: [PATCH 1/2] Adapt makefile for Linux, add destdir support + +Signed-off-by: Wolfram Sang +Signed-off-by: Marc Kleine-Budde +--- + Makefile | 16 ++++++++-------- + 1 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/Makefile b/Makefile +index 0964851..4281cb4 100644 +--- a/Makefile ++++ b/Makefile +@@ -9,9 +9,9 @@ + # + ########## + +-BINDIR=/usr/local/bin +-MANDIR=/usr/local/man +- ++PREFIX ?= /usr ++BINDIR = $(PREFIX)/sbin ++MANDIR = $(PREFIX)/man + + ########## + # +@@ -21,7 +21,7 @@ MANDIR=/usr/local/man + + # Uncomment if you need the 4.4 BSD compatibility includes. + # -> required on Linux (and Win32) +-#COMPAT_INCS = -Iinclude ++COMPAT_INCS = -Iinclude + + # Maybe specify some specific compatibility options + # -> on AIX activate the BSD mode +@@ -37,7 +37,7 @@ MANDIR=/usr/local/man + + # Define to use srandom/random rather than srand/rand + # -> required on SunOS 4.1.3, SunOS 5, AIX 2 (BOSX 2 really), OSF1 V2.0 +-NO_SNPRINTF = -DNO_SNPRINTF=1 ++#NO_SNPRINTF = -DNO_SNPRINTF=1 + + # Define if you lack strerror() + #NO_STRERROR = -DNO_STRERROR=1 +@@ -47,7 +47,7 @@ NO_SNPRINTF = -DNO_SNPRINTF=1 + # -> if you want to debug bing define + #COPTIM = -g + # -> on Linux, SunOS 4 and OSF1 V2.0 you may specify +-#COPTIM = -O2 ++COPTIM = -O2 + # -> on Solaris you may use + #COPTIM = -O + # on some hosts like AIX, HP-UX the optimisation options are already set +@@ -109,5 +109,5 @@ clean: + $(RM) -f bing bing.ps bing.0 $(OBJS) + + install: bing unix/bing.8 +- $(INSTALL) -m 644 -o man -g man unix/bing.8 $(MANDIR)/man8 +- $(INSTALL) -m 4555 -o root -g staff bing $(BINDIR) ++ $(INSTALL) -m 644 unix/bing.8 $(DESTDIR)$(MANDIR)/man8 ++ $(INSTALL) -m 4555 -o root bing $(DESTDIR)$(BINDIR) +-- +1.7.7 + diff --git a/patches/bing_src-1.1.3/0002-bing_1.1.3-2.diff.patch b/patches/bing_src-1.1.3/0002-bing_1.1.3-2.diff.patch new file mode 100644 index 0000000..5ccd6d5 --- /dev/null +++ b/patches/bing_src-1.1.3/0002-bing_1.1.3-2.diff.patch @@ -0,0 +1,121 @@ +From 6e62471f30d379a9592ed2e68c65b5a468191bce Mon Sep 17 00:00:00 2001 +From: unknown author +Date: Sat, 29 Oct 2011 18:55:06 +0200 +Subject: [PATCH 2/2] bing_1.1.3-2.diff + +Signed-off-by: Marc Kleine-Budde +--- + bing.c | 63 ++++++++++++++++++++++++++++++--------------------------------- + 1 files changed, 30 insertions(+), 33 deletions(-) + +diff --git a/bing.c b/bing.c +index aa078f9..e1094e9 100644 +--- a/bing.c ++++ b/bing.c +@@ -104,7 +104,9 @@ static char rcsid[] = "$Id: bing.c,v 1.17 1997/01/23 21:00:03 pb Exp $"; + #include + + /* More specific includes/declarations */ ++#ifndef __GNU__ + #include ++#endif /* __GNU__ */ + #include + #include + #include +@@ -152,7 +154,9 @@ char* __progname; + * standard libraries. + */ + #include ++#ifndef __GNU__ + #include ++#endif /* __GNU__ */ + #include + + #include "mod_icmp.h" +@@ -320,9 +324,7 @@ struct timestats { + + struct hoststats { + /* Host info */ +- char hnamebuf[MAXHOSTNAMELEN]; + char *hostname; +- struct sockaddr_in whereto; + struct sockaddr_in *to; + struct timestats *ts; + }; +@@ -365,28 +367,19 @@ void set_ip(hs, target) + struct hoststats *hs; + char *target; + { +- struct hostent *hp; ++ struct addrinfo hints, *ai; ++ int r; + +- hs->to = &hs->whereto; +- +- memset((char *)hs->to, 0, sizeof(struct sockaddr_in)); +- hs->to->sin_family = AF_INET; +- hs->to->sin_addr.s_addr = inet_addr(target); +- if (hs->to->sin_addr.s_addr != (u_int)-1) +- hs->hostname = target; +- else { +- hp = gethostbyname(target); +- if (!hp) { +- (void)fprintf(stderr, +- "bing: unknown host %s\n", target); +- exit(1); +- } +- hs->to->sin_family = hp->h_addrtype; +- memcpy((caddr_t)&hs->to->sin_addr, hp->h_addr, hp->h_length); +- strncpy(hs->hnamebuf, hp->h_name, sizeof(hs->hnamebuf) - 1); +- hs->hnamebuf[sizeof(hs->hnamebuf)-1] = '\0'; +- hs->hostname = hs->hnamebuf; ++ memset(&hints, 0, sizeof hints); ++ hints.ai_family = AF_INET; ++ hints.ai_flags = AI_CANONNAME; ++ if((r = getaddrinfo(target, NULL, &hints, &ai))) { ++ fprintf(stderr, "bing: couldn't resolve %s: %s\n", ++ target, gai_strerror(r)); ++ exit(1); + } ++ hs->to = (struct sockaddr_in *) ai->ai_addr; ++ hs->hostname = ai->ai_canonname; + } + + void randomfill(bp, len, seed) +@@ -677,18 +670,22 @@ char * + pr_addr(l) + u_long l; + { +- struct hostent *hp; +- static char buf[80]; ++ static char buf[MAXHOSTNAMELEN+19]; ++ struct sockaddr_in sa; ++ int r; + +- if ((options & F_NUMERIC) || +- !(hp = gethostbyaddr((char *)&l, 4, AF_INET))) +- (void)snprintf(snfargs(buf, sizeof(buf), "%s"), +- inet_ntoa(*(struct in_addr *)&l)); +- else +- (void)snprintf(snfargs(buf, sizeof(buf), "%s (%s)"), +- hp->h_name, +- inet_ntoa(*(struct in_addr *)&l)); +- return(buf); ++ sa.sin_family = AF_INET; ++ sa.sin_port = 0; ++ memcpy(&sa.sin_addr, &l, sizeof l); ++ ++ r = getnameinfo((struct sockaddr *) &sa, sizeof sa, buf, sizeof buf, ++ NULL, 0, (options & F_NUMERIC) ? NI_NUMERICHOST : 0); ++ if(r) { ++ fprintf(stderr, "bing: getaddrinfo: %s\n", gai_strerror(r)); ++ exit(1); ++ } ++ ++ return buf; + } + + /* +-- +1.7.7 + diff --git a/patches/bing_src-1.1.3/adapt_makefile_for_linux.diff b/patches/bing_src-1.1.3/adapt_makefile_for_linux.diff deleted file mode 100644 index cb25b4b..0000000 --- a/patches/bing_src-1.1.3/adapt_makefile_for_linux.diff +++ /dev/null @@ -1,64 +0,0 @@ -From: Wolfram Sang -From: Marc Kleine-Budde -Subject: Adapt makefile for Linux, add destdir support - -Signed-off-by: Wolfram Sang -Signed-off-by: Marc Kleine-Budde ---- -# 20081124: wsa: there is no upstream anymore :( - - Makefile | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - -Index: Makefile -=================================================================== ---- Makefile.orig -+++ Makefile -@@ -9,9 +9,9 @@ - # - ########## - --BINDIR=/usr/local/bin --MANDIR=/usr/local/man -- -+PREFIX ?= /usr -+BINDIR = $(PREFIX)/sbin -+MANDIR = $(PREFIX)/man - - ########## - # -@@ -21,7 +21,7 @@ MANDIR=/usr/local/man - - # Uncomment if you need the 4.4 BSD compatibility includes. - # -> required on Linux (and Win32) --#COMPAT_INCS = -Iinclude -+COMPAT_INCS = -Iinclude - - # Maybe specify some specific compatibility options - # -> on AIX activate the BSD mode -@@ -37,7 +37,7 @@ MANDIR=/usr/local/man - - # Define to use srandom/random rather than srand/rand - # -> required on SunOS 4.1.3, SunOS 5, AIX 2 (BOSX 2 really), OSF1 V2.0 --NO_SNPRINTF = -DNO_SNPRINTF=1 -+#NO_SNPRINTF = -DNO_SNPRINTF=1 - - # Define if you lack strerror() - #NO_STRERROR = -DNO_STRERROR=1 -@@ -47,7 +47,7 @@ NO_SNPRINTF = -DNO_SNPRINTF=1 - # -> if you want to debug bing define - #COPTIM = -g - # -> on Linux, SunOS 4 and OSF1 V2.0 you may specify --#COPTIM = -O2 -+COPTIM = -O2 - # -> on Solaris you may use - #COPTIM = -O - # on some hosts like AIX, HP-UX the optimisation options are already set -@@ -109,5 +109,5 @@ clean: - $(RM) -f bing bing.ps bing.0 $(OBJS) - - install: bing unix/bing.8 -- $(INSTALL) -m 644 -o man -g man unix/bing.8 $(MANDIR)/man8 -- $(INSTALL) -m 4555 -o root -g staff bing $(BINDIR) -+ $(INSTALL) -m 644 unix/bing.8 $(DESTDIR)$(MANDIR)/man8 -+ $(INSTALL) -m 4555 -o root bing $(DESTDIR)$(BINDIR) diff --git a/patches/bing_src-1.1.3/bing_1.1.3-2.diff b/patches/bing_src-1.1.3/bing_1.1.3-2.diff deleted file mode 100644 index 3e50174..0000000 --- a/patches/bing_src-1.1.3/bing_1.1.3-2.diff +++ /dev/null @@ -1,109 +0,0 @@ -From: http://ftp.de.debian.org/debian/pool/main/b/bing/bing_1.1.3-2.diff.gz - -Signed-off-by: Marc Kleine-Budde ---- bing-1.1.3.orig/bing.c -+++ bing-1.1.3/bing.c -@@ -104,7 +104,9 @@ - #include - - /* More specific includes/declarations */ -+#ifndef __GNU__ - #include -+#endif /* __GNU__ */ - #include - #include - #include -@@ -152,7 +154,9 @@ - * standard libraries. - */ - #include -+#ifndef __GNU__ - #include -+#endif /* __GNU__ */ - #include - - #include "mod_icmp.h" -@@ -320,9 +324,7 @@ - - struct hoststats { - /* Host info */ -- char hnamebuf[MAXHOSTNAMELEN]; - char *hostname; -- struct sockaddr_in whereto; - struct sockaddr_in *to; - struct timestats *ts; - }; -@@ -365,28 +367,19 @@ - struct hoststats *hs; - char *target; - { -- struct hostent *hp; -+ struct addrinfo hints, *ai; -+ int r; - -- hs->to = &hs->whereto; -- -- memset((char *)hs->to, 0, sizeof(struct sockaddr_in)); -- hs->to->sin_family = AF_INET; -- hs->to->sin_addr.s_addr = inet_addr(target); -- if (hs->to->sin_addr.s_addr != (u_int)-1) -- hs->hostname = target; -- else { -- hp = gethostbyname(target); -- if (!hp) { -- (void)fprintf(stderr, -- "bing: unknown host %s\n", target); -- exit(1); -- } -- hs->to->sin_family = hp->h_addrtype; -- memcpy((caddr_t)&hs->to->sin_addr, hp->h_addr, hp->h_length); -- strncpy(hs->hnamebuf, hp->h_name, sizeof(hs->hnamebuf) - 1); -- hs->hnamebuf[sizeof(hs->hnamebuf)-1] = '\0'; -- hs->hostname = hs->hnamebuf; -+ memset(&hints, 0, sizeof hints); -+ hints.ai_family = AF_INET; -+ hints.ai_flags = AI_CANONNAME; -+ if((r = getaddrinfo(target, NULL, &hints, &ai))) { -+ fprintf(stderr, "bing: couldn't resolve %s: %s\n", -+ target, gai_strerror(r)); -+ exit(1); - } -+ hs->to = (struct sockaddr_in *) ai->ai_addr; -+ hs->hostname = ai->ai_canonname; - } - - void randomfill(bp, len, seed) -@@ -677,18 +670,22 @@ - pr_addr(l) - u_long l; - { -- struct hostent *hp; -- static char buf[80]; -+ static char buf[MAXHOSTNAMELEN+19]; -+ struct sockaddr_in sa; -+ int r; -+ -+ sa.sin_family = AF_INET; -+ sa.sin_port = 0; -+ memcpy(&sa.sin_addr, &l, sizeof l); -+ -+ r = getnameinfo((struct sockaddr *) &sa, sizeof sa, buf, sizeof buf, -+ NULL, 0, (options & F_NUMERIC) ? NI_NUMERICHOST : 0); -+ if(r) { -+ fprintf(stderr, "bing: getaddrinfo: %s\n", gai_strerror(r)); -+ exit(1); -+ } - -- if ((options & F_NUMERIC) || -- !(hp = gethostbyaddr((char *)&l, 4, AF_INET))) -- (void)snprintf(snfargs(buf, sizeof(buf), "%s"), -- inet_ntoa(*(struct in_addr *)&l)); -- else -- (void)snprintf(snfargs(buf, sizeof(buf), "%s (%s)"), -- hp->h_name, -- inet_ntoa(*(struct in_addr *)&l)); -- return(buf); -+ return buf; - } - - /* diff --git a/patches/bing_src-1.1.3/series b/patches/bing_src-1.1.3/series deleted file mode 100644 index c6b8048..0000000 --- a/patches/bing_src-1.1.3/series +++ /dev/null @@ -1,2 +0,0 @@ -adapt_makefile_for_linux.diff -p0 -bing_1.1.3-2.diff -- 1.7.7 -- ptxdist mailing list ptxdist@pengutronix.de