Bug 561 - CommandLine based programs should exit with non-zero return if bad parameters are given
CommandLine based programs should exit with non-zero return if bad parameters...
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: core
ns-3-dev
All All
: P5 minor
Assigned To: ns-bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-05-04 11:20 UTC by Gustavo J. A. M. Carneiro
Modified: 2009-06-03 04:03 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gustavo J. A. M. Carneiro 2009-05-04 11:20:53 UTC
When a ns-3 program is run with bad command-line parameters, it is exiting with zero exit code, which is obviously wrong.  Minor but annoying problem; easy fix:

void
CommandLine::PrintHelp (void) const
{
[...]
-  exit (0);
-  exit (1);
}
Comment 1 Mathieu Lacage 2009-05-04 11:25:31 UTC
the problem is that this will return -1 even if the user calls --PrintHelp
Comment 2 Gustavo J. A. M. Carneiro 2009-05-04 11:28:11 UTC
(In reply to comment #1)
> the problem is that this will return -1 even if the user calls --PrintHelp

OK, I need to describe the problem better.  Re-titling.
Comment 3 Mathieu Lacage 2009-05-04 11:29:30 UTC
what I meant is that --PrintHelp is not a bad parameter.
Comment 4 Mathieu Lacage 2009-06-03 04:03:00 UTC
changeset 6aa43c812fec