Skip to content

Commit

Permalink
style: add Norme format
Browse files Browse the repository at this point in the history
  • Loading branch information
leogaudin committed Jun 10, 2023
1 parent fca7c91 commit d938597
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions 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 13:30:49 by lgaudin ### ########.fr */
/* Updated: 2023/06/10 13:38:56 by lgaudin ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -44,12 +44,12 @@ void send_signal(int pid, unsigned char character)
}
}

void handle_read_receipt(int signal)
void handle_read_receipt(int signal)
{
if (signal == SIGUSR1)
ft_printf("Received bit 1\n");
ft_printf("Received bit 1\n");
else if (signal == SIGUSR2)
ft_printf("Received bit 0\n");
ft_printf("Received bit 0\n");
}

/**
Expand All @@ -64,7 +64,7 @@ int main(int argc, char *argv[])
const char *message;
int i;

signal(SIGUSR1, handle_read_receipt);
signal(SIGUSR1, handle_read_receipt);
signal(SIGUSR2, handle_read_receipt);
if (argc != 3)
{
Expand Down
6 changes: 3 additions & 3 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/09 16:49:47 by lgaudin ### ########.fr */
/* Updated: 2023/06/10 13:38:51 by lgaudin ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -39,8 +39,8 @@
*/
void handle_signal(int signal)
{
static unsigned char current_char;
static int bit_index;
static unsigned char current_char;
static int bit_index;

current_char |= (signal == SIGUSR1);
bit_index++;
Expand Down
14 changes: 7 additions & 7 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:12:52 by lgaudin ### ########.fr */
/* Updated: 2023/06/10 13:38:49 by lgaudin ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -38,10 +38,10 @@
*/
void handle_signal(int signal, siginfo_t *info, void *context)
{
static unsigned char current_char;
static int bit_index;
static unsigned char current_char;
static int bit_index;

(void)context;
(void)context;
current_char |= (signal == SIGUSR1);
bit_index++;
if (bit_index == 8)
Expand All @@ -53,17 +53,17 @@ void handle_signal(int signal, siginfo_t *info, void *context)
else
current_char <<= 1;
if (signal == SIGUSR1)
kill(info->si_pid, SIGUSR1);
kill(info->si_pid, SIGUSR1);
else if (signal == SIGUSR2)
kill(info->si_pid, SIGUSR2);
kill(info->si_pid, SIGUSR2);
}

/**
* @brief Prints its program's PID and calls the signal handlers.
*/
int main(void)
{
struct sigaction sa;
struct sigaction sa;

sa.sa_sigaction = &handle_signal;
sa.sa_flags = SA_SIGINFO;
Expand Down

0 comments on commit d938597

Please sign in to comment.