rendered paste body#include <sys/types.h>
#include <unistd.h>
#include <sys/wait.h>
void my_putchar(char c)
{
write(1,&c,1);
}
int my_putstr(char *str)
{
while (*str != '\0')
{
my_putchar(*str);
str++;
}
}
void aff_err(char *str)
{
my_putstr("error: ");
my_putstr(str);
my_putchar('\n');
exit(1);
}
int main()
{
pid_t pid;
if ((pid = fork()) < 0)
aff_err("fork");
if (pid)
{
int status;
my_putstr("Pere : j'attends mon fils...\n");
wait(&status);
my_putstr("Pere : a bientot\n");
}
else
{
sleep(1);
my_putstr("Fils : me voila\n");
}
}