aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-06-12 17:51:34 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2019-06-14 12:42:22 +0200
commit8930ace072691acb9caf83fa6347f973dacf4263 (patch)
tree95023bdc2a97d97a533f5d3aaa4f8f6c1009c23b
parentc17c6d6ea550b2c0fe1e58d5ea69d39c0b8e4a8c (diff)
vty: command.c: Get rid of big indentation block
This block will become bigger in forthcoming commits. Change-Id: Ibc1494014b1e77ce10950f7268a44d2d2091a6f2
-rw-r--r--src/vty/command.c60
1 files changed, 30 insertions, 30 deletions
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. */