phonebook: exit with appropriate code.
This commit is contained in:
parent
168ee430f4
commit
9faed6a95b
|
@ -138,6 +138,7 @@ usage(ostream &os, int exc)
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
int retc = 1;
|
||||||
bool help = false;
|
bool help = false;
|
||||||
std::string fileName(pbFile);
|
std::string fileName(pbFile);
|
||||||
|
|
||||||
|
@ -190,18 +191,24 @@ main(int argc, char *argv[])
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case Subcommand::Status::OK:
|
case Subcommand::Status::OK:
|
||||||
std::cout << "[+] OK\n";
|
std::cout << "[+] OK\n";
|
||||||
|
retc = 0;
|
||||||
break;
|
break;
|
||||||
case Subcommand::Status::NotEnoughArgs:
|
case Subcommand::Status::NotEnoughArgs:
|
||||||
|
delete flags;
|
||||||
usage(cerr, 1);
|
usage(cerr, 1);
|
||||||
break;
|
break;
|
||||||
case Subcommand::Status::Failed:
|
case Subcommand::Status::Failed:
|
||||||
cerr << "[!] '"<< command << "' failed\n";
|
cerr << "[!] '"<< command << "' failed\n";
|
||||||
break;
|
break;
|
||||||
case Subcommand::Status::CommandNotRegistered:
|
case Subcommand::Status::CommandNotRegistered:
|
||||||
|
delete flags;
|
||||||
cerr << "[!] '" << command << "' not registered.\n";
|
cerr << "[!] '" << command << "' not registered.\n";
|
||||||
usage(cerr, 1);
|
usage(cerr, 1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
delete flags;
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return retc;
|
||||||
}
|
}
|
Loading…
Reference in New Issue