Skip to content

Commit

Permalink
Prepare for Eyescale/CMake#533
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Eilemann authored and Stefan Eilemann committed Jan 18, 2017
1 parent a853636 commit 75fd37a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
11 changes: 9 additions & 2 deletions apps/progressMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,18 @@ class ProgressMonitor
std::map< std::string, Operation > _operations;
};

int main()
int main( const int argc, char** )
{
ProgressMonitor monitor;
if( argc > 1 )
{
std::cout << "lexis-progressMonitor: monitor lexis progress events"
<< std::endl;
return EXIT_SUCCESS;
}

ProgressMonitor monitor;
while( true )
monitor.update();

return EXIT_SUCCESS;
}
19 changes: 6 additions & 13 deletions apps/sendevent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,12 @@ void parseScript( const char* filename, Events& events )
parseScript( file, events );
}

void printUsageAndExit( const char* name, const int code, bool full = false )
void printUsageAndExit( int code, bool full = false )
{
std::cerr << "Usage: " << name
<< " [script]" << std::endl
<< " " << name << " --help" << std::endl;
std::cout << "Usage: lexis-sendEvent [--help][script]" << std::endl;
if (full)
{
std::cerr << R"(
std::cout << R"(
The script file contains a list of event. Each event is specified with the
following format:
event_name pause_in_seconds
Expand Down Expand Up @@ -229,20 +227,15 @@ void parseArguments( int argc, char** argv )
{
for( int i = 1; i != argc; ++i )
{
if( strcmp( argv[i], "--help" ) == 0 ||
strcmp( argv[i], "-h" ) == 0 )
{
printUsageAndExit( argv[0], 0, true );
}
if( strcmp( argv[i], "--help" ) == 0 || strcmp( argv[i], "-h" ) == 0 )
printUsageAndExit( EXIT_SUCCESS, true );
else if( scriptFile )
{
// This is an unexpected positional parameter
std::cerr << "Unexpected parameter" << std::endl;
printUsageAndExit( argv[0], -1 );
printUsageAndExit( EXIT_FAILURE );
}
else
{
scriptFile = argv[i];
}
}
}

0 comments on commit 75fd37a

Please sign in to comment.