summaryrefslogtreecommitdiff
path: root/net/ttcp/patches/patch-ab
blob: 470e564f074dffcf67146ea8949450e9524068e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
$NetBSD: patch-ab,v 1.3 1998/08/07 11:11:02 agc Exp $

*** ttcp.c.orig	Thu Feb 27 13:30:23 1997
--- ttcp.c	Tue Jan 27 13:51:55 1998
***************
*** 55,60 ****
--- 55,61 ----
  #include <arpa/inet.h>
  #include <netdb.h>
  #include <sys/time.h>		/* struct timeval */
+ #include <stdlib.h>
  
  #if defined(SYSV)
  #include <sys/times.h>
***************
*** 263,269 ****
  	if ( (buf = (char *)malloc(buflen+bufalign)) == (char *)NULL)
  		err("malloc");
  	if (bufalign != 0)
! 		buf +=(bufalign - ((int)buf % bufalign) + bufoffset) % bufalign;
  
  	if (trans) {
  	    fprintf(stdout,
--- 264,270 ----
  	if ( (buf = (char *)malloc(buflen+bufalign)) == (char *)NULL)
  		err("malloc");
  	if (bufalign != 0)
! 		buf +=(bufalign - ((u_long)buf % bufalign) + bufoffset) % bufalign;
  
  	if (trans) {
  	    fprintf(stdout,
***************
*** 285,291 ****
  		err("socket");
  	mes("socket");
  
! 	if (bind(fd, &sinme, sizeof(sinme)) < 0)
  		err("bind");
  
  #if defined(SO_SNDBUF) || defined(SO_RCVBUF)
--- 286,292 ----
  		err("socket");
  	mes("socket");
  
! 	if (bind(fd, (struct sockaddr *)&sinme, sizeof(sinme)) < 0)
  		err("bind");
  
  #if defined(SO_SNDBUF) || defined(SO_RCVBUF)
***************
*** 326,332 ****
  			mes("nodelay");
  		}
  #endif
! 		if(connect(fd, &sinhim, sizeof(sinhim) ) < 0)
  			err("connect");
  		mes("connect");
  	    } else {
--- 327,333 ----
  			mes("nodelay");
  		}
  #endif
! 		if(connect(fd, (struct sockaddr *)&sinhim, sizeof(sinhim) ) < 0)
  			err("connect");
  		mes("connect");
  	    } else {
***************
*** 348,358 ****
  		}
  		fromlen = sizeof(frominet);
  		domain = AF_INET;
! 		if((fd=accept(fd, &frominet, &fromlen) ) < 0)
  			err("accept");
  		{ struct sockaddr_in peer;
  		  int peerlen = sizeof(peer);
! 		  if (getpeername(fd, (struct sockaddr_in *) &peer, 
  				&peerlen) < 0) {
  			err("getpeername");
  		  }
--- 349,359 ----
  		}
  		fromlen = sizeof(frominet);
  		domain = AF_INET;
! 		if((fd=accept(fd, (struct sockaddr *)&frominet, &fromlen) ) < 0)
  			err("accept");
  		{ struct sockaddr_in peer;
  		  int peerlen = sizeof(peer);
! 		  if (getpeername(fd, (struct sockaddr *) &peer, 
  				&peerlen) < 0) {
  			err("getpeername");
  		  }
***************
*** 752,758 ****
  	int len = sizeof(from);
  	register int cnt;
  	if( udp )  {
! 		cnt = recvfrom( fd, buf, count, 0, &from, &len );
  		numCalls++;
  	} else {
  		if( b_flag )
--- 753,759 ----
  	int len = sizeof(from);
  	register int cnt;
  	if( udp )  {
! 		cnt = recvfrom( fd, buf, count, 0, (struct sockaddr *)&from, &len );
  		numCalls++;
  	} else {
  		if( b_flag )
***************
*** 782,788 ****
  	register int cnt;
  	if( udp )  {
  again:
! 		cnt = sendto( fd, buf, count, 0, &sinhim, sizeof(sinhim) );
  		numCalls++;
  		if( cnt<0 && errno == ENOBUFS )  {
  			delay(18000);
--- 783,789 ----
  	register int cnt;
  	if( udp )  {
  again:
! 		cnt = sendto( fd, buf, count, 0, (struct sockaddr *)&sinhim, sizeof(sinhim) );
  		numCalls++;
  		if( cnt<0 && errno == ENOBUFS )  {
  			delay(18000);