Commit d581b7d7 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

ENH: ignore lone dash on the command-line (issue #553)

- can inadvertently arise from TAB-completion, but an option without a
  name doesn't make sense, we trap this and emit a warning.
parent c614110d
......@@ -480,6 +480,7 @@ Foam::argList::argList
// Check arguments and options, argv[0] was already handled
int nArgs = 1;
HashTable<string>::const_iterator optIter;
for (int argI = 1; argI < args_.size(); ++argI)
{
argListStr_ += ' ';
......@@ -489,15 +490,20 @@ Foam::argList::argList
{
const char *optionName = &args_[argI][1];
if
if (!*optionName)
{
Warning
<<"Ignoring lone '-' on the command-line" << endl;
}
else if
(
(
validOptions.found(optionName)
&& !validOptions[optionName].empty()
(optIter = validOptions.cfind(optionName)).found()
&& !optIter.object().empty()
)
|| (
validParOptions.found(optionName)
&& !validParOptions[optionName].empty()
(optIter = validParOptions.cfind(optionName)).found()
&& !optIter.object().empty()
)
)
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment