diff options
| author | Franklin Wei <frankhwei536@gmail.com> | 2014-07-18 21:44:54 -0400 |
|---|---|---|
| committer | Franklin Wei <frankhwei536@gmail.com> | 2014-07-18 21:44:54 -0400 |
| commit | 004a0431b5af8b87462d40689c262f912b9d7e4e (patch) | |
| tree | 347afd7d5dd6c47cd6dc6bee4e19fafcc810eef9 /util.c | |
| parent | 4233f6c3fa0928b773a1076eda4e82b3e75af97e (diff) | |
| download | wargames-server-004a0431b5af8b87462d40689c262f912b9d7e4e.zip wargames-server-004a0431b5af8b87462d40689c262f912b9d7e4e.tar.gz wargames-server-004a0431b5af8b87462d40689c262f912b9d7e4e.tar.bz2 wargames-server-004a0431b5af8b87462d40689c262f912b9d7e4e.tar.xz | |
Some bugfixes
Diffstat (limited to 'util.c')
| -rw-r--r-- | util.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -19,6 +19,7 @@ */ #include "strings.h" +#include "telnet.h" #include "util.h" #include <ctype.h> #include <string.h> @@ -39,9 +40,9 @@ void print_string(const char* str) /* print string, slowly */ while(str[i]) { if(str[i]=='\n') - write(out_fd, "\r\n", 2); + write(out_fd, "\r\n", 2); else - write(out_fd, &str[i], 1); + write(out_fd, &str[i], 1); fsync(out_fd); usleep(SLEEP_TIME); ++i; @@ -89,13 +90,15 @@ int getnstr(char* buf, int max) } void echo_off(void) { - unsigned char echo_off[]={0xff, 254, 1}; + unsigned char echo_off[]={IAC, WILL, ECHO}; + write(out_fd, echo_off, 3); + echo_off[1]=DONT; write(out_fd, echo_off, 3); fsync(out_fd); } void echo_on(void) { - unsigned char echo_on[]={0xff, 253, 1}; + unsigned char echo_on[]={IAC, DO, ECHO}; write(out_fd, echo_on, 3); fsync(out_fd); } |