mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-09-27 09:32:07 +08:00
Removed "exit" function call from CmdLine code. Now returning out of main.
This commit is contained in:
@@ -76,7 +76,12 @@ int main( int argc, const char** argv )
|
||||
cmd.add( fileArg );
|
||||
cmd.add( countryCodeArg );
|
||||
|
||||
cmd.parse( argc, argv );
|
||||
|
||||
if (cmd.parse( argc, argv ) == false)
|
||||
{
|
||||
// Error occured while parsing. Exit now.
|
||||
return 1;
|
||||
}
|
||||
|
||||
filename = fileArg.getValue();
|
||||
|
||||
|
@@ -240,14 +240,14 @@ class CmdLine : public CmdLineInterface
|
||||
* \param argc - Number of arguments.
|
||||
* \param argv - Array of arguments.
|
||||
*/
|
||||
void parse(int argc, const char * const * argv);
|
||||
bool parse(int argc, const char * const * argv);
|
||||
|
||||
/**
|
||||
* Parses the command line.
|
||||
* \param args - A vector of strings representing the args.
|
||||
* args[0] is still the program name.
|
||||
*/
|
||||
void parse(std::vector<std::string>& args);
|
||||
bool parse(std::vector<std::string>& args);
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -423,17 +423,17 @@ inline void CmdLine::add( Arg* a )
|
||||
}
|
||||
|
||||
|
||||
inline void CmdLine::parse(int argc, const char * const * argv)
|
||||
inline bool CmdLine::parse(int argc, const char * const * argv)
|
||||
{
|
||||
// this step is necessary so that we have easy access to
|
||||
// mutable strings.
|
||||
std::vector<std::string> args;
|
||||
for (int i = 0; i < argc; i++)
|
||||
args.push_back(argv[i]);
|
||||
parse(args);
|
||||
return parse(args);
|
||||
}
|
||||
|
||||
inline void CmdLine::parse(std::vector<std::string>& args)
|
||||
inline bool CmdLine::parse(std::vector<std::string>& args)
|
||||
{
|
||||
bool shouldExit = false;
|
||||
int estat = 0;
|
||||
@@ -497,7 +497,12 @@ inline void CmdLine::parse(std::vector<std::string>& args)
|
||||
shouldExit = true;
|
||||
}
|
||||
if (shouldExit)
|
||||
exit(estat);
|
||||
{
|
||||
//exit(estat);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool CmdLine::_emptyCombined(const std::string& s)
|
||||
|
@@ -83,14 +83,14 @@ class CmdLineInterface
|
||||
* \param argc - Number of arguments.
|
||||
* \param argv - Array of arguments.
|
||||
*/
|
||||
virtual void parse(int argc, const char * const * argv)=0;
|
||||
virtual bool parse(int argc, const char * const * argv)=0;
|
||||
|
||||
/**
|
||||
* Parses the command line.
|
||||
* \param args - A vector of strings representing the args.
|
||||
* args[0] is still the program name.
|
||||
*/
|
||||
void parse(std::vector<std::string>& args);
|
||||
bool parse(std::vector<std::string>& args);
|
||||
|
||||
/**
|
||||
* Returns the CmdLineOutput object.
|
||||
|
Reference in New Issue
Block a user