[ns] handling command argument properly
uma.shanker at kcl.ac.uk
Wed Apr 27 07:22:07 PDT 2005
How one should handle arguments to command. lets suppose, I have a
sub-class of Agent having command() method. I can get the list of all
arguments(argc). Now, I want to make sure that in the tcl script only 'n'
numbers of arguments will be supplied otherwise I will stop processing.
1. I can make the if() check for the argc otherwise, call the super class
In this case, stdout gives me some very long error message.
I say it not a clear way, as I know that arguments were wrong. I want
to give back this information in the clean way back.
2. I can also send back
return (TCL_ERROR); // as documented and suggested in section 3.3.2 of
But the result is same.
3. Of course, I can make a proc to be called with-in the if-else loop with
some message passing from C++ to tcl.
Which is the best method.
King's College London.
More information about the Ns-users