Clean up error handling a bit. Add / as a seperator for command line arguments. This is just a big old ugly hack.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@974 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2001-10-24 06:21:56 +00:00
parent 7eadfa1db8
commit f038acbee2
2 changed files with 12 additions and 6 deletions

View File

@ -57,7 +57,8 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
while (*ArgName == '-') ++ArgName; // Eat leading dashes
const char *ArgNameEnd = ArgName;
while (*ArgNameEnd && *ArgNameEnd != '=') ++ArgNameEnd; // Scan till end
while (*ArgNameEnd && *ArgNameEnd != '=' &&
*ArgNameEnd != '/') ++ArgNameEnd; // Scan till end
Value = ArgNameEnd;
if (*Value) // If we have an equals sign...
@ -72,7 +73,7 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
if (Handler == 0) {
cerr << "Unknown command line argument '" << argv[i] << "'. Try: "
<< argv[0] << " --help\n'";
<< argv[0] << " --help'\n";
ErrorParsing = true;
continue;
}
@ -111,8 +112,10 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
switch (I->second->getNumOccurancesFlag()) {
case Required:
case OneOrMore:
if (I->second->getNumOccurances() == 0)
if (I->second->getNumOccurances() == 0) {
I->second->error(" must be specified at least once!");
ErrorParsing = true;
}
// Fall through
default:
break;

View File

@ -57,7 +57,8 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
while (*ArgName == '-') ++ArgName; // Eat leading dashes
const char *ArgNameEnd = ArgName;
while (*ArgNameEnd && *ArgNameEnd != '=') ++ArgNameEnd; // Scan till end
while (*ArgNameEnd && *ArgNameEnd != '=' &&
*ArgNameEnd != '/') ++ArgNameEnd; // Scan till end
Value = ArgNameEnd;
if (*Value) // If we have an equals sign...
@ -72,7 +73,7 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
if (Handler == 0) {
cerr << "Unknown command line argument '" << argv[i] << "'. Try: "
<< argv[0] << " --help\n'";
<< argv[0] << " --help'\n";
ErrorParsing = true;
continue;
}
@ -111,8 +112,10 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
switch (I->second->getNumOccurancesFlag()) {
case Required:
case OneOrMore:
if (I->second->getNumOccurances() == 0)
if (I->second->getNumOccurances() == 0) {
I->second->error(" must be specified at least once!");
ErrorParsing = true;
}
// Fall through
default:
break;