void fonc_fils2(){ int k=0,j; initrec(); sigact_fils2.sa_handler=captfils2; sigaction(SIGINT,&sigact_fils2,NULL); while(k != -1){ k = attendreclic(); printf("\n retour de clic = %d",k); switch(k){ case 0 : kill(lespid[0], SIGINT); break; case 1 : kill(lespid[1], SIGINT); break; case 2 : kill(lespid[2], SIGINT); break; case 3 : for (j=0; j<3; j++) kill(lespid[j], SIGINT); break; default : break; } } printf("\n FILS2 :fin du fils2 apres clic sur FIN\n"); exit(5); }
void fonc_fils1(){ int i=0,j; sigact_fils1.sa_handler=captfils1; sigaction(SIGINT,&sigact_fils1,NULL); initrec(); while(i != -1){ i = attendreclic(); printf("\n retour de clic = %d",i); switch(i){ case 0 : kill(lespid[0], SIGINT); break; case 1 : kill(lespid[1], SIGINT); break; case 2 : kill(lespid[2], SIGINT); break; case 3 : kill(lespid[2], SIGINT); kill(lespid[0], SIGINT); kill(lespid[1], SIGINT); break; default : break; } } printf("\n FILS1 :fin du fils1 apres clic sur FIN\n"); exit(1); }
main () { int nlu, is, i=0; initrec(); /* creer rectangle rouge */ is = (int)b_fonc( (void *)i ); printf("is= %d\n",is); nlu = liretty("sortir ?",buf); printf("--fin--\n"); detruitrec(); /* detruire la fenetre rectangle */ exit(EXIT_SUCCESS); }