Initial commit
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "ServiceThread.h"
|
||||
#include "debug.h"
|
||||
|
||||
int g_eDebug = 0;
|
||||
int g_iChkStyle = 0;
|
||||
|
||||
extern int g_iSignal;
|
||||
extern CSema* g_pSemaService;
|
||||
CSema* g_pSemaStop = NULL;
|
||||
|
||||
void CmdDebugService()
|
||||
{
|
||||
CServiceThread* pServiceThread = new CServiceThread();
|
||||
pServiceThread->Resume();
|
||||
|
||||
g_pSemaStop = new CSema(NULL, 0);
|
||||
g_pSemaStop->ActP();
|
||||
|
||||
pServiceThread->Terminate();
|
||||
if( g_pSemaService ){
|
||||
if( g_pSemaService->ActP(15000) ){
|
||||
printf("service eixt innormally\n");
|
||||
}
|
||||
delete g_pSemaService;
|
||||
}
|
||||
|
||||
delete pServiceThread;
|
||||
delete g_pSemaStop;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if ( (argc > 1) &&((*argv[1] == '-') || (*argv[1] == '/')) ){
|
||||
if ( strcasecmp( "debug", argv[1]+1 ) == 0 ){
|
||||
g_eDebug = 4;
|
||||
|
||||
if( argc>2 ){
|
||||
if ( strcasecmp( "f", argv[2] ) == 0 ){
|
||||
g_eDebug = 1;
|
||||
}
|
||||
else if ( strcasecmp( "n", argv[2] ) == 0 ){
|
||||
g_eDebug = 2;
|
||||
}
|
||||
else if ( strcasecmp( "s", argv[2] ) == 0 ){
|
||||
g_eDebug = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( strcasecmp( "check", argv[1]+1 ) == 0 && argc>2 ){
|
||||
g_iChkStyle = atoi(argv[2]);
|
||||
|
||||
if( g_iChkStyle>0 ){
|
||||
g_eDebug = 3;
|
||||
}
|
||||
}
|
||||
|
||||
CmdDebugService();
|
||||
}
|
||||
|
||||
return g_iSignal;
|
||||
}
|
||||
Reference in New Issue
Block a user