SCR/SCR3.1/TP4/mytimeout.c

25 lines
412 B
C

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <signal.h>
void kill_son(int){
if
int main(int argc, char **argv){
if (argc < 3){
printf("Usage : %s <nbsec> <com> [arg]", argv[0]);
return EXIT_FAILURE;
}
int secondes = (int) strtod(argv[1], NULL);
pid_t p;
p = fork();
switch(p){
case 0 :
execl("/usr/bin/sh" , "-c", argv[2])
case -1:
default: