diff options
author | Andreas Baumann <abaumann@yahoo.com> | 2009-03-28 08:28:30 +0100 |
---|---|---|
committer | Andreas Baumann <abaumann@yahoo.com> | 2009-03-28 08:28:30 +0100 |
commit | 03d693a59e880e33e895b29f5cc1ff849c8945fe (patch) | |
tree | 12467fd14ba7b1eaacd6ee3010ad3c9809ee78c7 /tests | |
parent | 8cd8c5a31ccd476ec943253a70e17f19aaa8c873 (diff) | |
download | wolfbones-03d693a59e880e33e895b29f5cc1ff849c8945fe.tar.gz wolfbones-03d693a59e880e33e895b29f5cc1ff849c8945fe.tar.bz2 |
fixed foreground mode of testservice, can detect console mode now
Diffstat (limited to 'tests')
-rw-r--r-- | tests/service/testservice.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/service/testservice.c b/tests/service/testservice.c index 478dbc4..ddc0347 100644 --- a/tests/service/testservice.c +++ b/tests/service/testservice.c @@ -65,7 +65,14 @@ void __cdecl _tmain( int argc, TCHAR *argv[] ) { /* called as service, dispatch the main service thread */ if( argc < 2 ) { - (void)wolf_service_start( SERVICE_NAME, &service_main ); + wolf_error_t error; + + error = wolf_service_start( SERVICE_NAME, &service_main ); + if( error == WOLF_ERR_INVALID_STATE ) { + /* running in console */ + (void)wolf_service_start_console( SERVICE_NAME, &service_main, argc, argv ); + } + /* here we get when the service is stopping */ return; } @@ -79,7 +86,6 @@ void __cdecl _tmain( int argc, TCHAR *argv[] ) { printf( " /help show this help page\r\n" ); printf( " /install install the service\r\n" ); printf( " /remove remove the service\r\n" ); - printf( " /foreground run as console application\r\n" ); } else if( strcasecmp( argv[1], "/install" ) == 0 ) { wolf_service_params_t params; params.service_name = SERVICE_NAME; @@ -87,8 +93,6 @@ void __cdecl _tmain( int argc, TCHAR *argv[] ) { (void)wolf_service_install( params ); } else if( strcasecmp( argv[1], "/remove" ) == 0 ) { (void)wolf_service_remove( SERVICE_NAME ); - } else if( strcasecmp( argv[1], "/foreground" ) == 0 ) { - (void)wolf_service_start_console( SERVICE_NAME, &service_main, argc, argv ); } else { fprintf( stderr, "Illegal option '%s'\r\n", argv[1] ); } |