From 2aaf5510a9e7c5889e0c9124ccc03bd55f69ba57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=CC=81o?= Date: Sat, 10 Jun 2023 14:31:23 +0200 Subject: [PATCH] feat: add newline separator between transmissions --- client.c | 3 ++- client_bonus.c | 3 ++- server.c | 7 +++++-- server_bonus.c | 7 +++++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/client.c b/client.c index 167dbee..ecb8e08 100644 --- a/client.c +++ b/client.c @@ -6,7 +6,7 @@ /* By: lgaudin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/06/09 15:02:14 by lgaudin #+# #+# */ -/* Updated: 2023/06/09 16:53:18 by lgaudin ### ########.fr */ +/* Updated: 2023/06/10 14:29:08 by lgaudin ### ########.fr */ /* */ /* ************************************************************************** */ @@ -66,5 +66,6 @@ int main(int argc, char *argv[]) i = 0; while (message[i]) send_signal(server_pid, message[i++]); + send_signal(server_pid, '\0'); return (0); } diff --git a/client_bonus.c b/client_bonus.c index 4240802..f55a0a3 100644 --- a/client_bonus.c +++ b/client_bonus.c @@ -6,7 +6,7 @@ /* By: lgaudin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/06/09 15:02:14 by lgaudin #+# #+# */ -/* Updated: 2023/06/10 14:00:06 by lgaudin ### ########.fr */ +/* Updated: 2023/06/10 14:30:55 by lgaudin ### ########.fr */ /* */ /* ************************************************************************** */ @@ -82,5 +82,6 @@ int main(int argc, char *argv[]) i = 0; while (message[i]) send_signal(server_pid, message[i++]); + send_signal(server_pid, '\0'); return (0); } diff --git a/server.c b/server.c index a526833..4cc86a7 100644 --- a/server.c +++ b/server.c @@ -6,7 +6,7 @@ /* By: lgaudin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/06/09 15:02:13 by lgaudin #+# #+# */ -/* Updated: 2023/06/10 13:38:51 by lgaudin ### ########.fr */ +/* Updated: 2023/06/10 14:29:40 by lgaudin ### ########.fr */ /* */ /* ************************************************************************** */ @@ -46,7 +46,10 @@ void handle_signal(int signal) bit_index++; if (bit_index == 8) { - ft_printf("%c", current_char); + if (current_char == END_TRANSMISSION) + ft_printf("\n"); + else + ft_printf("%c", current_char); bit_index = 0; current_char = 0; } diff --git a/server_bonus.c b/server_bonus.c index 0bb4ca5..c306516 100644 --- a/server_bonus.c +++ b/server_bonus.c @@ -6,7 +6,7 @@ /* By: lgaudin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/06/09 15:02:13 by lgaudin #+# #+# */ -/* Updated: 2023/06/10 13:38:49 by lgaudin ### ########.fr */ +/* Updated: 2023/06/10 14:30:45 by lgaudin ### ########.fr */ /* */ /* ************************************************************************** */ @@ -46,7 +46,10 @@ void handle_signal(int signal, siginfo_t *info, void *context) bit_index++; if (bit_index == 8) { - ft_printf("%c", current_char); + if (current_char == END_TRANSMISSION) + ft_printf("\n"); + else + ft_printf("%c", current_char); bit_index = 0; current_char = 0; }