mirror of
https://github.com/nasa/trick.git
synced 2024-12-18 20:57:55 +00:00
Merge pull request #838 from nasa/#837-cmd-line
iss #837 make command line arguments position independent
This commit is contained in:
commit
101ae55bb0
@ -158,9 +158,19 @@ int Trick::CommandLineArguments::process_sim_args(int nargs , char **args) {
|
||||
|
||||
if ( argc > 1 ) {
|
||||
|
||||
/* First argument is the input file name: '<Run_dir>/<file_name>' */
|
||||
input_file = argv[1] ;
|
||||
run_dir = argv[1] ;
|
||||
/* First occurnance of "RUN_*" is the input file name: '<Run_dir>/<file_name>'.
|
||||
If not found, defaults to first argument */
|
||||
|
||||
input_file = argv[1];
|
||||
run_dir = argv[1];
|
||||
|
||||
for(int ii = 1; ii < argc; ii++) {
|
||||
if(std::string(argv[ii]).find("RUN_") != std::string::npos) {
|
||||
input_file = argv[ii];
|
||||
run_dir = argv[ii];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
found = run_dir.find_last_of("/") ;
|
||||
if ( found != std::string::npos ) {
|
||||
@ -176,7 +186,7 @@ int Trick::CommandLineArguments::process_sim_args(int nargs , char **args) {
|
||||
|
||||
output_dir = run_dir ;
|
||||
|
||||
for (ii = 2; ii < argc; ii++) {
|
||||
for (ii = 1; ii < argc; ii++) {
|
||||
if (!strncmp("-OO", argv[ii], (size_t) 3) || !strncmp("-O", argv[ii], (size_t) 2)) {
|
||||
if (ii == ( argc - 1 )) {
|
||||
std::cerr << "\nERROR: No directory specified after -O or -OO argument" << std::endl ;
|
||||
|
@ -36,7 +36,7 @@ int Trick::InputProcessor::process_sim_args() {
|
||||
input_file = command_line_args_get_input_file() ;
|
||||
|
||||
/* Process all other calling arguments */
|
||||
for (i = 2; i < argc; i++) {
|
||||
for (i = 1; i < argc; i++) {
|
||||
|
||||
/*
|
||||
* If there are more than 2 calling arguments
|
||||
|
@ -77,7 +77,7 @@ int Trick::MSSocket::process_sim_args() {
|
||||
/** @par Detailed Design */
|
||||
|
||||
/** @li search for the "-p" argument. If found get the master identifier as the next argument */
|
||||
for (ii = 2; ii < argc; ii++) {
|
||||
for (ii = 1; ii < argc; ii++) {
|
||||
if (!strncmp("-p", argv[ii], (size_t) 2)) {
|
||||
if (argc >= ii + 1) {
|
||||
sync_port_tag = argv[ii+1] ;
|
||||
|
Loading…
Reference in New Issue
Block a user