std::signal(SIGFPE, (void(*)(int))floating_point_error_handler);
std::signal(SIGFPE, floating_point_error_handler);
int main(int argc, char* argv[]){    // Set boost filesystem default name check function to native. Its    // facilities are used with names the user controls, and users    // may specify names that are not portable. The default name check    // function should be set before using this boost library, to    // ensure that it's used uniformly.    fs::path::default_name_check(fs::native);    fs::path argv0(argv[0]);    // This line forces mpatrol to link when it otherwise might not.    // It has no other effect according to C99 7.20.3.2/2, second    // sentence.    std::free(0);    // TODO ?? Instead, consider a singleton that checks the control    // word upon destruction?    initialize_fpu();    if(SIG_ERR == std::signal(SIGFPE, (void(*)(int))floating_point_error_handler))        {        warning() << "Cannot install floating point error signal handler.\n";        return EXIT_FAILURE;        }// TODO ?? Factor out the getopt stuff, into a new function like this://    process_command_line(argc, argv);    int c;    int digit_optind = 0;    int this_option_optind = 1;    int option_index = 0;//    static char const* vfile[] = {"file", "archive", 0};//    static char const* vlist[] = {"one", "two", "three", 0};//    static char const* vopt[] = {"optional", "alternative", 0};    static struct Option long_options[] =      {//        {"do"      ,REQD_ARG, 0,   0, 0    , "do something"},        {"help"    ,NO_ARG,   0, 'h', 0    , "display this help and exit"},//        {"delete"  ,REQD_ARG, 0,   0, 0    , "delete something"},        {"license" ,NO_ARG,   0, 'l', 0    , "display license and exit"},        {"accept"  ,NO_ARG,   0, 'a', 0    , "accept license (-l to display)"},        {"selftest",NO_ARG,   0, 's', 0    , "perform self test and exit"},        {"profile" ,NO_ARG,   0, 'p', 0    , "set up for profiling and exit"},        {"illfile" ,REQD_ARG, 0, 'i', 0    , "run illustration"},        {"cnsfile" ,REQD_ARG, 0, 'c', 0    , "run census"},//        {"list"    ,LIST_ARG, 0,   0, 0    , "list"},//        {"opt"     ,OPT_ARG,  0,   0, 0    , "optional"},//        {"alt"     ,ALT_ARG,  0,   0, 0    , "alternative"},//        {"vfile"   ,REQD_ARG, 0,   0, vfile, "file type"},//        {"vlist"   ,LIST_ARG, 0,   0, vlist, "list type"},//        {"vopt"    ,OPT_ARG,  0,   0, vopt , "optional"},//        {"valt"    ,ALT_ARG,  0,   0, vopt , "alternative"},        {0         ,NO_ARG,   0,   0, 0    , ""}      };    bool license_accepted = false;    bool show_license     = false;    bool show_help        = false;    bool run_selftest     = false;    bool run_profile      = false;    bool run_illustration = false;    bool run_census       = false;    std::vector<std::string> ill_names;    std::vector<std::string> cns_names;    try        {        std::signal(SIGFPE, (void(*)(int))floating_point_error_handler);//        GetOpt  getopt_long (argc, argv, "abc:d:o::0123456789",        GetOpt  getopt_long (argc, argv, "ac:hi:ls",                             long_options, &option_index, 1);        while(EOF != (c = getopt_long ()))          {            switch (c)              {              case 0:                {                char const* current_option = long_options[option_index].name;                std::printf("option %s", current_option);                if(getopt_long.optarg)                    {                    std::printf (" with arg %s", getopt_long.optarg);                    }                std::printf ("\n");                }                break;              case '0':              case '1':              case '2':              case '3':              case '4':              case '5':              case '6':              case '7':              case '8':              case '9':                {                if(digit_optind != 0 && digit_optind != this_option_optind)                    {                    std::printf ("digits occur in two different argv-elements.\n");                    }                digit_optind = this_option_optind;                std::printf ("option %c\n", c);                }                break;              case 'a':                {                license_accepted = true;                }                break;              case 'b':                {                std::printf ("option b\n");                }                break;              case 'c':                {                run_census = true;                cns_names.push_back(getopt_long.optarg);                }                break;              case 'd':                {                std::printf ("option d with value '%s'\n", getopt_long.optarg);                }                break;              case 'h':                {                show_help = true;                }                break;              case 'i':                {                run_illustration = true;                ill_names.push_back(getopt_long.optarg);                }                break;              case 'l':                {                show_license = true;                }                break;              case 's':                {                run_selftest = true;                }                break;              case 'p':                {                run_profile = true;                }                break;              case 'o':                {                std::printf ("option o");                if(getopt_long.optarg)                    {                    std::printf (" with value '%s'", getopt_long.optarg);                    }                std::printf ("\n");                }                break;              case '?':                break;              default:                std::printf ("? getopt returned character code 0%o ?\n", c);              }          }        if((c = getopt_long.optind) < argc)          {            std::printf ("non-option ARGV-elements: ");            while (c < argc)              std::printf ("%s ", argv[c++]);            std::printf ("\n");          }        if(!license_accepted)            {            std::cerr << license_notices() << "\n\n";            }        if(show_license)            {            std::cerr << license_as_text() << "\n\n";            return EXIT_SUCCESS;            }        if(show_help)            {            getopt_long.usage();            return EXIT_SUCCESS;            }        if(run_selftest)            {            SelfTest();            return EXIT_SUCCESS;            }        if(run_profile)            {            Profile();            return EXIT_SUCCESS;            }        if(run_illustration)            {            RunIllustrationFromFile run_functor = std::for_each                (ill_names.begin()                ,ill_names.end()                ,RunIllustrationFromFile(std::cout)                );            std::cerr                << "File"                << ((1U < ill_names.size()) ? "s" : "")                << ":\n"                ;            std::copy                (ill_names.begin()                ,ill_names.end()                ,std::ostream_iterator<std::string>(std::cerr, "\n")                );            std::cerr                << "    Input:        "                << 1000.0 * run_functor.time_for_input                << " milliseconds\n"                ;            std::cerr                << "    Calculations: "                << 1000.0 * run_functor.time_for_calculations                << " milliseconds\n"                ;            std::cerr                << "    Output:       "                << 1000.0 * run_functor.time_for_output                << " milliseconds\n"                ;            }        if(run_census)            {            std::for_each                (ill_names.begin()                ,ill_names.end()// TODO ?? expunge                ,RunCensusDeprecated<std::string>()                ,RunCensusDeprecated()                );            }        }    catch(std::exception& e)        {        std::cerr << "Fatal exception: " << e.what() << std::endl;        return EXIT_FAILURE;        }    catch(...)        {        std::cerr << "Fatal exception: [no detail available]" << std::endl;        return EXIT_FAILURE;        }}