Browse Source

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 <[email protected]>

SVN-Revision: 19641
Felix Fietkau 16 years ago
parent
commit
7dcd4af070
1 changed files with 2 additions and 17 deletions
  1. 2 17
      package/swconfig/src/cli.c

+ 2 - 17
package/swconfig/src/cli.c

@@ -301,23 +301,8 @@ int main(int argc, char **argv)
 			retval = -1;
 			retval = -1;
 			goto out;
 			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;
 		break;
 	case CMD_LOAD:
 	case CMD_LOAD:
 		swconfig_load_uci(dev, ckey);
 		swconfig_load_uci(dev, ckey);