*
*/
-#include "busybox.h"
#include <termios.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
+#include "busybox.h"
#if 0
static const int DOTRACE = 1;
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 */
struct Globalvars * Gptr;
#define G (*Gptr)
#else
-struct Globalvars G;
+static struct Globalvars G;
#endif
static inline void iacflush()
/* ******************************* */
-char const escapecharis[] = "\r\nEscape character is ";
+static char const escapecharis[] = "\r\nEscape character is ";
static void setConMode()
{
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);
if ((unsigned)(port - 1 ) > 65534)
{
- error_msg_and_die("%s: bad port number\n", p);
+ error_msg_and_die("%s: bad port number", p);
}
return port;
}
struct hostent * he;
if ((he = gethostbyname(host)) == NULL)
{
- error_msg_and_die("%s: Unknown host\n", host);
+ error_msg_and_die("%s: Unknown host", host);
}
memcpy(&addr, he->h_addr, sizeof addr);
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);
}