Another update from Larry:
[oweals/busybox.git] / telnet.c
index b08effed7d4078e0ab101448452401b4dd1179b1..edcc5081fd701697d3fe69723835dcbc58830d97 100644 (file)
--- a/telnet.c
+++ b/telnet.c
@@ -30,7 +30,6 @@
  *
  */
 
-#include "busybox.h"
 #include <termios.h>
 #include <unistd.h>
 #include <errno.h>
@@ -43,6 +42,7 @@
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <netdb.h>
+#include "busybox.h"
 
 #if 0
 static const int DOTRACE = 1;
@@ -85,7 +85,7 @@ enum {
 typedef unsigned char byte;
 
 /* use globals to reduce size ??? */ /* test this hypothesis later */
-struct Globalvars {
+static struct Globalvars {
        int             netfd; /* console fd:s are 0 and 1 (and 2) */
     /* same buffer used both for network and console read/write */
        char *  buf; /* allocating so static size is smaller */
@@ -108,7 +108,7 @@ struct Globalvars {
 struct Globalvars * Gptr;
 #define G (*Gptr)
 #else
-struct Globalvars G;
+static struct Globalvars G;
 #endif
 
 static inline void iacflush()
@@ -325,7 +325,7 @@ static void putiac1(byte c)
 
 /* ******************************* */
 
-char const escapecharis[] = "\r\nEscape character is ";
+static char const escapecharis[] = "\r\nEscape character is ";
 
 static void setConMode()
 {
@@ -498,7 +498,7 @@ extern int telnet_main(int argc, char** argv)
 
        cfmakeraw(&G.termios_raw);
        
-       if (argc < 2)   usage(telnet_usage);
+       if (argc < 2)   show_usage();
        port = (argc > 2)? getport(argv[2]): 23;
        
        G.buf = xmalloc(DATABUFSIZE);
@@ -612,7 +612,7 @@ static int create_socket()
 
 static void setup_sockaddr_in(struct sockaddr_in * addr, int port)
 {
-       memset(addr, 0, sizeof addr);
+       memset(addr, 0, sizeof(struct sockaddr_in));
        addr->sin_family = AF_INET;
        addr->sin_port = htons(port);
 }