diff --git a/include/chat/common.h b/include/chat/common.h index d71986b..f9c0c69 100644 --- a/include/chat/common.h +++ b/include/chat/common.h @@ -38,4 +38,6 @@ along with this program. If not, see . #define SERVER_PORT 1204 #define MAX_CONNECTIONS 1000 +#define CLEAR_AND_GO_UP "\33[2K\r\033[A" + #endif \ No newline at end of file diff --git a/src/chat/main/client.c b/src/chat/main/client.c index 6f17042..6907e46 100644 --- a/src/chat/main/client.c +++ b/src/chat/main/client.c @@ -56,7 +56,7 @@ int main(void) for (;;) { getline(&line, &line_length, stdin); - printf("\33[2K\r\033[A"); + printf(CLEAR_AND_GO_UP); why2_send_socket(line, listen_socket); diff --git a/src/chat/misc.c b/src/chat/misc.c index 934759f..9d6e24b 100644 --- a/src/chat/misc.c +++ b/src/chat/misc.c @@ -273,7 +273,7 @@ void *why2_listen_server(void *socket) for (;;) { read = why2_read_socket(*((int*) socket)); //TODO: Fix other user message formatting - printf("\33[2K\r\033[A"); + printf(CLEAR_AND_GO_UP); printf("%s\n>>> ", read); fflush(stdout);