Skip to content

Commit

Permalink
Passed some command line arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
santanusinha committed Aug 14, 2024
1 parent a2fe77f commit 36ec688
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

env

exec ./test-server
exec ./test-server $@
11 changes: 10 additions & 1 deletion src/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,16 @@ struct AtomicCounter {
volatile int counter_;
};

int main() {
int main(int argc, char *argv[]) {
std::cout << "name of program: " << argv[0] << '\n' ;

if( argc > 1 )
{
std::cout << "there are " << argc-1 << " (more) arguments, they are:\n" ;

std::copy( argv+1, argv+argc, std::ostream_iterator<const char*>( std::cout, "\n" ) ) ;
}

auto die = secure_getenv("DIE_FAST");
if(NULL != die) {
auto dieAfter = atoi(die);
Expand Down

0 comments on commit 36ec688

Please sign in to comment.