On Thu, Mar 17, 2016 at 04:54:58PM +0100, Harald Welte wrote:
Hi Max,
On Thu, Mar 17, 2016 at 03:42:27PM +0100, msuraev@sysmocom.de wrote:
+DEFUN(bvc_reset, bvc_reset_cmd,
- "bvc reset nsei <0-65535> bvci <0-65535>",
[...]
- if (!strcmp(argv[0], "reset"))
return CMD_WARNING;
no need to do this. the generic vty parser code will make sure that you don't end up here if the command doesn't match the synfax above.
- if (argc != 2)
return CMD_WARNING;
same here. If the number of arguments is not the number of mandatory arguments, you will never get called.
I used to do the same kind of checking for my first VTY commands, until I figured out that all of the formatting is already checked ;) Quite handy.
~Neels