Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/builder.cpp

    r99fcaf r0fb9f6  
    5353
    5454#include <cstring>
     55#include <cstdlib>
    5556
    5657#include "analysis_bonds.hpp"
     
    14941495 */
    14951496static int ParseCommandLineOptions(int argc, char **argv, MoleculeListClass *&molecules, periodentafel *&periode,
    1496                                    config& configuration, char *&ConfigFileName, list<int> &ArgcList)
     1497                                   config& configuration, char *&ConfigFileName, set<int> &ArgcList)
    14971498{
    14981499  Vector x,y,z,n;  // coordinates for absolute point in cell volume
     
    15251526          case 'H':
    15261527          case '?':
    1527             ArgcList.push_back(argptr-1);
     1528            ArgcList.insert(argptr-1);
    15281529            return(1);
    15291530            break;
    15301531          case 'v':
    1531             ArgcList.push_back(argptr-1);
    1532             return(1);
     1532            setVerbosity(atoi(argv[argptr]));
     1533            ArgcList.insert(argptr-1);
     1534            ArgcList.insert(argptr);
     1535            argptr++;
    15331536            break;
    15341537          case 'V':
    1535             ArgcList.push_back(argptr-1);
    1536             ArgcList.push_back(argptr);
    1537             argptr++;
     1538            ArgcList.insert(argptr-1);
     1539            return(1);
    15381540            break;
    15391541          case 'B':
     
    24882490  ActionRegistry::purgeInstance();
    24892491  ActionHistory::purgeInstance();
     2492  Memory::getState();
    24902493}
    24912494
     
    24992502    char **Arguments = NULL;
    25002503    int ArgcSize = 0;
    2501     int ExitFlag = 0;
    25022504    bool ArgumentsCopied = false;
    25032505
     2506    // print version check whether arguments are present at all
    25042507    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
    25052515
    25062516    setVerbosity(0);
     
    25082518    ActionHistory::init();
    25092519
     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
    25102524    // Parse command line options and if present create respective UI
    25112525    {
    2512       list<int> ArgcList;
    2513       ArgcList.push_back(0); // push back program!
    2514       ArgcList.push_back(1); // push back config file name
     2526      set<int> ArgcList;
     2527      ArgcList.insert(0); // push back program!
     2528      ArgcList.insert(1); // push back config file name
    25152529      char ConfigFileName[MAXSTRINGSIZE];
    25162530      // handle arguments by ParseCommandLineOptions()
    2517       ExitFlag = ParseCommandLineOptions(argc,argv,World::getInstance().getMolecules(),World::getInstance().getPeriode(),*World::getInstance().getConfig(), (char *&)ConfigFileName, ArgcList);
     2531      ParseCommandLineOptions(argc,argv,World::getInstance().getMolecules(),World::getInstance().getPeriode(),*World::getInstance().getConfig(), (char *&)ConfigFileName, ArgcList);
    25182532      // copy all remaining arguments to a new argv
    25192533      Arguments = Malloc<char *>(ArgcList.size(), "main - **Arguments");
    25202534      cout << "The following arguments are handled by CommandLineParser: ";
    2521       for (list<int>::iterator ArgcRunner = ArgcList.begin(); ArgcRunner != ArgcList.end(); ++ArgcRunner) {
     2535      for (set<int>::iterator ArgcRunner = ArgcList.begin(); ArgcRunner != ArgcList.end(); ++ArgcRunner) {
    25222536        Arguments[ArgcSize] = Malloc<char>(strlen(argv[*ArgcRunner])+2, "main - *Arguments[]");
    25232537        strcpy(Arguments[ArgcSize], argv[*ArgcRunner]);
     
    25582572  }
    25592573
    2560   cleanUp();
    2561   Memory::getState();
    2562   return (ExitFlag == 1 ? 0 : ExitFlag);
     2574  return (0);
    25632575}
    25642576
Note: See TracChangeset for help on using the changeset viewer.