X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/d3b6a58593b94c9ff41c30a7517086d607f28f10..0df921108f5a3240db63336eddd3ab46bf80f424:/projects/sgconf/options.cpp diff --git a/projects/sgconf/options.cpp b/projects/sgconf/options.cpp index f5e423ad..49e04d64 100644 --- a/projects/sgconf/options.cpp +++ b/projects/sgconf/options.cpp @@ -134,18 +134,20 @@ if (*arg++ != '-') return false; if (*arg == '-') +{ return m_longName == arg + 1; +} return m_shortName == arg; } -PARSER_STATE OPTION::Parse(int argc, char ** argv) +PARSER_STATE OPTION::Parse(int argc, char ** argv, void * data) { if (!m_action) throw ERROR("Option is not defined."); try { - return m_action->Parse(argc, argv); + return m_action->Parse(argc, argv, data); } catch (const ACTION::ERROR & ex) { @@ -199,14 +201,16 @@ std::for_each(m_options.begin(), std::bind2nd(std::mem_fun_ref(&OPTION::Help), level + 1)); } -PARSER_STATE OPTION_BLOCK::Parse(int argc, char ** argv) +PARSER_STATE OPTION_BLOCK::Parse(int argc, char ** argv, void * data) { PARSER_STATE state(false, argc, argv); +if (state.argc == 0) + return state; while (state.argc > 0 && !state.stop) { std::vector