diff --git a/src/Arguments.cpp b/src/Arguments.cpp index 5ff14619c..231819ae5 100644 --- a/src/Arguments.cpp +++ b/src/Arguments.cpp @@ -634,6 +634,17 @@ bool Arguments::find_command (std::string& command) return false; } +//////////////////////////////////////////////////////////////////////////////// +std::string Arguments::find_limit () +{ + std::vector >::iterator arg; + for (arg = this->begin (); arg != this->end (); ++arg) + if (arg->first.find ("limit:") != std::string::npos) + return arg->first.substr (6); + + return ""; +} + //////////////////////////////////////////////////////////////////////////////// bool Arguments::is_multipart ( const std::string& input, @@ -1316,7 +1327,9 @@ Arguments Arguments::extract_read_only_filter () i->second == "exp" || i->second == "word") { - filter.push_back (*i); + // "limit" is special - it is recognized but not included in filters. + if (i->first.find ("limit:") == std::string::npos) + filter.push_back (*i); } // Error. @@ -1362,7 +1375,9 @@ Arguments Arguments::extract_write_filter () i->second == "exp" || i->second == "word") { - filter.push_back (*i); + // "limit" is special - it is recognized but not included in filters. + if (i->first.find ("limit:") == std::string::npos) + filter.push_back (*i); } // Error. @@ -1409,7 +1424,9 @@ Arguments Arguments::extract_modifications () i->second == "op" || i->second == "word") { - modifications.push_back (*i); + // "limit" is special - it is recognized but not included in filters. + if (i->first.find ("limit:") == std::string::npos) + modifications.push_back (*i); } // Error. diff --git a/src/Arguments.h b/src/Arguments.h index 6637035da..f4437108e 100644 --- a/src/Arguments.h +++ b/src/Arguments.h @@ -55,6 +55,7 @@ public: std::string combine (); bool find_command (std::string&); + std::string find_limit (); static bool is_multipart (const std::string&, std::vector &); static bool is_command (const std::vector &, std::string&); diff --git a/src/commands/CmdCustom.cpp b/src/commands/CmdCustom.cpp index 76df373bf..8a4ded861 100644 --- a/src/commands/CmdCustom.cpp +++ b/src/commands/CmdCustom.cpp @@ -277,10 +277,10 @@ void CmdCustom::getLimits (const std::string& report, int& rows, int& lines) // If the custom report has a defined limit, then allow a numeric override. // This is an integer specified as a filter (limit:10). -/* - if (context.task.has ("limit")) + std::string limit = context.args.find_limit (); + if (limit != "") { - if (context.task.get ("limit") == "page") + if (limit == "page") { if (screenheight == 0) screenheight = context.getHeight (); @@ -290,11 +290,10 @@ void CmdCustom::getLimits (const std::string& report, int& rows, int& lines) } else { - rows = atoi (context.task.get ("limit").c_str ()); + rows = (int) strtol (limit.c_str (), NULL, 10); lines = 0; } } -*/ } ////////////////////////////////////////////////////////////////////////////////