Mercurial > hg > octave-lojdl
changeset 10177:cb3d926b4d9e
use readlink module from gnulib
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 21 Jan 2010 02:47:45 -0500 |
parents | a0665fa8798c |
children | 6bd86b6287b1 |
files | ChangeLog bootstrap.conf liboctave/ChangeLog liboctave/file-ops.cc liboctave/lo-cutils.c liboctave/lo-utils.h |
diffstat | 6 files changed, 26 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-01-21 John W. Eaton <jwe@octave.org> + + * bootstrap.conf (gnulib_modules): Include pathmax and readlink + in the list. + 2010-01-21 John W. Eaton <jwe@octave.org> * bootstrap.conf (gnulib_modules): Include symlink in the list.
--- a/bootstrap.conf +++ b/bootstrap.conf @@ -28,6 +28,8 @@ lstat mkdir mkfifo + pathmax + readlink rename rmdir stat
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,9 @@ +2010-01-21 John W. Eaton <jwe@octave.org> + + * 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 <jwe@octave.org> * lo-cutils.c (octave_symlink): New funtion.
--- a/liboctave/file-ops.cc +++ b/liboctave/file-ops.cc @@ -37,6 +37,8 @@ #include <sys/types.h> #endif +#incluede <pathmax.h> + #ifdef HAVE_UNISTD_H #include <unistd.h> #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; }
--- a/liboctave/lo-cutils.c +++ b/liboctave/lo-cutils.c @@ -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);
--- a/liboctave/lo-utils.h +++ b/liboctave/lo-utils.h @@ -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);