_opendir vs opendir

Shaun Jackman sjackman@gmail.com
Fri Aug 19 23:01:00 GMT 2005

I've been using an arm-elf toolchain with a small patch that compiles
both the posix and unix directories. This works with little changes
needed, but one issue is that posix/opendir.c implements opendir
(since HAVE_OPENDIR is not defined), but unix/getcwd.c calls _opendir,
which is not defined anywhere. I've been using the following patch
that uses _syslist.h to redefine _opendir to opendir if HAVE_OPENDIR
is not defined. Is this a clean solution?


Index: newlib/libc/include/_syslist.h
RCS file: /cvs/src/src/newlib/libc/include/_syslist.h,v
retrieving revision
diff -u -r1.1.1.1 _syslist.h
--- newlib/libc/include/_syslist.h	17 Feb 2000 19:39:46 -0000
+++ newlib/libc/include/_syslist.h	19 Aug 2005 22:49:03 -0000
@@ -21,9 +21,12 @@
 #define _unlink unlink
 #define _wait wait
 #define _write write
  /* functions not yet sysfaked */
  #define _opendir opendir
  #define _readdir readdir
  #define _closedir closedir
+#endif /* ! HAVE_OPENDIR */
+#endif /* ! __SYSLIST_H */

More information about the Newlib mailing list