Ticket #6991: po.patch

File po.patch, 1.9 KB (added by driscoll@…, 10 years ago)
  • boost/program_options/detail/cmdline.hpp

     
    107107        std::vector<option> parse_disguised_long_option(
    108108            std::vector<std::string>& args);
    109109        std::vector<option> parse_terminator(
    110             std::vector<std::string>& args);
     110            std::vector<std::string>& args, bool alwaysStop);
    111111        std::vector<option> handle_additional_parser(
    112112            std::vector<std::string>& args);
    113113
  • libs/program_options/src/cmdline.cpp

     
    241241        if ((m_style & allow_short) && (m_style & allow_slash_for_short))
    242242            style_parsers.push_back(boost::bind(&cmdline::parse_dos_option, this, _1));
    243243
    244         style_parsers.push_back(boost::bind(&cmdline::parse_terminator, this, _1));
     244        style_parsers.push_back(boost::bind(&cmdline::parse_terminator, this, _1, false /* or true for the behavior I want */));
    245245
    246246        vector<option> result;
    247247        while(!args.empty())
     
    664664    }
    665665
    666666    vector<option>
    667     cmdline::parse_terminator(vector<string>& args)
     667    cmdline::parse_terminator(vector<string>& args, bool alwaysStop)
    668668    {
    669669        vector<option> result;
    670670        const string& tok = args[0];
    671         if (tok == "--")
     671        if (tok == "--" || alwaysStop)
    672672        {
    673             for(unsigned i = 1; i < args.size(); ++i)
     673            // Starting at index 1 skips the --.
     674            unsigned start = tok == "--" ? 1 : 0;
     675            for(unsigned i = start; i < args.size(); ++i)
    674676            {
    675677                option opt;
    676678                opt.value.push_back(args[i]);