I am working on fixing CR 6620534 
(http://bugs.opensolaris.org/view_bug.do?bug_id=6620534) and wanted some 
feedback for my fix proposal.  I looked at zoneadm.c to come up with 
something similar.

First, #define constants for all the dladm subcommands. 

Then, break apart the usage message for all the subcommands from usage() 
into individual ones.  A new command_usage(int cmd_num) method will 
return just the usage message for that subcommand.  The current usage() 
method will simply call command_usage() for all the commands, thus 
achieving the same output as currently given when the subcommand is wrong.

When the options to the subcommand is wrong, the subcommand specific 
usage and help text (similar to what's in dladm(1m) will be printed.  A 
new command_help_text(int cmd_num) will return a short text description 
from dladm(1m) for that subcommand. 
Currently, die_opterr() is called to print "unrecognized command".  This 
method will be expanded to die_opterr(int cmd_num, int opt, int 
opterr).  The cmd_num will be used to print the usage and help text 
(command_usage(cmd_num) and command_help_text(cmd_num)).

Does this fix look good?

Thanks,
Anurag

_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to