From 8930ace072691acb9caf83fa6347f973dacf4263 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Wed, 12 Jun 2019 17:51:34 +0200 Subject: vty: command.c: Get rid of big indentation block This block will become bigger in forthcoming commits. Change-Id: Ibc1494014b1e77ce10950f7268a44d2d2091a6f2 --- src/vty/command.c | 60 +++++++++++++++++++++++++++---------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/vty/command.c b/src/vty/command.c index b26e9919..17d28fe6 100644 --- a/src/vty/command.c +++ b/src/vty/command.c @@ -2294,27 +2294,27 @@ cmd_execute_command_real(vector vline, struct vty *vty, argc = 0; for (i = 0; i < vector_active(vline); i++) { - if (varflag) + if (argc == CMD_ARGC_MAX) + return CMD_ERR_EXEED_ARGC_MAX; + if (varflag) { argv[argc++] = vector_slot(vline, i); - else { - vector descvec = - vector_slot(matched_element->strvec, i); + continue; + } - if (vector_active(descvec) == 1) { - struct desc *desc = vector_slot(descvec, 0); + vector descvec = vector_slot(matched_element->strvec, i); - if (CMD_VARARG(desc->cmd)) - varflag = 1; + if (vector_active(descvec) == 1) { + struct desc *desc = vector_slot(descvec, 0); - if (varflag || CMD_VARIABLE(desc->cmd) - || CMD_OPTION(desc->cmd)) - argv[argc++] = vector_slot(vline, i); - } else + if (CMD_VARARG(desc->cmd)) + varflag = 1; + + if (varflag || CMD_VARIABLE(desc->cmd) + || CMD_OPTION(desc->cmd)) argv[argc++] = vector_slot(vline, i); + } else { + argv[argc++] = vector_slot(vline, i); } - - if (argc == CMD_ARGC_MAX) - return CMD_ERR_EXEED_ARGC_MAX; } /* For vtysh execution. */ @@ -2439,27 +2439,27 @@ cmd_execute_command_strict(vector vline, struct vty *vty, argc = 0; for (i = 0; i < vector_active(vline); i++) { - if (varflag) + if (argc == CMD_ARGC_MAX) + return CMD_ERR_EXEED_ARGC_MAX; + if (varflag) { argv[argc++] = vector_slot(vline, i); - else { - vector descvec = - vector_slot(matched_element->strvec, i); + continue; + } - if (vector_active(descvec) == 1) { - struct desc *desc = vector_slot(descvec, 0); + vector descvec = vector_slot(matched_element->strvec, i); - if (CMD_VARARG(desc->cmd)) - varflag = 1; + if (vector_active(descvec) == 1) { + struct desc *desc = vector_slot(descvec, 0); - if (varflag || CMD_VARIABLE(desc->cmd) - || CMD_OPTION(desc->cmd)) - argv[argc++] = vector_slot(vline, i); - } else + if (CMD_VARARG(desc->cmd)) + varflag = 1; + + if (varflag || CMD_VARIABLE(desc->cmd) + || CMD_OPTION(desc->cmd)) argv[argc++] = vector_slot(vline, i); + } else { + argv[argc++] = vector_slot(vline, i); } - - if (argc == CMD_ARGC_MAX) - return CMD_ERR_EXEED_ARGC_MAX; } /* For vtysh execution. */ -- cgit v1.2.3