diff liboctave/system/lo-sysdep.cc @ 21910:4d723ba06b4a

provide wrappers for some unistd.h functions * liboctave/wrappers/unistd-wrappers.c, liboctave/wrappers/unistd-wrappers.h: New files. * liboctave/wrappers/module.mk: Update. * gl2ps-print.cc, oct-hist.cc, oct-procbuf.cc, oct-tex-lexer.in.ll, sysdep.cc, octave.cc, parse-tree/lex.ll, file-ops.cc, lo-sysdep.cc, oct-env.cc, oct-syscalls.cc, cmd-edit.cc, kpse.cc: Use wrappers instead of calling unistd.h functions directly.
author John W. Eaton <jwe@octave.org>
date Tue, 14 Jun 2016 18:10:04 -0400
parents 590c39b94618
children c66c156e1d1d
line wrap: on
line diff
--- a/liboctave/system/lo-sysdep.cc	Tue Jun 14 16:31:34 2016 -0400
+++ b/liboctave/system/lo-sysdep.cc	Tue Jun 14 18:10:04 2016 -0400
@@ -28,9 +28,6 @@
 #include <string>
 #include <vector>
 
-#include <sys/types.h>
-#include <unistd.h>
-
 #include <fcntl.h>
 
 #if defined (__WIN32__) && ! defined (__CYGWIN__)
@@ -40,10 +37,11 @@
 
 #include "file-ops.h"
 #include "lo-error.h"
+#include "lo-sysdep.h"
+#include "oct-locbuf.h"
 #include "pathlen.h"
-#include "lo-sysdep.h"
 #include "str-vec.h"
-#include "oct-locbuf.h"
+#include "unistd-wrappers.h"
 
 namespace octave
 {
@@ -54,11 +52,11 @@
     {
       std::string retval;
 
-      // Using the gnulib getcwd module ensures that we have a getcwd that
+      // Using octave_getcwd_wrapper ensures that we have a getcwd that
       // will allocate a buffer as large as necessary if buf and size are
       // both 0.
 
-      char *tmp = gnulib::getcwd (0, 0);
+      char *tmp = octave_getcwd_wrapper (0, 0);
 
       if (! tmp)
         (*current_liboctave_error_handler) ("unable to find current directory");
@@ -79,7 +77,7 @@
         path += "\\";
 #endif
 
-      return gnulib::chdir (path.c_str ());
+      return octave_chdir_wrapper (path.c_str ());
     }
 
 #if defined (__WIN32__) && ! defined (__CYGWIN__)