Changeset c1f7f6ea in mainline for kernel/generic/src/console/cmd.c
- Timestamp:
- 2009-02-27T12:53:46Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c214a65
- Parents:
- e49e234
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/cmd.c
re49e234 rc1f7f6ea 515 515 int cmd_help(cmd_arg_t *argv) 516 516 { 517 spinlock_lock(&cmd_lock); 518 517 519 link_t *cur; 518 519 spinlock_lock(&cmd_lock); 520 520 size_t len = 0; 521 521 for (cur = cmd_head.next; cur != &cmd_head; cur = cur->next) { 522 522 cmd_info_t *hlp; 523 524 523 hlp = list_get_instance(cur, cmd_info_t, link); 524 525 525 spinlock_lock(&hlp->lock); 526 527 printf("%s - %s\n", hlp->name, hlp->description); 528 526 if (strlen(hlp->name) > len) 527 len = strlen(hlp->name); 529 528 spinlock_unlock(&hlp->lock); 530 529 } 531 530 531 for (cur = cmd_head.next; cur != &cmd_head; cur = cur->next) { 532 cmd_info_t *hlp; 533 hlp = list_get_instance(cur, cmd_info_t, link); 534 535 spinlock_lock(&hlp->lock); 536 printf("%-*s %s\n", len, hlp->name, hlp->description); 537 spinlock_unlock(&hlp->lock); 538 } 539 532 540 spinlock_unlock(&cmd_lock); 533 541 534 542 return 1; 535 543 } … … 949 957 int cmd_tests(cmd_arg_t *argv) 950 958 { 959 size_t len = 0; 951 960 test_t *test; 961 for (test = tests; test->name != NULL; test++) { 962 if (strlen(test->name) > len) 963 len = strlen(test->name); 964 } 952 965 953 966 for (test = tests; test->name != NULL; test++) 954 printf("%- 10s %s%s\n", test->name, test->desc, (test->safe ? "" : " (unsafe)"));955 956 printf("%- 10s Run all safe tests\n", "*");967 printf("%-*s %s%s\n", len, test->name, test->desc, (test->safe ? "" : " (unsafe)")); 968 969 printf("%-*s Run all safe tests\n", len, "*"); 957 970 return 1; 958 971 } … … 960 973 static bool run_test(const test_t *test) 961 974 { 962 printf("%s \t\t%s\n", test->name, test->desc);975 printf("%s (%s)\n", test->name, test->desc); 963 976 964 977 /* Update and read thread accounting
Note:
See TracChangeset
for help on using the changeset viewer.