changeset 10175:d354be89b2c3

use link module from gnulib
author John W. Eaton <jwe@octave.org>
date Thu, 21 Jan 2010 02:37:26 -0500
parents eb64bf1c6107
children a0665fa8798c
files ChangeLog bootstrap.conf liboctave/ChangeLog liboctave/file-ops.cc liboctave/lo-cutils.c liboctave/lo-utils.h
diffstat 6 files changed, 21 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Jan 21 02:28:33 2010 -0500
+++ b/ChangeLog	Thu Jan 21 02:37:26 2010 -0500
@@ -1,3 +1,7 @@
+2010-01-21  John W. Eaton  <jwe@octave.org>
+
+	* bootstrap.conf (gnulib_modules): Include link in the list.
+
 2010-01-21  John W. Eaton  <jwe@octave.org>
 
 	* bootstrap.conf (gnulib_modules): Include unlink in the list.
--- a/bootstrap.conf	Thu Jan 21 02:28:33 2010 -0500
+++ b/bootstrap.conf	Thu Jan 21 02:37:26 2010 -0500
@@ -24,6 +24,7 @@
   getopt-gnu
   gettimeofday
   glob
+  link
   lstat
   mkdir
   mkfifo
--- a/liboctave/ChangeLog	Thu Jan 21 02:28:33 2010 -0500
+++ b/liboctave/ChangeLog	Thu Jan 21 02:37:26 2010 -0500
@@ -1,3 +1,9 @@
+2010-01-21  John W. Eaton  <jwe@octave.org>
+
+	* lo-cutils.c (octave_link): New funtion.
+	* lo-utils.h: Provide decl.
+	* file-ops.cc (file_ops::link): Call octave_link.
+
 2010-01-21  John W. Eaton  <jwe@octave.org>
 
 	* lo-cutils.c (octave_unlink): New funtion.
--- a/liboctave/file-ops.cc	Thu Jan 21 02:28:33 2010 -0500
+++ b/liboctave/file-ops.cc	Thu Jan 21 02:37:26 2010 -0500
@@ -167,17 +167,13 @@
 
   int status = -1;
 
-#if defined (HAVE_LINK)
-  status = ::link (old_name.c_str (), new_name.c_str ());
+  status = octave_link (old_name.c_str (), new_name.c_str ());
 
   if (status < 0)
     {
       using namespace std;
       msg = ::strerror (errno);
     }
-#else
-  msg = NOT_SUPPORTED ("link");
-#endif
 
   return status;
 }
--- a/liboctave/lo-cutils.c	Thu Jan 21 02:28:33 2010 -0500
+++ b/liboctave/lo-cutils.c	Thu Jan 21 02:37:26 2010 -0500
@@ -53,6 +53,12 @@
 #include "syswait.h"
 
 OCTAVE_API int
+octave_link (const char *old_name, const char *new_name)
+{
+  return link (old_name, new_name);
+}
+
+OCTAVE_API int
 octave_mkdir (const char *name, mode_t mode)
 {
   return mkdir (name, mode);
--- a/liboctave/lo-utils.h	Thu Jan 21 02:28:33 2010 -0500
+++ b/liboctave/lo-utils.h	Thu Jan 21 02:37:26 2010 -0500
@@ -51,6 +51,9 @@
 
 extern "C" OCTAVE_API int octave_gethostname (char *, int);
 
+extern "C" OCTAVE_API int
+octave_link (const char *old_name, const char *new_name);
+
 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);