21 lines
346 B
C
21 lines
346 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
#include <sys/wait.h>
|
|
#include <string.h>
|
|
|
|
int main(int argc, char *argv[]) {
|
|
int n = argc - 2;
|
|
pid_t pids[n];
|
|
|
|
for (int i = 0; i < n; i++)
|
|
{
|
|
pids[i] = fork();
|
|
}
|
|
for (int i = 0; i < n; i++)
|
|
{
|
|
waitpid(pids[i], NULL, 0);
|
|
}
|
|
return 0;
|
|
}
|