From 58a7a86bc3a9e62f63040c973c553e565808d995 Mon Sep 17 00:00:00 2001 From: kabiroberai Date: Fri, 31 Jan 2020 17:26:27 +0530 Subject: [PATCH] Flush stdout when needed This is required on certain machines (eg the iSH emulator on iOS) --- mcrcon.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mcrcon.c b/mcrcon.c index 3324875..5f23447 100644 --- a/mcrcon.c +++ b/mcrcon.c @@ -557,6 +557,8 @@ void packet_print(rc_packet *packet) // print newline if string has no newline if (packet->data[i-1] != 10 && packet->data[i-1] != 13) putchar('\n'); + + fflush(stdout); } rc_packet *packet_build(int id, int cmd, char *s1) @@ -654,6 +656,7 @@ int run_terminal_mode(int sock) while (global_connection_alive) { putchar('>'); + fflush(stdout); int len = get_line(command, DATA_BUFFSIZE); if ((strcasecmp(command, "exit") && strcasecmp(command, "quit")) == 0)