diff options
Diffstat (limited to 'examples/file/seekdir.c')
| -rw-r--r-- | examples/file/seekdir.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/examples/file/seekdir.c b/examples/file/seekdir.c index 1cf8b5fd78..d6a33426b4 100644 --- a/examples/file/seekdir.c +++ b/examples/file/seekdir.c @@ -1,15 +1,12 @@ /* - * File : seekdir.c - * This file is part of RT-TestCase in RT-Thread RTOS - * COPYRIGHT (C) 2011, RT-Thread Development Team + * Copyright (c) 2006-2020, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2011-06-02 Bernard first version + * 2020-04-12 Jianjia Ma add msh cmd */ #include <dfs_posix.h> @@ -17,7 +14,6 @@ void seekdir_test(void) { DIR * dirp; long save3 = 0; - long cur; int i = 0; struct dirent *dp; @@ -27,14 +23,14 @@ void seekdir_test(void) { rt_kprintf("direntry: %s\n", dp->d_name); - /* ���������Ŀ¼���Ŀ¼ָ�� */ + /* save the pointer of the third directory */ if (i++ == 3) { save3 = telldir(dirp); } } - /* �ص��ղű���ĵ�����Ŀ¼���Ŀ¼ָ�� */ + /* get back to the third directory */ seekdir (dirp, save3); rt_kprintf("seek dientry to: %d\n", save3); for (dp = readdir(dirp); dp != RT_NULL; dp = readdir(dirp)) @@ -42,9 +38,12 @@ void seekdir_test(void) rt_kprintf("direntry: %s\n", dp->d_name); } - /* �ر�Ŀ¼ */ + /* close the directory */ closedir (dirp); } +#ifdef RT_USING_FINSH #include <finsh.h> FINSH_FUNCTION_EXPORT(seekdir_test, perform directory seek test); +MSH_CMD_EXPORT(seekdir_test, perform directory seek test); +#endif /* RT_USING_FINSH */ |
