changeset 2470:99ac672309b9

* tests/server_test.c (server_test): Fix typo with atoi which should really be ultoa(). Cleanup to use diag_sprintf() which is always available. Bug reported by Grant Edwards.
author asl
date Sun, 13 Apr 2008 18:39:57 +0000
parents a62211ae5f94
children 6d6c8afc94a4
files packages/net/common/current/ChangeLog packages/net/common/current/tests/server_test.c
diffstat 2 files changed, 7 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/packages/net/common/current/ChangeLog
+++ b/packages/net/common/current/ChangeLog
@@ -1,3 +1,9 @@
+2008-04-13  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+	* tests/server_test.c (server_test): Fix typo with atoi which
+	should really be ultoa(). Cleanup to use diag_sprintf() which is
+	always available. Bug reported by Grant Edwards.
+
 2007-12-21  Oyvind Harboe <oyvind.harboe@zylin.com>
 
 	* src/tftp_client.c, include/arpa/tftp.h, cdl/net.cdl: tftp
--- a/packages/net/common/current/tests/server_test.c
+++ b/packages/net/common/current/tests/server_test.c
@@ -92,15 +92,7 @@ server_test(struct bootp *bp)
         getpeername(client, (struct sockaddr *)&client_addr, &client_len);
         diag_printf("connection from %s:%d\n", inet_ntoa(client_addr.sin_addr), ntohs(client_addr.sin_port));
 
-#ifdef CYGPKG_LIBC_STDIO        
-        sprintf(buf, "Hello %s:%d\n", inet_ntoa(client_addr.sin_addr), ntohs(client_addr.sin_port));
-#else        
-        strcpy(buf, "Hello ");
-        strcat(buf, inet_ntoa(client_addr.sin_addr));
-        strcat(buf,":");
-        strcat(buf, atoi(ntohs(client_addr.sin_port)));
-        strcat(buf,"\n");
-#endif
+        diag_sprintf(buf, "Hello %s:%d\n", inet_ntoa(client_addr.sin_addr), ntohs(client_addr.sin_port));
         
         write(client, buf, strlen(buf));
         tv.tv_sec = 5;