summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-02-15 17:29:04 +0000
committerFelix Fietkau <nbd@openwrt.org>2010-02-15 17:29:04 +0000
commit7dcd4af0705d17b5b3d563c03e8d2ebd005b9bac (patch)
tree1487d6b94f85df15f7586bf65e8da442df248af0
parentb7d662dce89cd296678780d048958bc7bcf84f82 (diff)
downloadmtk-20170518-7dcd4af0705d17b5b3d563c03e8d2ebd005b9bac.zip
mtk-20170518-7dcd4af0705d17b5b3d563c03e8d2ebd005b9bac.tar.gz
mtk-20170518-7dcd4af0705d17b5b3d563c03e8d2ebd005b9bac.tar.bz2
swconfig: use print_attr_val() in CMD_GET
Use the print_attr_val() function introduced by the previous patch to simplify the get command. Signed-off-by: Martin Mares <mj@ucw.cz> SVN-Revision: 19641
-rw-r--r--package/swconfig/src/cli.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/package/swconfig/src/cli.c b/package/swconfig/src/cli.c
index d8d8e51..d99eda9 100644
--- a/package/swconfig/src/cli.c
+++ b/package/swconfig/src/cli.c
@@ -301,23 +301,8 @@ int main(int argc, char **argv)
retval = -1;
goto out;
}
- switch(a->type) {
- case SWITCH_TYPE_INT:
- printf("%d\n", val.value.i);
- break;
- case SWITCH_TYPE_STRING:
- printf("%s\n", val.value.s);
- break;
- case SWITCH_TYPE_PORTS:
- for(i = 0; i < val.len; i++) {
- printf("%d%s ",
- val.value.ports[i].id,
- (val.value.ports[i].flags &
- SWLIB_PORT_FLAG_TAGGED) ? "t" : "");
- }
- printf("\n");
- break;
- }
+ print_attr_val(a, &val);
+ putchar('\n');
break;
case CMD_LOAD:
swconfig_load_uci(dev, ckey);