static void handler( int signum )
   {
   int rc;

   rc = DosStopSession( STOP_SESSION_ALL, sess_id );
   printf( "DosStopSession rc = %d\n", rc );
   rc = DosClose( handle );
   printf( "DosClose rc = %d\n", rc );
   rc = DosDelete( tempfile );
   printf( "DosDelete rc = %d\n", rc );

   exit( EXIT_FAILURE );

   signum = 0;
   }
Exemple #2
0
/* stop specified program */
void
stop_pgm(PROG* prog)
{
QMSG q_mess;		/* queue message */
int i = 0;
	if (!prog->valid) {
	    cleanup_pgm(prog);
	    return;
	}
	DosStopSession(STOP_SESSION_SPECIFIED, prog->session_id);
	while (prog->valid && (i < 100)) {
	    /* wait for termination queue message to cause cleanup_pgm() to be called */
  	    if (WinGetMsg(hab, &q_mess, 0L, 0, 0))
	        WinDispatchMsg(hab, &q_mess);
	    i++;
	}
	if (i >= 100)
	    gserror(0, "can't stop program", MB_ICONHAND, SOUND_ERROR);
/* cleanup should already have occurred */
	cleanup_pgm(prog);
}