// SacRunner.cpp : Defines the entry point for the console application. // #include "inclfile.h" #include "..\SacCommunicator\SacCommunicator.h" #include "ntlog.hxx" #define BUFFER_SIZE 1024 LPCTSTR g_vConnectionParams[]= {"COM1", "9600", "8", "0", "1"}; BOOL g_bVerbose = FALSE; LPCTSTR g_szInputFileName= NULL; LPCTSTR g_szRespDir = NULL; LPCTSTR g_szLogFileName = NULL; LPCTSTR g_szNtLogFile = NULL; LPCTSTR g_szBvtLogFile = NULL; CNtLog g_ntlogLogger; UINT g_nPassTotal= 0, g_nFailTotal= 0; BOOL WriteBvtLog(LPCTSTR szBvtLogFile, double ratioPassLimit, UINT nPassTotal, UINT nFailTotal, time_t tmStart, time_t tmFinish) { fstream f(szBvtLogFile, std::ios::out); if (!f.is_open()) return FALSE; LPCTSTR vTestResults[]= {_T("NOCONFIG"), _T("PASS"), _T("FAIL")}; int nTestResult= !(nPassTotal||nFailTotal) ? 0 : (nPassTotal/(nPassTotal+nFailTotal)0&&(szBuffer[i-1]==' '||szBuffer[i-1]=='\t'); i--) ; szBuffer[i]='\0'; _tcscat(szBuffer, _T("\r")); // append CR for (i= 0; i "<< vstrStatus[bSuccess]<< std::endl; // report 2 screen if (bLog) { log_f<< "Line["<< nLineNo<< "]\\ Count[" < Command: "; log_f<< szBuffer<< "\tStatus: "<< vstrStatus[bSuccess]<< std::endl; // report to log file } if (bNtLog) if (bSuccess) if (strResponse.length()) g_ntlogLogger.Pass("Sac Responded -> L[%d], C[%d]: %s", nLineNo, i, szBuffer); else g_ntlogLogger.Warn("Sac NIL Response -> L[%d], C[%d]: %s", nLineNo, i, szBuffer); else g_ntlogLogger.Fail("Sac Communication Failed -> L[%d], C[%d]: %s", nLineNo, i, szBuffer); } } // finally goto Terminate; Terminate: SacCl.Disconnect(); // close connection log_f.close(); // close general log f.close(); // close input file if (bNtLog) { g_ntlogLogger.DetachThread(); g_ntlogLogger.Close(); } return TRUE; // that's it } BOOL GetArgs(int argc, LPTSTR argv[], LPCTSTR szErrBuffer= NULL) { if (*argv[1]!='-'&&*argv[1]!='/') g_szInputFileName= argv[1]; for (int i= 1; i