mini algo test pour traduire char en signale ok
This commit is contained in:
@@ -1,10 +1,24 @@
|
||||
#include "../includes/minitalk.h"
|
||||
#include <stdlib.h> //for atoi
|
||||
|
||||
int main(int ac, char **av)
|
||||
int usage(void)
|
||||
{
|
||||
if (ac != 2)
|
||||
return (0);
|
||||
kill(atoi(av[1]), SIGUSR1);
|
||||
ft_printf("usage: ./client [server pid] [message]\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
void send_message(int server_pid, char *msg)
|
||||
{
|
||||
if (!ft_strcmp(msg, "SIGUSR1"))
|
||||
kill(server_pid, SIGUSR1);
|
||||
if (!ft_strcmp(msg, "SIGUSR2"))
|
||||
kill(server_pid, SIGUSR2);
|
||||
}
|
||||
|
||||
int main(int ac, char **av)
|
||||
{
|
||||
if (ac != 3)
|
||||
return (usage());
|
||||
send_message(ft_atoi(av[1]), av[2]);
|
||||
return (0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user