Changeset 10804


Ignore:
Timestamp:
May 24, 2011, 7:34:26 PM (8 years ago)
Author:
tbretz
Message:
Simplified program options handling.
Location:
trunk/FACT++/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/drivectrl.cc

    r10774 r10804  
    10251025    catch (po::multiple_occurrences &e)
    10261026    {
    1027         cout << "Error: " << e.what() << " of '" << e.get_option_name() << "' option." << endl;
    1028         cout << endl;
     1027        cerr << "Program options invalid due to: " << e.what() << " of '" << e.get_option_name() << "'." << endl;
    10291028        return -1;
    10301029    }
    10311030#endif
    1032     catch (std::exception &e)
    1033     {
    1034         cout << "Error: " << e.what() << endl;
    1035         cout << endl;
    1036 
     1031    catch (exception& e)
     1032    {
     1033        cerr << "Program options invalid due to: " << e.what() << endl;
    10371034        return -1;
    10381035    }
    10391036
    1040     if (conf.HasPrint())
     1037    if (conf.HasVersion() || conf.HasPrint())
    10411038        return -1;
    1042 
    1043     if (conf.HasVersion())
    1044     {
    1045         FACT::PrintVersion(argv[0]);
    1046         return -1;
    1047     }
    10481039
    10491040    if (conf.HasHelp())
  • trunk/FACT++/src/fitsloader.cc

    r10795 r10804  
    2222 */
    2323 //****************************************************************
    24 #include "FACT.h"
    2524#include "Event.h"
    2625#include "StateMachineDim.h"
     
    681680        vm = conf.Parse(argc, argv);
    682681    }
     682#if BOOST_VERSION > 104000
     683    catch (po::multiple_occurrences &e)
     684    {
     685        cerr << "Program options invalid due to: " << e.what() << " of '" << e.get_option_name() << "'." << endl;
     686        return -1;
     687    }
     688#endif
    683689    catch (exception& e)
    684690    {
    685         cout << "Sorry, could not properly parse the program's arguments. returning" << endl;
    686         cout << e.what() << endl;
     691        cerr << "Program options invalid due to: " << e.what() << endl;
    687692        return -1;
    688693    }
    689694
    690     if (conf.HasPrint())
    691             return -1;
    692     if (conf.HasVersion())
    693     {
    694         FACT::PrintVersion(argv[0]);
     695    if (conf.HasVersion() || conf.HasPrint())
    695696        return -1;
    696     }
    697697
    698698    if (conf.HasHelp())
Note: See TracChangeset for help on using the changeset viewer.