Re: [JOB] bing
Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de> writes:
> Hi,
>
> bing is a better ping. It includes netinet/ip_var.h, which we don't have.
i tried compiling bing on HURD without this header file. it compiles without
this header.
It also has MAXHOSTNAMELEN issue which i have addressed.
There is one more thing that i didn't really get.
char *target1, *target2, *malloc();
^^^^^^^^^
why did he do that?
right now i have removed it.
and made a small change in Makefile added *~ in clean rule.
thanks
nikunj
diff -ruN bing/bing-1.0.4.orig/Makefile bing-1.0.4.orig/Makefile
--- bing/bing-1.0.4.orig/Makefile Fri Jul 21 00:03:30 1995
+++ bing-1.0.4.orig/Makefile Fri Aug 17 11:35:26 2001
@@ -25,8 +25,10 @@
$(NROFF) -mandoc bing.8 > bing.0
clean:
- $(RM) -f bing bing.ps bing.0
+ $(RM) -f bing bing.ps bing.0 *~
install: bing bing.8
$(INSTALL) -m 644 -o man -g man bing.8 $(MANDIR)/man8
$(INSTALL) -m 4555 -o root -g staff bing $(BINDIR)
+
+
diff -ruN bing/bing-1.0.4.orig/bing.c bing-1.0.4.orig/bing.c
--- bing/bing-1.0.4.orig/bing.c Fri Aug 17 11:31:36 2001
+++ bing-1.0.4.orig/bing.c Fri Aug 17 11:34:49 2001
@@ -162,7 +162,9 @@
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
#ifndef linux
+#ifndef __GNU__
#include <netinet/ip_var.h>
+#endif /* __GNU__ */
#endif /* linux */
#include <netdb.h>
#include <unistd.h>
@@ -170,7 +172,9 @@
#include <ctype.h>
#include <errno.h>
#include <string.h>
+#ifndef __GNU__
#include <limits.h>
+#endif
#include "sysdep.h"
@@ -298,7 +302,6 @@
struct hoststats {
/* Host info */
- char hnamebuf[MAXHOSTNAMELEN];
char *hostname;
struct sockaddr whereto;
struct sockaddr_in *to;
@@ -348,8 +351,12 @@
}
hs->to->sin_family = hp->h_addrtype;
bcopy(hp->h_addr, (caddr_t)&hs->to->sin_addr, hp->h_length);
- (void)strncpy(hs->hnamebuf, hp->h_name, sizeof(hs->hnamebuf) - 1);
- hs->hostname = hs->hnamebuf;
+ hs->hostname = strdup(hp->h_name);
+ if(!hs->hostname) {
+ (void)fprintf(stderr,
+ "bing: unable to allcate memory\n");
+ exit(1);
+ }
}
}
@@ -1230,7 +1237,7 @@
int i;
int ch, hold, recv_packlen, preload;
u_char *datap, *recv_packet;
- char *target1, *target2, *malloc();
+ char *target1, *target2;
u_char ttl, loop;
#ifdef IP_OPTIONS
char rspace[3 + 4 * NROUTES + 1]; /* record route space */
Reply to:
- References:
- [JOB] bing
- From: Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>