Skip to content

Commit

Permalink
feat: add newline separator between transmissions
Browse files Browse the repository at this point in the history
  • Loading branch information
leogaudin committed Jun 10, 2023
1 parent 1348118 commit 2aaf551
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
3 changes: 2 additions & 1 deletion client.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: lgaudin <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -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);
}
3 changes: 2 additions & 1 deletion client_bonus.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: lgaudin <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -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);
}
7 changes: 5 additions & 2 deletions server.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: lgaudin <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -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;
}
Expand Down
7 changes: 5 additions & 2 deletions server_bonus.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: lgaudin <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 2aaf551

Please sign in to comment.