# HG changeset patch # User John W. Eaton # Date 1264060065 18000 # Node ID cb3d926b4d9e4f8b681c96ea294a8cadb617af93 # Parent a0665fa8798cec267257782aa91f38a8994dcd1f use readlink module from gnulib diff -r a0665fa8798c -r cb3d926b4d9e ChangeLog --- a/ChangeLog Thu Jan 21 02:41:50 2010 -0500 +++ b/ChangeLog Thu Jan 21 02:47:45 2010 -0500 @@ -1,3 +1,8 @@ +2010-01-21 John W. Eaton + + * bootstrap.conf (gnulib_modules): Include pathmax and readlink + in the list. + 2010-01-21 John W. Eaton * bootstrap.conf (gnulib_modules): Include symlink in the list. diff -r a0665fa8798c -r cb3d926b4d9e bootstrap.conf --- a/bootstrap.conf Thu Jan 21 02:41:50 2010 -0500 +++ b/bootstrap.conf Thu Jan 21 02:47:45 2010 -0500 @@ -28,6 +28,8 @@ lstat mkdir mkfifo + pathmax + readlink rename rmdir stat diff -r a0665fa8798c -r cb3d926b4d9e liboctave/ChangeLog --- a/liboctave/ChangeLog Thu Jan 21 02:41:50 2010 -0500 +++ b/liboctave/ChangeLog Thu Jan 21 02:47:45 2010 -0500 @@ -1,3 +1,9 @@ +2010-01-21 John W. Eaton + + * lo-cutils.c (octave_readlink): New funtion. + * lo-utils.h: Provide decl. + * file-ops.cc (file_ops::readlink): Call octave_readlink. + 2010-01-21 John W. Eaton * lo-cutils.c (octave_symlink): New funtion. diff -r a0665fa8798c -r cb3d926b4d9e liboctave/file-ops.cc --- a/liboctave/file-ops.cc Thu Jan 21 02:41:50 2010 -0500 +++ b/liboctave/file-ops.cc Thu Jan 21 02:47:45 2010 -0500 @@ -37,6 +37,8 @@ #include #endif +#incluede + #ifdef HAVE_UNISTD_H #include #endif @@ -206,7 +208,7 @@ return status; } -// We provide a replacement for rename(). +// We provide a replacement for readlink(). int file_ops::readlink (const std::string& path, std::string& result) @@ -223,10 +225,9 @@ msg = std::string (); -#if defined (HAVE_READLINK) char buf[MAXPATHLEN+1]; - status = ::readlink (path.c_str (), buf, MAXPATHLEN); + status = octave_readlink (path.c_str (), buf, MAXPATHLEN); if (status < 0) { @@ -239,9 +240,6 @@ result = std::string (buf); status = 0; } -#else - msg = NOT_SUPPORTED ("rename"); -#endif return status; } diff -r a0665fa8798c -r cb3d926b4d9e liboctave/lo-cutils.c --- a/liboctave/lo-cutils.c Thu Jan 21 02:41:50 2010 -0500 +++ b/liboctave/lo-cutils.c Thu Jan 21 02:47:45 2010 -0500 @@ -65,6 +65,12 @@ } OCTAVE_API int +octave_readlink (const char *name, char *buf, size_t size) +{ + return readlink (name, buf, size); +} + +OCTAVE_API int octave_mkdir (const char *name, mode_t mode) { return mkdir (name, mode); diff -r a0665fa8798c -r cb3d926b4d9e liboctave/lo-utils.h --- a/liboctave/lo-utils.h Thu Jan 21 02:41:50 2010 -0500 +++ b/liboctave/lo-utils.h Thu Jan 21 02:47:45 2010 -0500 @@ -57,6 +57,9 @@ extern "C" OCTAVE_API int octave_symlink (const char *old_name, const char *new_name); +extern "C" OCTAVE_API int +octave_readlink (const char *name, char *buf, size_t size); + extern "C" OCTAVE_API int octave_mkdir (const char *name, mode_t mode); extern "C" OCTAVE_API int octave_mkfifo (const char *name, mode_t mode);