Cleanup for GCC 2.

This commit is contained in:
mycroft 1993-04-21 06:00:35 +00:00
parent 4e4e9313a0
commit 7786405811
2 changed files with 27 additions and 27 deletions

View File

@ -61,7 +61,7 @@ static char sccsid[] = "@(#)main.c 5.10 (Berkeley) 3/1/91";
#define TIMEOUT 5 /* secs between rexmt's */
struct sockaddr_in sin;
struct sockaddr_in s_in;
int f;
short port;
int trace;
@ -127,7 +127,7 @@ char *rindex();
main(argc, argv)
char *argv[];
{
struct sockaddr_in sin;
struct sockaddr_in s_in;
int top;
sp = getservbyname("tftp", "udp");
@ -140,9 +140,9 @@ main(argc, argv)
perror("tftp: socket");
exit(3);
}
bzero((char *)&sin, sizeof (sin));
sin.sin_family = AF_INET;
if (bind(f, (struct sockaddr *)&sin, sizeof (sin)) < 0) {
bzero((char *)&s_in, sizeof (s_in));
s_in.sin_family = AF_INET;
if (bind(f, (struct sockaddr *)&s_in, sizeof (s_in)) < 0) {
perror("tftp: bind");
exit(1);
}
@ -180,13 +180,13 @@ setpeer(argc, argv)
}
host = gethostbyname(argv[1]);
if (host) {
sin.sin_family = host->h_addrtype;
bcopy(host->h_addr, &sin.sin_addr, host->h_length);
s_in.sin_family = host->h_addrtype;
bcopy(host->h_addr, &s_in.sin_addr, host->h_length);
strcpy(hostname, host->h_name);
} else {
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = inet_addr(argv[1]);
if (sin.sin_addr.s_addr == -1) {
s_in.sin_family = AF_INET;
s_in.sin_addr.s_addr = inet_addr(argv[1]);
if (s_in.sin_addr.s_addr == -1) {
connected = 0;
printf("%s: unknown host\n", argv[1]);
return;
@ -312,8 +312,8 @@ put(argc, argv)
herror((char *)NULL);
return;
}
bcopy(hp->h_addr, (caddr_t)&sin.sin_addr, hp->h_length);
sin.sin_family = hp->h_addrtype;
bcopy(hp->h_addr, (caddr_t)&s_in.sin_addr, hp->h_length);
s_in.sin_family = hp->h_addrtype;
connected = 1;
strcpy(hostname, hp->h_name);
}
@ -331,7 +331,7 @@ put(argc, argv)
if (verbose)
printf("putting %s to %s:%s [%s]\n",
cp, hostname, targ, mode);
sin.sin_port = port;
s_in.sin_port = port;
sendfile(fd, targ, mode);
return;
}
@ -349,7 +349,7 @@ put(argc, argv)
if (verbose)
printf("putting %s to %s:%s [%s]\n",
argv[n], hostname, targ, mode);
sin.sin_port = port;
s_in.sin_port = port;
sendfile(fd, targ, mode);
}
}
@ -405,8 +405,8 @@ get(argc, argv)
herror((char *)NULL);
continue;
}
bcopy(hp->h_addr, (caddr_t)&sin.sin_addr, hp->h_length);
sin.sin_family = hp->h_addrtype;
bcopy(hp->h_addr, (caddr_t)&s_in.sin_addr, hp->h_length);
s_in.sin_family = hp->h_addrtype;
connected = 1;
strcpy(hostname, hp->h_name);
}
@ -420,7 +420,7 @@ get(argc, argv)
if (verbose)
printf("getting from %s:%s to %s [%s]\n",
hostname, src, cp, mode);
sin.sin_port = port;
s_in.sin_port = port;
recvfile(fd, src, mode);
break;
}
@ -433,7 +433,7 @@ get(argc, argv)
if (verbose)
printf("getting from %s:%s to %s [%s]\n",
hostname, src, cp, mode);
sin.sin_port = port;
s_in.sin_port = port;
recvfile(fd, src, mode);
}
}

View File

@ -55,7 +55,7 @@ static char sccsid[] = "@(#)tftp.c 5.10 (Berkeley) 3/1/91";
extern int errno;
extern struct sockaddr_in sin; /* filled in by main */
extern struct sockaddr_in s_in; /* filled in by main */
extern int f; /* the opened socket */
extern int trace;
extern int verbose;
@ -122,7 +122,7 @@ send_data:
if (trace)
tpacket("sent", dp, size + 4);
n = sendto(f, dp, size + 4, 0,
(struct sockaddr *)&sin, sizeof (sin));
(struct sockaddr *)&s_in, sizeof (s_in));
if (n != size + 4) {
perror("tftp: sendto");
goto abort;
@ -140,7 +140,7 @@ send_data:
perror("tftp: recvfrom");
goto abort;
}
sin.sin_port = from.sin_port; /* added */
s_in.sin_port = from.sin_port; /* added */
if (trace)
tpacket("received", ap, n);
/* should verify packet came from server */
@ -220,8 +220,8 @@ recvfile(fd, name, mode)
send_ack:
if (trace)
tpacket("sent", ap, size);
if (sendto(f, ackbuf, size, 0, (struct sockaddr *)&sin,
sizeof (sin)) != size) {
if (sendto(f, ackbuf, size, 0, (struct sockaddr *)&s_in,
sizeof (s_in)) != size) {
alarm(0);
perror("tftp: sendto");
goto abort;
@ -239,7 +239,7 @@ send_ack:
perror("tftp: recvfrom");
goto abort;
}
sin.sin_port = from.sin_port; /* added */
s_in.sin_port = from.sin_port; /* added */
if (trace)
tpacket("received", dp, n);
/* should verify client address */
@ -279,7 +279,7 @@ send_ack:
abort: /* ok to ack, since user */
ap->th_opcode = htons((u_short)ACK); /* has seen err msg */
ap->th_block = htons((u_short)block);
(void) sendto(f, ackbuf, 4, 0, (struct sockaddr *)&sin, sizeof (sin));
(void) sendto(f, ackbuf, 4, 0, (struct sockaddr *)&s_in, sizeof (s_in));
write_behind(file, convert); /* flush last buffer */
fclose(file);
stopclock();
@ -348,8 +348,8 @@ nak(error)
length = strlen(pe->e_msg) + 4;
if (trace)
tpacket("sent", tp, length);
if (sendto(f, ackbuf, length, 0, (struct sockaddr *)&sin,
sizeof (sin)) != length)
if (sendto(f, ackbuf, length, 0, (struct sockaddr *)&s_in,
sizeof (s_in)) != length)
perror("nak");
}