void VMsgLog::startConnect() { _connectTimer = new WTimer( this, (cbt)&VMsgLog::connectTimer, 32768 ); if( !_batserv ) { #ifdef __WINDOWS__ _vxdPresent = (bool)VxDPresent(); if( _vxdPresent ) { const char* res = VxDLink( LINK_NAME ); if( !res ) { WSystemService::sysExecBackground( _config->batserv() ); _connectionTries = CONNECTION_TRIES; _connecting = TRUE; _connectTimer->start( CONNECTION_INTERVAL ); addLine( "Connecting..." ); } else { WMessageDialog::info( this, "VxD: %s", res ); } } else { WMessageDialog::info( this, "VxD: WDEBUG.386 not present" ); } #endif } else { #ifdef __WINDOWS__ const char* err = BatchLink( NULL ); if( err ) { _localBatserv = TRUE; WSystemService::sysExecBackground( _config->batserv() ); _connectionTries = CONNECTION_TRIES; _connecting = TRUE; _connectTimer->start( CONNECTION_INTERVAL ); addLine( "Connecting..." ); } else { _serverConnected = TRUE; } #else const char* err = BatchLink( NULL ); if( err ) { _localBatserv = TRUE; WSystemService::sysExecBackground( _config->batserv() ); addLine( "Connecting..." ); _connectionTries = CONNECTION_TRIES; while( err && _connectionTries > 0 ) { WSystemService::sysSleep( CONNECTION_INTERVAL ); err = BatchLink( NULL ); _connectionTries -= 1; } } if( err ) { WMessageDialog::info( this, err ); _parent->deleteMsglog(); //zombie code at this point!!!!!!!!!!!!!! } else { _serverConnected = TRUE; } #endif } }
long ExecCmd( const char *file_in, const char *file_out, const char *cmd ) { int len; unsigned long stat; char *err; char buff[256]; int linked; err = BatchLink( NULL ); if( err != NULL ) { printf( "link error: %s\n", err ); exit( 1 ); } BatchSpawn( cmd ); for( ;; ) { len = BatchCollect( buff, sizeof( buff ), &stat ); if( len == -1 ) { printf( "done: status = %d\n", stat ); break; } else if( kbhit() ) { if( getch() == 'a' ) { BatchAbort(); } else { BatchCancel(); } } else if( len != 0 ) { buff[len] = '\0'; printf( "%s", buff ); fflush( stdout ); } } return( 1 ); }
void VMsgLog::connectTimer( WTimer* timer, DWORD ) { const char* err = "Unable to connect to batch server."; if( !_batserv ) { #ifdef __WINDOWS__ _serverConnected = ( VxDConnect() != 0 ); #endif } else { err = BatchLink( NULL ); if( !err ) { _serverConnected = TRUE; } } if( _serverConnected ) { timer->stop(); _connecting = FALSE; if( _runQueued ) { _runQueued = FALSE; doRun(); } } else if( _connectionTries == 0 ) { timer->stop(); _connecting = FALSE; WMessageDialog::info( this, err ); _parent->deleteMsglog(); //zombie code at this point!!!!!!!!!!!!!! } else { _connectionTries -= 1; } }