From: <ro...@us...> - 2003-03-28 16:57:13
|
Update of /cvsroot/ltp/ltp/testcases/network/multicast/mc_commo In directory sc8-pr-cvs1:/tmp/cvs-serv27709 Modified Files: Makefile mc_recv.c mc_send.c Log Message: warnings cleanup Index: Makefile =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/network/multicast/mc_commo/Makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Makefile 13 Mar 2003 20:10:30 -0000 1.3 +++ Makefile 28 Mar 2003 16:57:04 -0000 1.4 @@ -1,4 +1,4 @@ -CFLAGS += -O +CFLAGS += -O -Wall LDLIBS += SRCS=$(wildcard *.c) Index: mc_recv.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/network/multicast/mc_commo/mc_recv.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- mc_recv.c 27 Aug 2001 22:15:16 -0000 1.1 +++ mc_recv.c 28 Mar 2003 16:57:04 -0000 1.2 @@ -2,6 +2,7 @@ #include <sys/socket.h> #include <netinet/in.h> #include <errno.h> +#include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -12,7 +13,7 @@ char buf[MAXBUFSIZ]; -main(int argc, char *argv[]) +int main(int argc, char *argv[]) { struct ip_mreq imr; struct sockaddr_in from_in, mcast_in; @@ -43,7 +44,7 @@ } imr.imr_multiaddr.s_addr = htonl((g1<<24) | (g2<<16) | (g3<<8) | g4); - if(hp = gethostbyname(argv[2])) + if((hp = gethostbyname(argv[2]))) bcopy(hp->h_addr, &imr.imr_interface.s_addr, hp->h_length); else if((n = sscanf(argv[2], "%u.%u.%u.%u", &i1, &i2, &i3, &i4)) != 4) { @@ -65,7 +66,7 @@ /* allow address reuse for binding multiple multicast applications to the same group */ if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)) < 0) { - perror("setsockopt SO_REUSEADDR failed\n"); + perror("setsockopt SO_REUSEADDR failed"); exit(1); } Index: mc_send.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/network/multicast/mc_commo/mc_send.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- mc_send.c 27 Aug 2001 22:15:16 -0000 1.1 +++ mc_send.c 28 Mar 2003 16:57:04 -0000 1.2 @@ -2,6 +2,7 @@ #include <sys/socket.h> #include <netinet/in.h> #include <errno.h> +#include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -14,7 +15,7 @@ char buf[MAXBUFSIZ]; int Num_Loops=100; -main(argc, argv) +int main(argc, argv) int argc; char *argv[]; { @@ -24,8 +25,6 @@ unsigned i1, i2, i3, i4, g1, g2, g3, g4; struct hostent *hp, *gethostbyname(); char myname[64]; - - char loop=0; char ttl=0; if ( argc < 4) { @@ -48,7 +47,7 @@ } imr.imr_multiaddr.s_addr = htonl((g1<<24) | (g2<<16) | (g3<<8) | g4); - if(hp = gethostbyname(argv[2])) { + if((hp = gethostbyname(argv[2]))) { bcopy(hp->h_addr, &imr.imr_interface.s_addr, hp->h_length); } else if((n = sscanf(argv[2], "%u.%u.%u.%u", &i1, &i2, &i3, &i4)) != 4) { @@ -98,7 +97,7 @@ /* Send datagrams */ for (i=1;i < Num_Loops;i++) { - sprintf(buf, "%s %d %d", argv[2], i, time(0)); + sprintf(buf, "%s %d %d", argv[2], i, (int)time(0)); if ((n = sendto(s, buf, sizeof(buf), 0, (struct sockaddr *) &mcast_out, sizeof(mcast_out))) < 0) { perror("setsockopt"); |