From f4c08cfe36f886939a8cee53877c5cd8201cafe2 Mon Sep 17 00:00:00 2001 From: wdfk-prog <1425075683@qq.com> Date: Wed, 21 Dec 2022 16:09:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9printf=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E2=80=9C%-*.s=E2=80=9D=E4=B8=BA=E2=80=9C%-*.*s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/finsh/cmd.c | 22 +++++++++++----------- components/utilities/ulog/ulog.c | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/components/finsh/cmd.c b/components/finsh/cmd.c index 2ba98a1a22..57b033cc57 100644 --- a/components/finsh/cmd.c +++ b/components/finsh/cmd.c @@ -166,11 +166,11 @@ long list_thread(void) maxlen = RT_NAME_MAX; #ifdef RT_USING_SMP - rt_kprintf("%-*.s cpu bind pri status sp stack size max used left tick error\n", maxlen, item_title); + rt_kprintf("%-*.*s cpu bind pri status sp stack size max used left tick error\n", maxlen, maxlen, item_title); object_split(maxlen); rt_kprintf(" --- ---- --- ------- ---------- ---------- ------ ---------- ---\n"); #else - rt_kprintf("%-*.s pri status sp stack size max used left tick error\n", maxlen, item_title); + rt_kprintf("%-*.*s pri status sp stack size max used left tick error\n", maxlen, maxlen, item_title); object_split(maxlen); rt_kprintf(" --- ------- ---------- ---------- ------ ---------- ---\n"); #endif /*RT_USING_SMP*/ @@ -278,7 +278,7 @@ long list_sem(void) maxlen = RT_NAME_MAX; - rt_kprintf("%-*.s v suspend thread\n", maxlen, item_title); + rt_kprintf("%-*.*s v suspend thread\n", maxlen, maxlen, item_title); object_split(maxlen); rt_kprintf(" --- --------------\n"); @@ -344,7 +344,7 @@ long list_event(void) maxlen = RT_NAME_MAX; - rt_kprintf("%-*.s set suspend thread\n", maxlen, item_title); + rt_kprintf("%-*.*s set suspend thread\n", maxlen, maxlen, item_title); object_split(maxlen); rt_kprintf(" ---------- --------------\n"); @@ -408,7 +408,7 @@ long list_mutex(void) maxlen = RT_NAME_MAX; - rt_kprintf("%-*.s owner hold priority suspend thread \n", maxlen, item_title); + rt_kprintf("%-*.*s owner hold priority suspend thread \n", maxlen, maxlen, item_title); object_split(maxlen); rt_kprintf(" -------- ---- -------- --------------\n"); @@ -481,7 +481,7 @@ long list_mailbox(void) maxlen = RT_NAME_MAX; - rt_kprintf("%-*.s entry size suspend thread\n", maxlen, item_title); + rt_kprintf("%-*.*s entry size suspend thread\n", maxlen, maxlen, item_title); object_split(maxlen); rt_kprintf(" ---- ---- --------------\n"); @@ -551,7 +551,7 @@ long list_msgqueue(void) maxlen = RT_NAME_MAX; - rt_kprintf("%-*.s entry suspend thread\n", maxlen, item_title); + rt_kprintf("%-*.*s entry suspend thread\n", maxlen, maxlen, item_title); object_split(maxlen); rt_kprintf(" ---- --------------\n"); do @@ -617,7 +617,7 @@ long list_memheap(void) maxlen = RT_NAME_MAX; - rt_kprintf("%-*.s pool size max used size available size\n", maxlen, item_title); + rt_kprintf("%-*.*s pool size max used size available size\n", maxlen, maxlen, item_title); object_split(maxlen); rt_kprintf(" ---------- ------------- --------------\n"); do @@ -673,7 +673,7 @@ long list_mempool(void) maxlen = RT_NAME_MAX; - rt_kprintf("%-*.s block total free suspend thread\n", maxlen, item_title); + rt_kprintf("%-*.*s block total free suspend thread\n", maxlen, maxlen, item_title); object_split(maxlen); rt_kprintf(" ---- ---- ---- --------------\n"); do @@ -751,7 +751,7 @@ long list_timer(void) maxlen = RT_NAME_MAX; - rt_kprintf("%-*.s periodic timeout activated mode\n", maxlen, item_title); + rt_kprintf("%-*.*s periodic timeout activated mode\n", maxlen, maxlen, item_title); object_split(maxlen); rt_kprintf(" ---------- ---------- ----------- ---------\n"); do @@ -849,7 +849,7 @@ long list_device(void) maxlen = RT_NAME_MAX; - rt_kprintf("%-*.s type ref count\n", maxlen, item_title); + rt_kprintf("%-*.*s type ref count\n", maxlen, maxlen, item_title); object_split(maxlen); rt_kprintf(" -------------------- ----------\n"); do diff --git a/components/utilities/ulog/ulog.c b/components/utilities/ulog/ulog.c index 539f7ef24c..49c111a41c 100644 --- a/components/utilities/ulog/ulog.c +++ b/components/utilities/ulog/ulog.c @@ -1235,7 +1235,7 @@ static void ulog_filter(uint8_t argc, char **argv) for (node = rt_slist_first(ulog_tag_lvl_list_get()); node; node = rt_slist_next(node)) { tag_lvl = rt_slist_entry(node, struct ulog_tag_lvl_filter, list); - rt_kprintf("%-*.s: ", ULOG_FILTER_TAG_MAX_LEN, tag_lvl->tag); + rt_kprintf("%-*.*s: ", ULOG_FILTER_TAG_MAX_LEN, ULOG_FILTER_TAG_MAX_LEN, tag_lvl->tag); #ifndef ULOG_USING_SYSLOG rt_kprintf("%s\n", lvl_name[tag_lvl->level]); -- GitLab