split argv parsing between root (un)related parts.

This commit is contained in:
2025-09-15 13:25:21 +02:00
parent 376b4f59ba
commit 4fbd678a88

View File

@@ -443,37 +443,15 @@ void musrfit_dump_root(char *fileName, PRunListCollection *runList)
*/
int main(int argc, char *argv[])
{
bool show_syntax = false;
int status;
bool keep_mn2_output = false;
bool chisq_only = false;
bool yaml_out = false;
bool title_from_data_file = false;
bool timeout_enabled = true;
bool reset_startup_file = false;
PStartupOptions startup_options;
startup_options.writeExpectedChisq = false;
startup_options.estimateN0 = false;
int number_of_cores=1;
#ifdef HAVE_GOMP
number_of_cores = omp_get_num_procs();
#endif
TString dump("");
char filename[1024];
// check syntax
// check syntax (root unrelated)
if (argc < 2) {
musrfit_syntax();
return PMUSR_WRONG_STARTUP_SYNTAX;
}
// add default shared library path /usr/local/lib if not already persent
const char *dsp = gSystem->GetDynamicPath();
if (strstr(dsp, "/usr/local/lib") == nullptr)
gSystem->AddDynamicPath("/usr/local/lib");
if (argc == 2) {
if (!strcmp(argv[1], "--version")) {
#ifdef HAVE_CONFIG_H
@@ -497,12 +475,8 @@ int main(int argc, char *argv[])
std::cout << std::endl << "musrfit: NeXus support NOT enabled." << std::endl << std::endl;
#endif
return PMUSR_SUCCESS;
} else if (!strcmp(argv[1], "--show-dynamic-path")) {
std::cout << std::endl << "musrfit: internal dynamic search paths for shared libraries/root dictionaries:";
std::cout << std::endl << " '" << gSystem->GetDynamicPath() << "'" << std::endl << std::endl;
return PMUSR_SUCCESS;
} else if (!strcmp(argv[1], "--help")) {
show_syntax = true;
show_syntax = true;
}
}
@@ -511,6 +485,39 @@ int main(int argc, char *argv[])
return PMUSR_WRONG_STARTUP_SYNTAX;
}
int status;
bool keep_mn2_output = false;
bool chisq_only = false;
bool yaml_out = false;
bool title_from_data_file = false;
bool timeout_enabled = true;
bool reset_startup_file = false;
PStartupOptions startup_options;
startup_options.writeExpectedChisq = false;
startup_options.estimateN0 = false;
int number_of_cores=1;
#ifdef HAVE_GOMP
number_of_cores = omp_get_num_procs();
#endif
TString dump("");
char filename[1024];
// add default shared library path /usr/local/lib if not already persent
const char *dsp = gSystem->GetDynamicPath();
if (strstr(dsp, "/usr/local/lib") == nullptr)
gSystem->AddDynamicPath("/usr/local/lib");
// check syntax (root related)
if (argc == 2) {
if (!strcmp(argv[1], "--show-dynamic-path")) {
std::cout << std::endl << "musrfit: internal dynamic search paths for shared libraries/root dictionaries:";
std::cout << std::endl << " '" << gSystem->GetDynamicPath() << "'" << std::endl << std::endl;
return PMUSR_SUCCESS;
}
}
strcpy(filename, "");
for (int i=1; i<argc; i++) {
if (strstr(argv[i], ".msr")) {