aboutsummaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorFranklin Wei <frankhwei536@gmail.com>2014-07-18 21:44:54 -0400
committerFranklin Wei <frankhwei536@gmail.com>2014-07-18 21:44:54 -0400
commit004a0431b5af8b87462d40689c262f912b9d7e4e (patch)
tree347afd7d5dd6c47cd6dc6bee4e19fafcc810eef9 /util.c
parent4233f6c3fa0928b773a1076eda4e82b3e75af97e (diff)
downloadwargames-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.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/util.c b/util.c
index a72a1bb..8827e1e 100644
--- a/util.c
+++ b/util.c
@@ -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);
}