_CP_interrupt is a global C integer which contains the last D3 interrupt that occurred. This value is the same as that returned by the BASIC function system(37). It is available when linking with the D3 libraries.
int _CP_interrupt;
/* Stops looping when some sort of interrupt occurs (like a break or a message). */ _CP_unix_env(); while (!_CP_interrupt) sleep(1); /* wait for something */ printf("I woke up!!!!\n");