diff --git a/src/musrfit.cpp b/src/musrfit.cpp index eac54fca..a414a590 100644 --- a/src/musrfit.cpp +++ b/src/musrfit.cpp @@ -478,6 +478,7 @@ int main(int argc, char *argv[]) bool keep_mn2_output = false; bool chisq_only = false; TString dump(""); + char filename[256]; // check syntax if (argc < 2) { @@ -502,15 +503,11 @@ int main(int argc, char *argv[]) return PMUSR_WRONG_STARTUP_SYNTAX; } - // check file name - if (!strstr(argv[1], ".msr")) { - cout << endl << "**ERROR** " << argv[1] << " is not a msr-file!" << endl; - musrfit_syntax(); - return PMUSR_WRONG_STARTUP_SYNTAX; - } - - for (int i=2; iReadMsrFile(); if (status != PMUSR_SUCCESS) { switch (status) { case PMUSR_MSR_FILE_NOT_FOUND: - cout << endl << "**ERROR** couldn't find " << argv[1] << endl << endl; + cout << endl << "**ERROR** couldn't find " << filename << endl << endl; break; case PMUSR_MSR_SYNTAX_ERROR: - cout << endl << "**SYNTAX ERROR** in file " << argv[1] << ", full stop here." << endl << endl; + cout << endl << "**SYNTAX ERROR** in file " << filename << ", full stop here." << endl << endl; break; default: cout << endl << "**UNKOWN ERROR** when trying to read the msr-file" << endl << endl; @@ -658,9 +661,9 @@ int main(int argc, char *argv[]) cout << endl << "will write dump file ..." << endl; dump.ToLower(); if (dump.Contains("ascii")) - musrfit_dump_ascii(argv[1], runListCollection); + musrfit_dump_ascii(filename, runListCollection); else if (dump.Contains("root")) - musrfit_dump_root(argv[1], runListCollection); + musrfit_dump_root(filename, runListCollection); else cout << endl << "do not know format " << dump.Data() << ", sorry :-| " << endl; } @@ -668,14 +671,14 @@ int main(int argc, char *argv[]) // rename MINUIT2.OUTPUT and MINUIT2.root file if wanted if (keep_mn2_output && !chisq_only) { // 1st rename MINUIT2.OUTPUT - TString fln = TString(argv[1]); + TString fln = TString(filename); char ext[32]; strcpy(ext, "-mn2.output"); fln.ReplaceAll(".msr", 4, ext, strlen(ext)); gSystem->CopyFile("MINUIT2.OUTPUT", fln.Data(), kTRUE); // 2nd rename MINUIT2.ROOT - fln = TString(argv[1]); + fln = TString(filename); strcpy(ext, "-mn2.root"); fln.ReplaceAll(".msr", 4, ext, strlen(ext)); gSystem->CopyFile("MINUIT2.root", fln.Data(), kTRUE);