diff options
Diffstat (limited to 'uisimulator')
-rw-r--r-- | uisimulator/tree.c | 48 | ||||
-rw-r--r-- | uisimulator/tree.h | 20 |
2 files changed, 68 insertions, 0 deletions
diff --git a/uisimulator/tree.c b/uisimulator/tree.c new file mode 100644 index 0000000000..f9d2af4439 --- /dev/null +++ b/uisimulator/tree.c | |||
@@ -0,0 +1,48 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 Daniel Stenberg | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include <dir.h> | ||
21 | #include <types.h> | ||
22 | |||
23 | #define TREE_MAX_LEN 15 | ||
24 | |||
25 | bool dirbrowse(char *root) | ||
26 | { | ||
27 | DIR *dir = opendir(root); | ||
28 | int i; | ||
29 | struct dirent *entry; | ||
30 | char buffer[20]; | ||
31 | |||
32 | if(!dir) | ||
33 | return TRUE; /* failure */ | ||
34 | |||
35 | i=0; | ||
36 | while((entry = readdir(dir))) { | ||
37 | strncpy(buffer, entry->d_name, TREE_MAX_LEN); | ||
38 | buffer[TREE_MAX_LEN]=0; | ||
39 | lcd_puts(0, i*8, buffer, 0); | ||
40 | |||
41 | if(++i > 8) | ||
42 | break; | ||
43 | } | ||
44 | |||
45 | closedir(dir); | ||
46 | |||
47 | return FALSE; | ||
48 | } | ||
diff --git a/uisimulator/tree.h b/uisimulator/tree.h new file mode 100644 index 0000000000..eaff602c51 --- /dev/null +++ b/uisimulator/tree.h | |||
@@ -0,0 +1,20 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 Daniel Stenberg | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | bool dirbrowse(char *root); | ||