[vlc-devel] commit: WinCE: add replacement getcwd() function (Pierre Ynard )

git version control git at videolan.org
Thu May 21 00:14:54 CEST 2009


vlc | branch: 1.0-bugfix | Pierre Ynard <linkfanel at yahoo.fr> | Thu May 21 00:11:37 2009 +0200| [be531987f668b1cea7aaa103638bffc97492feea] | committer: Pierre Ynard 

WinCE: add replacement getcwd() function

As WinCE doesn't support working directories, this function is
basically empty, and merely returns an error.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=be531987f668b1cea7aaa103638bffc97492feea
---

 compat/getcwd.c      |   38 ++++++++++++++++++++++++++++++++++++++
 configure.ac         |    2 +-
 include/vlc_fixups.h |    7 ++++++-
 3 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/compat/getcwd.c b/compat/getcwd.c
new file mode 100644
index 0000000..a238d05
--- /dev/null
+++ b/compat/getcwd.c
@@ -0,0 +1,38 @@
+/*****************************************************************************
+ * getcwd.c: POSIX getcwd() replacement
+ *****************************************************************************
+ * Copyright © 2009 the VideoLAN project
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stddef.h>
+
+char *getcwd (char *buf, size_t size)
+{
+#ifdef UNDER_CE
+    /* Windows CE lacks any notion of working directory, so we just
+     * return an error, and set errno - oh wait, WinCE doesn't support
+     * errno either! */
+    (void) buf; (void) size;
+    return NULL;
+#else
+# error Unimplemented!
+#endif
+}
diff --git a/configure.ac b/configure.ac
index 8d51b84..0fba50e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -578,7 +578,7 @@ dnl Check for usual libc functions
 AC_CHECK_FUNCS([gettimeofday isatty sigrelse getpwuid_r memalign posix_memalign if_nametoindex getenv putenv setenv ctime_r lrintf daemon fork lstat posix_fadvise posix_madvise uselocale])
 AC_FUNC_ALLOCA
 AC_CHECK_FUNCS(fcntl)
-AC_REPLACE_FUNCS([asprintf atof atoll gmtime_r lldiv localtime_r rewind strcasecmp strcasestr strdup strlcpy strncasecmp strndup strnlen strsep strtof strtoll vasprintf swab])
+AC_REPLACE_FUNCS([asprintf atof atoll getcwd gmtime_r lldiv localtime_r rewind strcasecmp strcasestr strdup strlcpy strncasecmp strndup strnlen strsep strtof strtoll vasprintf swab])
 AC_CHECK_FUNCS([stricmp strnicmp])
 AC_CHECK_FUNCS(fdatasync,,
   [AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])
diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h
index 5636832..a02eece 100644
--- a/include/vlc_fixups.h
+++ b/include/vlc_fixups.h
@@ -44,7 +44,8 @@ typedef struct
 
 #if !defined (HAVE_STRLCPY) || \
     !defined (HAVE_STRNDUP) || \
-    !defined (HAVE_STRNLEN)
+    !defined (HAVE_STRNLEN) || \
+    !defined (HAVE_GETCWD)
 # include <stddef.h> /* size_t */
 #endif
 
@@ -128,6 +129,10 @@ struct tm *localtime_r (const time_t *, struct tm *);
 void rewind (FILE *);
 #endif
 
+#ifndef HAVE_GETCWD
+char *getcwd (char *buf, size_t size);
+#endif
+
 #ifdef __cplusplus
 } /* extern "C" */
 #endif




More information about the vlc-devel mailing list