/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: cchauvet #include "../libftx/libftx.h" void ft_char2signal(int pid, char c) { size_t i; i = sizeof(char) * 8; while (i > 0) { if ((c >> (i - 1)) & 1) kill(pid, SIGUSR2); else kill(pid, SIGUSR1); i--; } } int main(int ac, char **av) { int pid; size_t i; if (ac != 3 || !ft_isnum(av[1])) { ft_printf("Argument error !"); return (1); } pid = ft_atoi(av[1]); kill(pid, SIGUSR2); i = 0; while (av[2][i] != '\0') { ft_char2signal(pid, av[2][i]); i++; } ft_char2signal(pid, '\0'); return (0); }