Changeset 48dcc69 in mainline for kernel/generic/src/console/cmd.c


Ignore:
Timestamp:
2010-06-11T10:52:57Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
be06914
Parents:
c0f13d2
Message:

better printouts for threads

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/console/cmd.c

    rc0f13d2 r48dcc69  
    355355};
    356356
     357static char flag_buf[MAX_CMDLINE + 1];
     358
    357359static int cmd_threads(cmd_arg_t *argv);
     360static cmd_arg_t threads_argv = {
     361        .type = ARG_TYPE_STRING_OPTIONAL,
     362        .buffer = flag_buf,
     363        .len = sizeof(flag_buf)
     364};
    358365static cmd_info_t threads_info = {
    359366        .name = "threads",
    360         .description = "List all threads.",
     367        .description = "List all threads (use -a for additional information).",
    361368        .func = cmd_threads,
    362         .argc = 0
    363 };
    364 
     369        .argc = 1,
     370        .argv = &threads_argv
     371};
    365372
    366373static int cmd_tasks(cmd_arg_t *argv);
    367 static char tasks_buf[MAX_CMDLINE + 1];
    368 
    369374static cmd_arg_t tasks_argv = {
    370375        .type = ARG_TYPE_STRING_OPTIONAL,
    371         .buffer = tasks_buf,
    372         .len = sizeof(tasks_buf)
     376        .buffer = flag_buf,
     377        .len = sizeof(flag_buf)
    373378};
    374379static cmd_info_t tasks_info = {
     
    923928/** Command for listings Thread information
    924929 *
    925  * @param argv Ignores
     930 * @param argv Ignored
    926931 *
    927932 * @return Always 1
    928933 */
    929 int cmd_threads(cmd_arg_t * argv)
    930 {
    931         thread_print_list();
     934int cmd_threads(cmd_arg_t *argv)
     935{
     936        if (str_cmp(flag_buf, "-a") == 0)
     937                thread_print_list(true);
     938        else if (str_cmp(flag_buf, "") == 0)
     939                thread_print_list(false);
     940        else
     941                printf("Unknown argument \"%s\".\n", flag_buf);
     942       
    932943        return 1;
    933944}
     
    935946/** Command for listings Task information
    936947 *
    937  * @param argv Ignores
     948 * @param argv Ignored
    938949 *
    939950 * @return Always 1
     
    941952int cmd_tasks(cmd_arg_t *argv)
    942953{
    943         if (str_cmp(tasks_buf, "-a") == 0)
     954        if (str_cmp(flag_buf, "-a") == 0)
    944955                task_print_list(true);
    945         else if (str_cmp(tasks_buf, "") == 0)
     956        else if (str_cmp(flag_buf, "") == 0)
    946957                task_print_list(false);
    947958        else
    948                 printf("Unknown argument \"%s\".\n", tasks_buf);
     959                printf("Unknown argument \"%s\".\n", flag_buf);
    949960       
    950961        return 1;
Note: See TracChangeset for help on using the changeset viewer.