From b2c945fe6d5eb6f67ac9dff4a310a7b549c28ff5 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Wed, 17 Apr 2024 17:45:21 +0200 Subject: [PATCH] implemented the exit_cmd macro --- src/chat/main/client.c | 2 +- src/chat/main/server.c | 2 +- src/chat/misc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/chat/main/client.c b/src/chat/main/client.c index ed10704..ff070cc 100644 --- a/src/chat/main/client.c +++ b/src/chat/main/client.c @@ -110,7 +110,7 @@ int main(void) why2_send_socket(line, NULL, listen_socket); //NULL IS SENT BECAUSE IT IS USELESS TO SEND USER FROM CLIENT - SERVER WON'T USE IT - if (strcmp(line, "!exit\n") == 0) //USER REQUESTED PROGRAM EXIT + if (strcmp(line, WHY2_CHAT_COMMAND_PREFIX WHY2_CHAT_COMMAND_EXIT "\n") == 0) //USER REQUESTED PROGRAM EXIT { printf("Exiting...\n"); break; diff --git a/src/chat/main/server.c b/src/chat/main/server.c index 3b8ac85..287e3f2 100644 --- a/src/chat/main/server.c +++ b/src/chat/main/server.c @@ -63,7 +63,7 @@ int main(void) { if (getline(&line_buffer, &line_length_buffer, stdin) == -1) why2_die("Reading input failed."); - if (strcmp(line_buffer, "!exit\n") == 0) //USER REQUESTED PROGRAM EXIT + if (strcmp(line_buffer, WHY2_CHAT_COMMAND_PREFIX WHY2_CHAT_COMMAND_EXIT "\n") == 0) //USER REQUESTED PROGRAM EXIT { printf("Exiting...\n"); break; diff --git a/src/chat/misc.c b/src/chat/misc.c index 3d259a4..17596ce 100644 --- a/src/chat/misc.c +++ b/src/chat/misc.c @@ -655,7 +655,7 @@ void *why2_communicate_thread(void *arg) { if (decoded_buffer[0] == '!') //COMMANDS { - if (strcmp(decoded_buffer, "!exit") == 0) //USER REQUESTED EXIT + if (strcmp(decoded_buffer, WHY2_CHAT_COMMAND_PREFIX WHY2_CHAT_COMMAND_EXIT) == 0) //USER REQUESTED EXIT { exiting = 1; } else