Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for(i = 0; i < argc-1; i++){
- pipe(pipes[i]);
- pids[i] = fork();
- if(pids[i] == 0){
- pids_child[i] = fork();
- if(pids_child[i]==0){
- close(pipes[i][0]);
- dup2(pipes[i][1],1);
- close(pipes[i][1]);
- execl(argv[i+1], argv[i+1], NULL);
- _exit(0);
- } else {
- close(pipes[i][1]);
- alarm(3);
- while((bytes_r = read(pipes[i][0], buf, 1024)) > 0){
- printf("merdas\n");
- if(!(strcmp("OK\n",buf))){
- succ++;
- printf("%d\n", succ);
- }
- }
- }
- } else {
- times[i] = 3 * count;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement