cmd.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. /*
  2. * File : cmd.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2006-04-30 Bernard first implementation
  13. * 2006-05-04 Bernard add list_thread,
  14. * list_sem,
  15. * list_timer
  16. * 2006-05-20 Bernard add list_mutex,
  17. * list_mailbox,
  18. * list_msgqueue,
  19. * list_event,
  20. * list_fevent,
  21. * list_mempool
  22. * 2006-06-03 Bernard display stack information in list_thread
  23. * 2006-08-10 Bernard change version to invoke rt_show_version
  24. * 2008-09-10 Bernard update the list function for finsh syscall
  25. * list and sysvar list
  26. * 2009-05-30 Bernard add list_device
  27. * 2010-04-21 yi.qiu add list_module
  28. */
  29. #include <rtthread.h>
  30. #include "finsh.h"
  31. // Copy from kservice.h because we can not use it out of the kernel.
  32. // Ugly. Should let kservice.h avaliable for applications?
  33. rt_inline int rt_list_isempty(const rt_list_t *l)
  34. {
  35. return l->next == l;
  36. }
  37. rt_inline unsigned int rt_list_len(const rt_list_t *l)
  38. {
  39. unsigned int len = 0;
  40. const rt_list_t *p = l;
  41. while( p->next != l )
  42. {
  43. p = p->next;
  44. len++;
  45. }
  46. return len;
  47. }
  48. long hello(void)
  49. {
  50. rt_kprintf("Hello RT-Thread!\n");
  51. return 0;
  52. }
  53. FINSH_FUNCTION_EXPORT(hello, say hello world);
  54. extern void rt_show_version(void);
  55. long version(void)
  56. {
  57. rt_show_version();
  58. return 0;
  59. }
  60. FINSH_FUNCTION_EXPORT(version, show RT-Thread version information);
  61. #define rt_list_entry(node, type, member) \
  62. ((type *)((char *)(node) - (unsigned long)(&((type *)0)->member)))
  63. extern struct rt_object_information rt_object_container[];
  64. static long _list_thread(struct rt_list_node* list)
  65. {
  66. struct rt_thread *thread;
  67. struct rt_list_node *node;
  68. rt_uint8_t* ptr;
  69. rt_kprintf(" thread pri status sp stack size max used left tick error\n");
  70. rt_kprintf("-------- ---- ------- ---------- ---------- ---------- ---------- ---\n");
  71. for (node = list->next; node != list; node = node->next)
  72. {
  73. thread = rt_list_entry(node, struct rt_thread, list);
  74. rt_kprintf("%-8s 0x%02x", thread->name, thread->current_priority);
  75. if (thread->stat == RT_THREAD_READY) rt_kprintf(" ready ");
  76. else if (thread->stat == RT_THREAD_SUSPEND) rt_kprintf(" suspend");
  77. else if (thread->stat == RT_THREAD_INIT) rt_kprintf(" init ");
  78. ptr = (rt_uint8_t*)thread->stack_addr;
  79. while (*ptr == '#')ptr ++;
  80. rt_kprintf(" 0x%08x 0x%08x 0x%08x 0x%08x %03d\n",
  81. thread->stack_size + ((rt_uint32_t)thread->stack_addr - (rt_uint32_t)thread->sp),
  82. thread->stack_size,
  83. thread->stack_size - ((rt_uint32_t) ptr - (rt_uint32_t)thread->stack_addr),
  84. thread->remaining_tick,
  85. thread->error);
  86. }
  87. return 0;
  88. }
  89. long list_thread(void)
  90. {
  91. return _list_thread(&rt_object_container[RT_Object_Class_Thread].object_list);
  92. }
  93. FINSH_FUNCTION_EXPORT(list_thread, list thread);
  94. static void show_wait_queue(struct rt_list_node* list)
  95. {
  96. struct rt_thread *thread;
  97. struct rt_list_node *node;
  98. for (node = list->next; node != list; node = node->next)
  99. {
  100. thread = rt_list_entry(node, struct rt_thread, tlist);
  101. rt_kprintf("%s", thread->name);
  102. if (node->next != list) rt_kprintf("/");
  103. }
  104. }
  105. #ifdef RT_USING_SEMAPHORE
  106. static long _list_sem(struct rt_list_node *list)
  107. {
  108. struct rt_semaphore *sem;
  109. struct rt_list_node *node;
  110. rt_kprintf("semaphore v suspend thread\n");
  111. rt_kprintf("-------- --- --------------\n");
  112. for (node = list->next; node != list; node = node->next)
  113. {
  114. sem = (struct rt_semaphore*)(rt_list_entry(node, struct rt_object, list));
  115. if( !rt_list_isempty(&sem->parent.suspend_thread) )
  116. {
  117. rt_kprintf("%-8s %03d %d:", sem->parent.parent.name, sem->value, rt_list_len(&sem->parent.suspend_thread) );
  118. show_wait_queue(&(sem->parent.suspend_thread));
  119. rt_kprintf("\n");
  120. }
  121. else
  122. {
  123. rt_kprintf("%-8s %03d %d\n", sem->parent.parent.name, sem->value, rt_list_len(&sem->parent.suspend_thread));
  124. }
  125. }
  126. return 0;
  127. }
  128. long list_sem(void)
  129. {
  130. return _list_sem(&rt_object_container[RT_Object_Class_Semaphore].object_list);
  131. }
  132. FINSH_FUNCTION_EXPORT(list_sem, list semaphone in system)
  133. #endif
  134. #ifdef RT_USING_EVENT
  135. static long _list_event(struct rt_list_node *list)
  136. {
  137. struct rt_event *e;
  138. struct rt_list_node *node;
  139. rt_kprintf("event set suspend thread\n");
  140. rt_kprintf("-------- ---------- --------------\n");
  141. for (node = list->next; node != list; node = node->next)
  142. {
  143. e = (struct rt_event*)(rt_list_entry(node, struct rt_object, list));
  144. rt_kprintf("%-8s 0x%08x %03d\n", e->parent.parent.name, e->set, rt_list_len(&e->parent.suspend_thread));
  145. }
  146. return 0;
  147. }
  148. long list_event(void)
  149. {
  150. return _list_event(&rt_object_container[RT_Object_Class_Event].object_list);
  151. }
  152. FINSH_FUNCTION_EXPORT(list_event, list event in system)
  153. #endif
  154. #ifdef RT_USING_MUTEX
  155. static long _list_mutex(struct rt_list_node *list)
  156. {
  157. struct rt_mutex *m;
  158. struct rt_list_node *node;
  159. rt_kprintf("mutex owner hold suspend thread\n");
  160. rt_kprintf("-------- -------- ---- --------------\n");
  161. for (node = list->next; node != list; node = node->next)
  162. {
  163. m = (struct rt_mutex*)(rt_list_entry(node, struct rt_object, list));
  164. rt_kprintf("%-8s %-8s %04d %d\n", m->parent.parent.name, m->owner->name, m->hold, rt_list_len(&m->parent.suspend_thread));
  165. }
  166. return 0;
  167. }
  168. long list_mutex(void)
  169. {
  170. return _list_mutex(&rt_object_container[RT_Object_Class_Mutex].object_list);
  171. }
  172. FINSH_FUNCTION_EXPORT(list_mutex, list mutex in system)
  173. #endif
  174. #ifdef RT_USING_MAILBOX
  175. static long _list_mailbox(struct rt_list_node *list)
  176. {
  177. struct rt_mailbox *m;
  178. struct rt_list_node *node;
  179. rt_kprintf("mailbox entry size suspend thread\n");
  180. rt_kprintf("-------- ---- ---- --------------\n");
  181. for (node = list->next; node != list; node = node->next)
  182. {
  183. m = (struct rt_mailbox*)(rt_list_entry(node, struct rt_object, list));
  184. if( !rt_list_isempty(&m->parent.suspend_thread) )
  185. {
  186. rt_kprintf("%-8s %04d %04d %d:", m->parent.parent.name, m->entry, m->size, rt_list_len(&m->parent.suspend_thread));
  187. show_wait_queue(&(m->parent.suspend_thread));
  188. rt_kprintf("\n");
  189. }
  190. else
  191. {
  192. rt_kprintf("%-8s %04d %04d %d\n", m->parent.parent.name, m->entry, m->size, rt_list_len(&m->parent.suspend_thread));
  193. }
  194. }
  195. return 0;
  196. }
  197. long list_mailbox(void)
  198. {
  199. return _list_mailbox(&rt_object_container[RT_Object_Class_MailBox].object_list);
  200. }
  201. FINSH_FUNCTION_EXPORT(list_mailbox, list mail box in system)
  202. #endif
  203. #ifdef RT_USING_MESSAGEQUEUE
  204. static long _list_msgqueue(struct rt_list_node *list)
  205. {
  206. struct rt_messagequeue *m;
  207. struct rt_list_node *node;
  208. rt_kprintf("msgqueue entry suspend thread\n");
  209. rt_kprintf("-------- ---- --------------\n");
  210. for (node = list->next; node != list; node = node->next)
  211. {
  212. m = (struct rt_messagequeue*)(rt_list_entry(node, struct rt_object, list));
  213. if( !rt_list_isempty(&m->parent.suspend_thread) )
  214. {
  215. rt_kprintf("%-8s %04d %d:", m->parent.parent.name, m->entry, rt_list_len(&m->parent.suspend_thread));
  216. show_wait_queue(&(m->parent.suspend_thread));
  217. rt_kprintf("\n");
  218. }
  219. else
  220. {
  221. rt_kprintf("%-8s %04d %d\n", m->parent.parent.name, m->entry, rt_list_len(&m->parent.suspend_thread));
  222. }
  223. }
  224. return 0;
  225. }
  226. long list_msgqueue(void)
  227. {
  228. return _list_msgqueue(&rt_object_container[RT_Object_Class_MessageQueue].object_list);
  229. }
  230. FINSH_FUNCTION_EXPORT(list_msgqueue, list message queue in system)
  231. #endif
  232. #ifdef RT_USING_MEMPOOL
  233. static long _list_mempool(struct rt_list_node *list)
  234. {
  235. struct rt_mempool *mp;
  236. struct rt_list_node *node;
  237. rt_kprintf("mempool block total free suspend thread\n");
  238. rt_kprintf("-------- ---- ---- ---- --------------\n");
  239. for (node = list->next; node != list; node = node->next)
  240. {
  241. mp = (struct rt_mempool*)rt_list_entry(node, struct rt_object, list);
  242. if (mp->suspend_thread_count > 0)
  243. {
  244. rt_kprintf("%-8s %04d %04d %04d %d:", mp->parent.name,
  245. mp->block_size, mp->block_total_count, mp->block_free_count,
  246. mp->suspend_thread_count);
  247. show_wait_queue(&(mp->suspend_thread));
  248. rt_kprintf("\n");
  249. }
  250. else
  251. {
  252. rt_kprintf("%-8s %04d %04d %04d %d\n", mp->parent.name,
  253. mp->block_size, mp->block_total_count, mp->block_free_count,
  254. mp->suspend_thread_count);
  255. }
  256. }
  257. return 0;
  258. }
  259. long list_mempool(void)
  260. {
  261. return _list_mempool(&rt_object_container[RT_Object_Class_MemPool].object_list);
  262. }
  263. FINSH_FUNCTION_EXPORT(list_mempool, list memory pool in system)
  264. #endif
  265. static long _list_timer(struct rt_list_node *list)
  266. {
  267. struct rt_timer *timer;
  268. struct rt_list_node *node;
  269. rt_kprintf("timer periodic timeout flag\n");
  270. rt_kprintf("-------- ---------- ---------- -----------\n");
  271. for (node = list->next; node != list; node = node->next)
  272. {
  273. timer = (struct rt_timer*)(rt_list_entry(node, struct rt_object, list));
  274. rt_kprintf("%-8s 0x%08x 0x%08x ", timer->parent.name, timer->init_tick, timer->timeout_tick);
  275. if (timer->parent.flag & RT_TIMER_FLAG_ACTIVATED) rt_kprintf("activated\n");
  276. else rt_kprintf("deactivated\n");
  277. }
  278. rt_kprintf("current tick:0x%08x\n", rt_tick_get());
  279. return 0;
  280. }
  281. long list_timer(void)
  282. {
  283. return _list_timer(&rt_object_container[RT_Object_Class_Timer].object_list);
  284. }
  285. FINSH_FUNCTION_EXPORT(list_timer, list timer in system)
  286. #ifdef RT_USING_DEVICE
  287. static long _list_device(struct rt_list_node *list)
  288. {
  289. struct rt_device *device;
  290. struct rt_list_node *node;
  291. const char *device_type_str[] =
  292. {
  293. "Character Device",
  294. "Block Device",
  295. "Network Interface",
  296. "MTD Device",
  297. "CAN Device",
  298. "RTC",
  299. "Sound Device",
  300. "Graphic Device",
  301. "I2C Device",
  302. "USB Slave Device",
  303. "USB Host Bus",
  304. "Unknown"
  305. };
  306. rt_kprintf("device type \n");
  307. rt_kprintf("-------- ---------- \n");
  308. for (node = list->next; node != list; node = node->next)
  309. {
  310. device = (struct rt_device*)(rt_list_entry(node, struct rt_object, list));
  311. rt_kprintf("%-8s %-8s \n", device->parent.name, device_type_str[device->type]);
  312. }
  313. return 0;
  314. }
  315. long list_device(void)
  316. {
  317. return _list_device(&rt_object_container[RT_Object_Class_Device].object_list);
  318. }
  319. FINSH_FUNCTION_EXPORT(list_device, list device in system)
  320. #endif
  321. #ifdef RT_USING_MODULE
  322. #include <rtm.h>
  323. int list_module(void)
  324. {
  325. struct rt_module *module;
  326. struct rt_list_node *list, *node;
  327. list = &rt_object_container[RT_Object_Class_Module].object_list;
  328. rt_kprintf("module name ref\n");
  329. rt_kprintf("------------ --------\n");
  330. for (node = list->next; node != list; node = node->next)
  331. {
  332. module = (struct rt_module*)(rt_list_entry(node, struct rt_object, list));
  333. rt_kprintf("%-16s ", module->parent.name);
  334. rt_kprintf("%-04d \n", module->nref);
  335. }
  336. return 0;
  337. }
  338. FINSH_FUNCTION_EXPORT(list_module, list module in system)
  339. int list_mod_detail(const char* name)
  340. {
  341. int i;
  342. struct rt_module *module;
  343. /* find module */
  344. if((module = rt_module_find(name)) != RT_NULL)
  345. {
  346. /* module has entry point */
  347. if(!(module->parent.flag & RT_MODULE_FLAG_WITHOUTENTRY))
  348. {
  349. struct rt_thread *thread;
  350. struct rt_list_node *tlist;
  351. rt_uint8_t* ptr;
  352. /* list main thread in module */
  353. if(module->module_thread != RT_NULL)
  354. {
  355. rt_kprintf("main thread pri status sp stack size max used left tick error\n");
  356. rt_kprintf("------------- ---- ------- ---------- ---------- ---------- ---------- ---\n");
  357. thread = module->module_thread;
  358. rt_kprintf("%-8s 0x%02x", thread->name, thread->current_priority);
  359. if (thread->stat == RT_THREAD_READY) rt_kprintf(" ready ");
  360. else if (thread->stat == RT_THREAD_SUSPEND) rt_kprintf(" suspend");
  361. else if (thread->stat == RT_THREAD_INIT) rt_kprintf(" init ");
  362. ptr = (rt_uint8_t*)thread->stack_addr;
  363. while (*ptr == '#')ptr ++;
  364. rt_kprintf(" 0x%08x 0x%08x 0x%08x 0x%08x %03d\n",
  365. thread->stack_size + ((rt_uint32_t)thread->stack_addr - (rt_uint32_t)thread->sp),
  366. thread->stack_size,
  367. thread->stack_size - ((rt_uint32_t) ptr - (rt_uint32_t)thread->stack_addr),
  368. thread->remaining_tick,
  369. thread->error);
  370. }
  371. /* list sub thread in module */
  372. tlist = &module->module_object[RT_Object_Class_Thread].object_list;
  373. if(!rt_list_isempty(tlist)) _list_thread(tlist);
  374. #ifdef RT_USING_SEMAPHORE
  375. /* list semaphored in module */
  376. tlist = &module->module_object[RT_Object_Class_Semaphore].object_list;
  377. if(!rt_list_isempty(tlist)) _list_sem(tlist);
  378. #endif
  379. #ifdef RT_USING_MUTEX
  380. /* list mutex in module */
  381. tlist = &module->module_object[RT_Object_Class_Mutex].object_list;
  382. if(!rt_list_isempty(tlist)) _list_mutex(tlist);
  383. #endif
  384. #ifdef RT_USING_EVENT
  385. /* list event in module */
  386. tlist = &module->module_object[RT_Object_Class_Event].object_list;
  387. if(!rt_list_isempty(tlist)) _list_event(tlist);
  388. #endif
  389. #ifdef RT_USING_MAILBOX
  390. /* list mailbox in module */
  391. tlist = &module->module_object[RT_Object_Class_MailBox].object_list;
  392. if(!rt_list_isempty(tlist)) _list_mailbox(tlist);
  393. #endif
  394. #ifdef RT_USING_MESSAGEQUEUE
  395. /* list message queue in module */
  396. tlist = &module->module_object[RT_Object_Class_MessageQueue].object_list;
  397. if(!rt_list_isempty(tlist)) _list_msgqueue(tlist);
  398. #endif
  399. #ifdef RT_USING_MEMPOOL
  400. /* list memory pool in module */
  401. tlist = &module->module_object[RT_Object_Class_MemPool].object_list;
  402. if(!rt_list_isempty(tlist)) _list_mempool(tlist);
  403. #endif
  404. #ifdef RT_USING_DEVICE
  405. /* list device in module */
  406. tlist = &module->module_object[RT_Object_Class_Device].object_list;
  407. if(!rt_list_isempty(tlist)) _list_device(tlist);
  408. #endif
  409. /* list timer in module */
  410. tlist = &module->module_object[RT_Object_Class_Timer].object_list;
  411. if(!rt_list_isempty(tlist)) _list_timer(tlist);
  412. }
  413. rt_kprintf("symbol address \n");
  414. rt_kprintf("-------- ----------\n");
  415. /* list module export symbols */
  416. for(i=0; i<module->nsym; i++)
  417. {
  418. rt_kprintf("%s 0x%x\n", module->symtab[i].name, module->symtab[i].addr);
  419. }
  420. }
  421. return 0;
  422. }
  423. FINSH_FUNCTION_EXPORT(list_mod_detail, list module objects in system)
  424. #endif
  425. long list(void)
  426. {
  427. struct finsh_syscall_item* syscall_item;
  428. struct finsh_sysvar_item* sysvar_item;
  429. rt_kprintf("--Function List:\n");
  430. {
  431. struct finsh_syscall* index;
  432. for (index = _syscall_table_begin; index < _syscall_table_end; index ++)
  433. {
  434. #ifdef FINSH_USING_DESCRIPTION
  435. rt_kprintf("%-16s -- %s\n", index->name, index->desc);
  436. #else
  437. rt_kprintf("%s\n", index->name);
  438. #endif
  439. }
  440. }
  441. /* list syscall list */
  442. syscall_item = global_syscall_list;
  443. while (syscall_item != NULL)
  444. {
  445. rt_kprintf("[l] %s\n", syscall_item->syscall.name);
  446. syscall_item = syscall_item->next;
  447. }
  448. rt_kprintf("--Variable List:\n");
  449. {
  450. struct finsh_sysvar* index;
  451. for (index = _sysvar_table_begin; index < _sysvar_table_end; index ++)
  452. {
  453. #ifdef FINSH_USING_DESCRIPTION
  454. rt_kprintf("%-16s -- %s\n", index->name, index->desc);
  455. #else
  456. rt_kprintf("%s\n", index->name);
  457. #endif
  458. }
  459. }
  460. sysvar_item = global_sysvar_list;
  461. while (sysvar_item != NULL)
  462. {
  463. rt_kprintf("[l] %s\n", sysvar_item->sysvar.name);
  464. sysvar_item = sysvar_item->next;
  465. }
  466. return 0;
  467. }
  468. FINSH_FUNCTION_EXPORT(list, list all symbol in system)
  469. static int str_is_prefix(const char* prefix, const char* str)
  470. {
  471. while ((*prefix) && (*prefix == *str))
  472. {
  473. prefix ++;
  474. str ++;
  475. }
  476. if (*prefix == 0) return 0;
  477. return -1;
  478. }
  479. void list_prefix(char* prefix)
  480. {
  481. struct finsh_syscall_item* syscall_item;
  482. struct finsh_sysvar_item* sysvar_item;
  483. rt_uint16_t func_cnt, var_cnt;
  484. const char* name_ptr;
  485. func_cnt = 0;
  486. var_cnt = 0;
  487. name_ptr = RT_NULL;
  488. {
  489. struct finsh_syscall* index;
  490. for (index = _syscall_table_begin; index < _syscall_table_end; index ++)
  491. {
  492. if (str_is_prefix(prefix, index->name) == 0)
  493. {
  494. if (func_cnt == 0)
  495. rt_kprintf("--function:\n");
  496. func_cnt ++;
  497. /* set name_ptr */
  498. name_ptr = index->name;
  499. #ifdef FINSH_USING_DESCRIPTION
  500. rt_kprintf("%-16s -- %s\n", index->name, index->desc);
  501. #else
  502. rt_kprintf("%s\n", index->name);
  503. #endif
  504. }
  505. }
  506. }
  507. /* list syscall list */
  508. syscall_item = global_syscall_list;
  509. while (syscall_item != NULL)
  510. {
  511. if (str_is_prefix(prefix, syscall_item->syscall.name) == 0)
  512. {
  513. if (func_cnt == 0)
  514. rt_kprintf("--function:\n");
  515. func_cnt ++;
  516. /* set name_ptr */
  517. name_ptr = syscall_item->syscall.name;
  518. rt_kprintf("[l] %s\n", syscall_item->syscall.name);
  519. }
  520. syscall_item = syscall_item->next;
  521. }
  522. {
  523. struct finsh_sysvar* index;
  524. for (index = _sysvar_table_begin; index < _sysvar_table_end; index ++)
  525. {
  526. if (str_is_prefix(prefix, index->name) == 0)
  527. {
  528. if (var_cnt == 0)
  529. rt_kprintf("--variable:\n");
  530. var_cnt ++;
  531. /* set name ptr */
  532. name_ptr = index->name;
  533. #ifdef FINSH_USING_DESCRIPTION
  534. rt_kprintf("%-16s -- %s\n", index->name, index->desc);
  535. #else
  536. rt_kprintf("%s\n", index->name);
  537. #endif
  538. }
  539. }
  540. }
  541. sysvar_item = global_sysvar_list;
  542. while (sysvar_item != NULL)
  543. {
  544. if (str_is_prefix(prefix, sysvar_item->sysvar.name) == 0)
  545. {
  546. if (var_cnt == 0)
  547. rt_kprintf("--variable:\n");
  548. var_cnt ++;
  549. /* set name ptr */
  550. name_ptr = sysvar_item->sysvar.name;
  551. rt_kprintf("[l] %s\n", sysvar_item->sysvar.name);
  552. }
  553. sysvar_item = sysvar_item->next;
  554. }
  555. /* only one matched */
  556. if ((func_cnt + var_cnt) == 1)
  557. {
  558. rt_strncpy(prefix, name_ptr, strlen(name_ptr));
  559. }
  560. }
  561. #ifdef FINSH_USING_SYMTAB
  562. static int dummy = 0;
  563. FINSH_VAR_EXPORT(dummy, finsh_type_int, dummy variable for finsh)
  564. #endif