-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.c
41 lines (36 loc) · 1.21 KB
/
server.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* client.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: bsamli <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/25 17:54:06 by bsamli #+# #+# */
/* Updated: 2022/11/25 17:54:21 by bsamli ### ########.fr */
/* */
/* ************************************************************************** */
#include "minitalk.h"
void ft_handle(int sig)
{
static int a;
static int count;
a <<= 1;
if (sig == SIGUSR1)
a |= 1;
count++;
if (count == 8)
{
write(1, &a, 1);
count = 0;
}
}
int main(void)
{
pid_t a;
a = getpid();
ft_printf("%d\n", a);
signal(SIGUSR1, ft_handle);
signal(SIGUSR2, ft_handle);
while (1)
continue ;
}