static void mouse_close (void) { ms_close(); if (ms.currentinthandler != NULL) /* Restore old interrupt. */ sigaction(SIGINT, &ms.oldsiga, NULL); }
void mouse_close() { ms_close(); if (currentinthandler != NULL) /* Restore old interrupt. */ sigaction(SIGINT, &oldsiga, NULL); }
int main (int argc, char **argv) { // // Get and validate the command line; setup global configuration variables. // if (getArgs(argc,argv) == -1) { exit(1); } // // Initialize the Dialogic resources. // if (init() == -1) { exit(1); } // // Loop forever until the DTMF state machine is satisfied. // while (1) { printf("DTMF state machine. dtmfIndex: %d dtmf: %s expecting: %c\n",dtmfIndex,dtmf,dtmf[dtmfIndex]); if (dx_recvox(dx, "c:\\junk.vox", &tpt, NULL, EV_SYNC) == -1) { printf("dx_recvox failed: %s\n",ATDV_ERRMSGP(dx)); break; } // Make sure we terminated due to DTMF if (ATDX_TERMMSK(dx) & TM_MAXDTMF) { printf("DTMF happened\n"); // Get the digit that was received. if ((digits = dx_getdig(dx,&tpt,&digitBuf,EV_SYNC)) == -1) { printf("dx_getdig() failed: %s\n",ATDV_ERRMSGP(dx)); break; } printf("got digit: %c\n",digitBuf.dg_value[0]); if (digitBuf.dg_value[0] == dtmf[dtmfIndex]) { dtmfIndex++; if (dtmfIndex == strlen(dtmf)) { printf(" END OF STATE MACHINE!\n"); break; } printf(" and it matches!\n"); } else { printf(" no match.\n"); dtmfIndex = 0; } dx_clrdigbuf(dx); } else { printf("Some other termination mask.\n"); } } // // Shutdown and exit. // ms_close(msi); dx_close(dx); exit(0); }
static void closeMouse(void) { if (ms) { ms_setCallback(ms, 0); ms_close(ms); ms_delete(ms); ms= 0; } }