Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/builder.cpp

    r0fb9f6 r99fcaf  
    5353
    5454#include <cstring>
    55 #include <cstdlib>
    5655
    5756#include "analysis_bonds.hpp"
     
    14951494 */
    14961495static int ParseCommandLineOptions(int argc, char **argv, MoleculeListClass *&molecules, periodentafel *&periode,
    1497                                    config& configuration, char *&ConfigFileName, set<int> &ArgcList)
     1496                                   config& configuration, char *&ConfigFileName, list<int> &ArgcList)
    14981497{
    14991498  Vector x,y,z,n;  // coordinates for absolute point in cell volume
     
    15261525          case 'H':
    15271526          case '?':
    1528             ArgcList.insert(argptr-1);
     1527            ArgcList.push_back(argptr-1);
    15291528            return(1);
    15301529            break;
    15311530          case 'v':
    1532             setVerbosity(atoi(argv[argptr]));
    1533             ArgcList.insert(argptr-1);
    1534             ArgcList.insert(argptr);
    1535             argptr++;
     1531            ArgcList.push_back(argptr-1);
     1532            return(1);
    15361533            break;
    15371534          case 'V':
    1538             ArgcList.insert(argptr-1);
    1539             return(1);
     1535            ArgcList.push_back(argptr-1);
     1536            ArgcList.push_back(argptr);
     1537            argptr++;
    15401538            break;
    15411539          case 'B':
     
    24902488  ActionRegistry::purgeInstance();
    24912489  ActionHistory::purgeInstance();
    2492   Memory::getState();
    24932490}
    24942491
     
    25022499    char **Arguments = NULL;
    25032500    int ArgcSize = 0;
     2501    int ExitFlag = 0;
    25042502    bool ArgumentsCopied = false;
    25052503
    2506     // print version check whether arguments are present at all
    25072504    cout << ESPACKVersion << endl;
    2508     if (argc < 2) {
    2509       cout << "Obtain help with " << argv[0] << " -h." << endl;
    2510       cleanUp();
    2511       Memory::getState();
    2512       return(1);
    2513     }
    2514 
    25152505
    25162506    setVerbosity(0);
     
    25182508    ActionHistory::init();
    25192509
    2520     // from this moment on, we need to be sure to deeinitialize in the correct order
    2521     // this is handled by the cleanup function
    2522     atexit(cleanUp);
    2523 
    25242510    // Parse command line options and if present create respective UI
    25252511    {
    2526       set<int> ArgcList;
    2527       ArgcList.insert(0); // push back program!
    2528       ArgcList.insert(1); // push back config file name
     2512      list<int> ArgcList;
     2513      ArgcList.push_back(0); // push back program!
     2514      ArgcList.push_back(1); // push back config file name
    25292515      char ConfigFileName[MAXSTRINGSIZE];
    25302516      // handle arguments by ParseCommandLineOptions()
    2531       ParseCommandLineOptions(argc,argv,World::getInstance().getMolecules(),World::getInstance().getPeriode(),*World::getInstance().getConfig(), (char *&)ConfigFileName, ArgcList);
     2517      ExitFlag = ParseCommandLineOptions(argc,argv,World::getInstance().getMolecules(),World::getInstance().getPeriode(),*World::getInstance().getConfig(), (char *&)ConfigFileName, ArgcList);
    25322518      // copy all remaining arguments to a new argv
    25332519      Arguments = Malloc<char *>(ArgcList.size(), "main - **Arguments");
    25342520      cout << "The following arguments are handled by CommandLineParser: ";
    2535       for (set<int>::iterator ArgcRunner = ArgcList.begin(); ArgcRunner != ArgcList.end(); ++ArgcRunner) {
     2521      for (list<int>::iterator ArgcRunner = ArgcList.begin(); ArgcRunner != ArgcList.end(); ++ArgcRunner) {
    25362522        Arguments[ArgcSize] = Malloc<char>(strlen(argv[*ArgcRunner])+2, "main - *Arguments[]");
    25372523        strcpy(Arguments[ArgcSize], argv[*ArgcRunner]);
     
    25722558  }
    25732559
    2574   return (0);
     2560  cleanUp();
     2561  Memory::getState();
     2562  return (ExitFlag == 1 ? 0 : ExitFlag);
    25752563}
    25762564
Note: See TracChangeset for help on using the changeset viewer.