summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-04-30 13:16:08 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-04-30 13:16:08 +0000
commit2df9d9a16c044c331d11b43e5367f4088b710544 (patch)
tree8a913d99b5ee7f9dbcdfe68d0f4230b5aec1b161
parent7b3abdcb09278afa8c0b017825cefebded1781f9 (diff)
downloadrockbox-2df9d9a16c044c331d11b43e5367f4088b710544.tar.gz
rockbox-2df9d9a16c044c331d11b43e5367f4088b710544.zip
initial dir browsing code
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@327 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--uisimulator/tree.c48
-rw-r--r--uisimulator/tree.h20
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
25bool 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
20bool dirbrowse(char *root);