adjusted to build on my solaris box


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@493 a1c6a512-1295-4272-9138-f99709370657
diff --git a/uisimulator/x11/dir.h b/uisimulator/x11/dir.h
index a389807..98bf175 100644
--- a/uisimulator/x11/dir.h
+++ b/uisimulator/x11/dir.h
@@ -17,39 +17,23 @@
  *
  ****************************************************************************/
 
-#define dirent x11_dirent
-#define readdir(x) x11_readdir(x)
-#define opendir(x) x11_opendir(x)
-#define closedir(x) x11_closedir(x)
-
-/*
- * The defines above should let us use the readdir() and opendir() in target
- * code just as they're defined to work in target. They will then call our
- * x11_* versions of the functions that'll work as wrappers for the actual
- * host functions.
- */
-
 #include <sys/types.h>
-#include <dirent.h>
-
-#undef dirent
-
+typedef void DIR;
 
 #define DIRFUNCTIONS_DEFINED /* prevent those prototypes */
-
+#define dirent x11_dirent
 #include "../../firmware/common/dir.h"
+#undef dirent
 
-#define SIMULATOR_ARCHOS_ROOT "archos"
-
-struct mydir {
-  DIR *dir;
-  char *name;
-};
-
-typedef struct mydir MYDIR;
+typedef void * MYDIR;
 
 extern MYDIR *x11_opendir(char *name);
-extern struct dirent* x11_readdir(MYDIR* dir);
+extern struct x11_dirent* x11_readdir(MYDIR* dir);
 extern void x11_closedir(MYDIR *dir);
 
 #define DIR MYDIR
+#define dirent x11_dirent
+#define opendir(x) x11_opendir(x)
+#define readdir(x) x11_readdir(x)
+#define closedir(x) x11_closedir(x)
+
diff --git a/uisimulator/x11/file.h b/uisimulator/x11/file.h
index af3f66e..7ea7258 100644
--- a/uisimulator/x11/file.h
+++ b/uisimulator/x11/file.h
@@ -18,7 +18,6 @@
  ****************************************************************************/
 
 #include <sys/types.h>
-#include <dirent.h>
 
 #define open(x,y) x11_open(x,y)
 
diff --git a/uisimulator/x11/io.c b/uisimulator/x11/io.c
index 726bfa2..53cee8d 100644
--- a/uisimulator/x11/io.c
+++ b/uisimulator/x11/io.c
@@ -1,8 +1,20 @@
 
 #include <sys/stat.h>
-#include "dir.h"
+#include <dirent.h>
 
-#undef DIR
+#define DIRFUNCTIONS_DEFINED /* prevent those prototypes */
+#define dirent x11_dirent
+#include "../../firmware/common/dir.h"
+#undef dirent
+
+#define SIMULATOR_ARCHOS_ROOT "archos"
+
+struct mydir {
+  DIR *dir;
+  char *name;
+};
+
+typedef struct mydir MYDIR;
 
 MYDIR *x11_opendir(char *name)
 {
@@ -21,13 +33,15 @@
   return my;
 }
 
-struct dirent *x11_readdir(MYDIR *dir)
+struct x11_dirent *x11_readdir(MYDIR *dir)
 {
   char buffer[512]; /* sufficiently big */
-  static struct dirent secret;
+  static struct x11_dirent secret;
   struct stat s;
+  struct dirent *x11 = (readdir)(dir->dir);
 
-  struct x11_dirent *x11 = (readdir)(dir->dir);
+  if(!x11)
+    return NULL;
 
   strcpy(secret.d_name, x11->d_name);