/* ECP: FILEname=fig13_20.c */ /* 1*/ /* Simple Demonstration Of Signal Handling */ /* 2*/ /* Buffers Are Flushed On Interrupt */ /* 3*/ #include /* 4*/ #include /* 5*/ #include /* 6*/ #include /* 7*/ void /* 8*/ Doexit( void ) /* 9*/ { /*10*/ exit( SIGINT ); /* Flush Buffers */ /*11*/ } /*12*/ main( void ) /*13*/ { /*14*/ signal( SIGINT, Doexit ); /*15*/ for( ; ; ) /*16*/ { /*17*/ sleep( 1 ); /*18*/ printf( "junk" ); /*19*/ } /*20*/ return 0; /*21*/ }