changeset 21733:cb0fdd941d84

use namespace for system file_ops class * file-ops.h, file-ops.cc: Put file_ops class and related functions in octave::sys:: namespace. Change all uses.
author John W. Eaton <jwe@octave.org>
date Thu, 19 May 2016 00:33:18 -0400
parents 6a1eded90355
children 11af9c03400c
files libgui/graphics/Figure.cc libgui/src/m-editor/file-editor-tab.cc libgui/src/resource-manager.cc libinterp/corefcn/debug.cc libinterp/corefcn/defaults.cc libinterp/corefcn/dirfns.cc libinterp/corefcn/dlmread.cc libinterp/corefcn/file-io.cc libinterp/corefcn/graphics.cc libinterp/corefcn/help.cc libinterp/corefcn/load-path.cc libinterp/corefcn/load-save.cc libinterp/corefcn/ls-mat5.cc libinterp/corefcn/oct-hist.cc libinterp/corefcn/symtab.cc libinterp/corefcn/syscalls.cc libinterp/corefcn/sysdep.cc libinterp/corefcn/urlwrite.cc libinterp/corefcn/utils.cc libinterp/corefcn/variables.cc libinterp/dldfcn/__fltk_uigetfile__.cc libinterp/octave-value/ov-fcn-handle.cc libinterp/octave-value/ov-java.cc libinterp/octave.cc libinterp/parse-tree/oct-parse.in.yy liboctave/system/dir-ops.cc liboctave/system/file-ops.cc liboctave/system/file-ops.h liboctave/system/file-stat.cc liboctave/system/lo-sysdep.cc liboctave/system/oct-env.cc liboctave/util/cmd-edit.cc liboctave/util/cmd-hist.cc liboctave/util/url-transfer.cc
diffstat 34 files changed, 974 insertions(+), 790 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/graphics/Figure.cc	Wed May 18 14:58:29 2016 -0400
+++ b/libgui/graphics/Figure.cc	Thu May 19 00:33:18 2016 -0400
@@ -845,7 +845,7 @@
 {
   std::string msg;
 
-  std::string file = octave_tempnam ("", "oct-", msg) + "." + format;
+  std::string file = octave::sys::tempnam ("", "oct-", msg) + "." + format;
 
   if (file.empty ())
     {
--- a/libgui/src/m-editor/file-editor-tab.cc	Wed May 18 14:58:29 2016 -0400
+++ b/libgui/src/m-editor/file-editor-tab.cc	Thu May 19 00:33:18 2016 -0400
@@ -974,13 +974,13 @@
   // Is the last component of DIR @foo?  If so, strip it and prepend it
   // to the name of the function.
 
-  size_t pos = dir.rfind (file_ops::dir_sep_chars ());
+  size_t pos = dir.rfind (octave::sys::file_ops::dir_sep_chars ());
 
   if (pos != std::string::npos && pos < dir.length () - 1)
     {
       if (dir[pos+1] == '@')
         {
-          function_name = file_ops::concat (dir.substr (pos+1), function_name);
+          function_name = octave::sys::file_ops::concat (dir.substr (pos+1), function_name);
 
           dir = dir.substr (0, pos);
         }
--- a/libgui/src/resource-manager.cc	Wed May 18 14:58:29 2016 -0400
+++ b/libgui/src/resource-manager.cc	Thu May 19 00:33:18 2016 -0400
@@ -53,7 +53,7 @@
   std::string dsf = octave::sys::env::getenv ("OCTAVE_DEFAULT_QT_SETTINGS");
 
   if (dsf.empty ())
-    dsf = Voct_etc_dir + file_ops::dir_sep_str () + "default-qt-settings";
+    dsf = Voct_etc_dir + octave::sys::file_ops::dir_sep_str () + "default-qt-settings";
 
   return QString::fromStdString (dsf);
 }
--- a/libinterp/corefcn/debug.cc	Wed May 18 14:58:29 2016 -0400
+++ b/libinterp/corefcn/debug.cc	Thu May 19 00:33:18 2016 -0400
@@ -186,12 +186,12 @@
     {
       std::string name = fname;
 
-      if (file_ops::dir_sep_char () != '/' && name[0] == '@')
+      if (octave::sys::file_ops::dir_sep_char () != '/' && name[0] == '@')
         {
           int len = name.length () - 1;         // -1: can't have trailing '/'
           for (int i = 2; i < len; i++)         //  2: can't have @/method
             if (name[i] == '/')
-              name[i] = file_ops::dir_sep_char ();
+              name[i] = octave::sys::file_ops::dir_sep_char ();
         }
 
       size_t name_len = name.length ();
@@ -1495,7 +1495,7 @@
           if (sub_fun)
             filename = filename.substr(0, sub_fun - filename.c_str ());
           octave_value path_name;
-          path_name = octave_canonicalize_file_name (do_which (filename));
+          path_name = octave::sys::canonicalize_file_name (do_which (filename));
 
           for (std::list<bp_type>::const_iterator j = it->second.begin ();
                j != it->second.end (); j++)
--- a/libinterp/corefcn/defaults.cc	Wed May 18 14:58:29 2016 -0400
+++ b/libinterp/corefcn/defaults.cc	Thu May 19 00:33:18 2016 -0400
@@ -114,9 +114,9 @@
         retval.replace (0, len, Voctave_home);
     }
 
-  if (file_ops::dir_sep_char () != '/')
+  if (octave::sys::file_ops::dir_sep_char () != '/')
     std::replace (retval.begin (), retval.end (), '/',
-                  file_ops::dir_sep_char ());
+                  octave::sys::file_ops::dir_sep_char ());
 
   return retval;
 }
@@ -409,7 +409,7 @@
 
       if (df.empty ())
         Vbuilt_in_docstrings_file
-          = Voct_etc_dir + file_ops::dir_sep_str () + "built-in-docstrings";
+          = Voct_etc_dir + octave::sys::file_ops::dir_sep_str () + "built-in-docstrings";
       else
         Vbuilt_in_docstrings_file = df;
     }
--- a/libinterp/corefcn/dirfns.cc	Wed May 18 14:58:29 2016 -0400
+++ b/libinterp/corefcn/dirfns.cc	Thu May 19 00:33:18 2016 -0400
@@ -71,7 +71,7 @@
 static int
 octave_change_to_directory (const std::string& newdir)
 {
-  std::string xdir = file_ops::tilde_expand (newdir);
+  std::string xdir = octave::sys::file_ops::tilde_expand (newdir);
 
   int cd_ok = octave::sys::env::chdir (xdir);
 
@@ -218,12 +218,12 @@
       std::string parent = args(0).xstring_value ("mkdir: PARENT must be a string");
       std::string dir = args(1).xstring_value ("mkdir: DIR must be a string");
 
-      dirname = file_ops::concat (parent, dir);
+      dirname = octave::sys::file_ops::concat (parent, dir);
     }
   else if (nargin == 1)
     dirname = args(0).xstring_value ("mkdir: DIR must be a string");
 
-  dirname = file_ops::tilde_expand (dirname);
+  dirname = octave::sys::file_ops::tilde_expand (dirname);
 
   file_stat fs (dirname);
 
@@ -236,7 +236,7 @@
     {
       std::string msg;
 
-      int status = octave_mkdir (dirname, 0777, msg);
+      int status = octave::sys::mkdir (dirname, 0777, msg);
 
       if (status < 0)
         return ovl (false, msg, "mkdir");
@@ -270,7 +270,7 @@
 
   std::string dirname = args(0).xstring_value ("rmdir: DIR must be a string");
 
-  std::string fulldir = file_ops::tilde_expand (dirname);
+  std::string fulldir = octave::sys::file_ops::tilde_expand (dirname);
   int status = -1;
   std::string msg;
 
@@ -289,10 +289,10 @@
         }
 
       if (doit)
-        status = octave_recursive_rmdir (fulldir, msg);
+        status = octave::sys::recursive_rmdir (fulldir, msg);
     }
   else
-    status = octave_rmdir (fulldir, msg);
+    status = octave::sys::rmdir (fulldir, msg);
 
   if (status < 0)
     return ovl (false, msg, "rmdir");
@@ -320,7 +320,7 @@
 
   std::string msg;
 
-  int status = octave_link (from, to, msg);
+  int status = octave::sys::link (from, to, msg);
 
   if (status < 0)
     return ovl (-1.0, msg);
@@ -348,7 +348,7 @@
 
   std::string msg;
 
-  int status = octave_symlink (from, to, msg);
+  int status = octave::sys::symlink (from, to, msg);
 
   if (status < 0)
     return ovl (-1.0, msg);
@@ -376,7 +376,7 @@
 
   std::string result, msg;
 
-  int status = octave_readlink (symlink, result, msg);
+  int status = octave::sys::readlink (symlink, result, msg);
 
   if (status < 0)
     return ovl ("", -1.0, msg);
@@ -404,7 +404,7 @@
 
   std::string msg;
 
-  int status = octave_rename (from, to, msg);
+  int status = octave::sys::rename (from, to, msg);
 
   if (status < 0)
     return ovl (-1.0, msg);
@@ -468,7 +468,7 @@
 
   string_vector pat = args(0).xstring_vector_value ("glob: PATTERN must be a string");
 
-  glob_match pattern (file_ops::tilde_expand (pat));
+  glob_match pattern (octave::sys::file_ops::tilde_expand (pat));
 
   return ovl (Cell (pattern.glob ()));
 }
@@ -529,7 +529,7 @@
   string_vector pat = args(0).string_vector_value ();
   string_vector str = args(1).string_vector_value ();
 
-  glob_match pattern (file_ops::tilde_expand (pat));
+  glob_match pattern (octave::sys::file_ops::tilde_expand (pat));
 
   return ovl (pattern.match (str));
 }
@@ -555,14 +555,14 @@
   octave_value retval;
 
   if (nargin == 0)
-    retval = file_ops::dir_sep_str ();
+    retval = octave::sys::file_ops::dir_sep_str ();
   else
     {
       std::string s = args(0).xstring_value ("filesep: argument must be a string");
       if (s != "all")
         error ("filesep: argument must be \"all\"");
 
-      retval = file_ops::dir_sep_chars ();
+      retval = octave::sys::file_ops::dir_sep_chars ();
     }
 
   return retval;
--- a/libinterp/corefcn/dlmread.cc	Wed May 18 14:58:29 2016 -0400
+++ b/libinterp/corefcn/dlmread.cc	Thu May 19 00:33:18 2016 -0400
@@ -213,7 +213,7 @@
       // Filename.
       std::string fname (args(0).string_value ());
 
-      std::string tname = file_ops::tilde_expand (fname);
+      std::string tname = octave::sys::file_ops::tilde_expand (fname);
 
       tname = find_data_file_in_load_path ("dlmread", tname);
 
--- a/libinterp/corefcn/file-io.cc	Wed May 18 14:58:29 2016 -0400
+++ b/libinterp/corefcn/file-io.cc	Thu May 19 00:33:18 2016 -0400
@@ -450,7 +450,7 @@
   oct_mach_info::float_format flt_fmt =
     oct_mach_info::string_to_float_format (arch);
 
-  std::string fname = file_ops::tilde_expand (name);
+  std::string fname = octave::sys::file_ops::tilde_expand (name);
 
   file_stat fs (fname);
 
@@ -2765,7 +2765,7 @@
   if (nargin > 1)
     pfx = args(1).xstring_value ("tempname: PREFIX must be a string");
 
-  return ovl (octave_tempnam (dir, pfx));
+  return ovl (octave::sys::tempnam (dir, pfx));
 }
 
 /*
@@ -2996,7 +2996,7 @@
 
   int oct_mask = convert (mask, 8, 10);
 
-  int status = convert (octave_umask (oct_mask), 10, 8);
+  int status = convert (octave::sys::umask (oct_mask), 10, 8);
 
   if (status >= 0)
     return ovl (status);
--- a/libinterp/corefcn/graphics.cc	Wed May 18 14:58:29 2016 -0400
+++ b/libinterp/corefcn/graphics.cc	Thu May 19 00:33:18 2016 -0400
@@ -10799,7 +10799,7 @@
             error ("drawnow: empty pipe '|'");
           else if (file[0] != '|')
             {
-              size_t pos = file.find_last_of (file_ops::dir_sep_chars ());
+              size_t pos = file.find_last_of (octave::sys::file_ops::dir_sep_chars ());
 
               if (pos != std::string::npos)
                 {
--- a/libinterp/corefcn/help.cc	Wed May 18 14:58:29 2016 -0400
+++ b/libinterp/corefcn/help.cc	Thu May 19 00:33:18 2016 -0400
@@ -1310,12 +1310,12 @@
     {
       const int dir_len = dir.size ();
       const int filename_len = filename.size ();
-      const int max_allowed_seps = file_ops::is_dir_sep (dir[dir_len-1]) ? 0
+      const int max_allowed_seps = octave::sys::file_ops::is_dir_sep (dir[dir_len-1]) ? 0
                                                                          : 1;
 
       int num_seps = 0;
       for (int i = dir_len; i < filename_len; i++)
-        if (file_ops::is_dir_sep (filename[i]))
+        if (octave::sys::file_ops::is_dir_sep (filename[i]))
           num_seps++;
 
       return (num_seps <= max_allowed_seps);
--- a/libinterp/corefcn/load-path.cc	Wed May 18 14:58:29 2016 -0400
+++ b/libinterp/corefcn/load-path.cc	Thu May 19 00:33:18 2016 -0400
@@ -195,7 +195,7 @@
         {
           std::string fname = flist[i];
 
-          std::string full_name = file_ops::concat (d, fname);
+          std::string full_name = octave::sys::file_ops::concat (d, fname);
 
           file_stat fs (full_name);
 
@@ -304,7 +304,7 @@
 {
   method_file_map[class_name].method_file_map = get_fcn_files (d);
 
-  std::string pd = file_ops::concat (d, "private");
+  std::string pd = octave::sys::file_ops::concat (d, "private");
 
   file_stat fs (pd);
 
@@ -343,7 +343,7 @@
 load_path::const_dir_info_list_iterator
 load_path::find_dir_info (const std::string& dir_arg) const
 {
-  std::string dir = file_ops::tilde_expand (dir_arg);
+  std::string dir = octave::sys::file_ops::tilde_expand (dir_arg);
 
   const_dir_info_list_iterator retval = dir_info_list.begin ();
 
@@ -361,7 +361,7 @@
 load_path::dir_info_list_iterator
 load_path::find_dir_info (const std::string& dir_arg)
 {
-  std::string dir = file_ops::tilde_expand (dir_arg);
+  std::string dir = octave::sys::file_ops::tilde_expand (dir_arg);
 
   dir_info_list_iterator retval = dir_info_list.begin ();
 
@@ -462,7 +462,7 @@
       fcn_map_type& fm = i->second;
 
       std::string full_dir_name
-        = file_ops::concat (dir_name, "@" + class_name);
+        = octave::sys::file_ops::concat (dir_name, "@" + class_name);
 
       for (fcn_map_iterator q = fm.begin (); q != fm.end (); q++)
         {
@@ -729,7 +729,7 @@
 
   size_t k = dir.length ();
 
-  while (k > 1 && file_ops::is_dir_sep (dir[k-1]))
+  while (k > 1 && octave::sys::file_ops::is_dir_sep (dir[k-1]))
     k--;
 
   if (k < dir.length ())
@@ -747,7 +747,7 @@
     warning_with_id ("Octave:recursive-path-search",
                      "trailing '//' is no longer special in search path elements");
 
-  std::string dir = file_ops::tilde_expand (dir_arg);
+  std::string dir = octave::sys::file_ops::tilde_expand (dir_arg);
 
   dir = strip_trailing_separators (dir);
 
@@ -853,7 +853,7 @@
 
       fcn_map_type& fm = i->second;
 
-      std::string full_dir_name = file_ops::concat (dir, "@" + class_name);
+      std::string full_dir_name = octave::sys::file_ops::concat (dir, "@" + class_name);
 
       for (fcn_map_iterator q = fm.begin (); q != fm.end (); q++)
         {
@@ -898,7 +898,7 @@
         }
       else
         {
-          std::string dir = file_ops::tilde_expand (dir_arg);
+          std::string dir = octave::sys::file_ops::tilde_expand (dir_arg);
 
           dir = strip_trailing_separators (dir);
 
@@ -1115,7 +1115,7 @@
             {
               const file_info& fi = *i;
 
-              retval = file_ops::concat (fi.dir_name, fcn);
+              retval = octave::sys::file_ops::concat (fi.dir_name, fcn);
 
               if (check_file_type (retval, type, fi.types,
                                    fcn, "load_path::do_find_fcn"))
@@ -1151,7 +1151,7 @@
       if (p != m.end ())
         {
           std::string fname
-            = file_ops::concat (file_ops::concat (dir, "private"), fcn);
+            = octave::sys::file_ops::concat (octave::sys::file_ops::concat (dir, "private"), fcn);
 
           if (check_file_type (fname, type, p->second, fcn,
                                "load_path::find_private_fcn"))
@@ -1191,7 +1191,7 @@
             {
               const file_info& fi = *i;
 
-              retval = file_ops::concat (fi.dir_name, meth);
+              retval = octave::sys::file_ops::concat (fi.dir_name, meth);
 
               bool found = check_file_type (retval, type, fi.types,
                                             meth, "load_path::do_find_method");
@@ -1307,8 +1307,8 @@
 
       if (! dir_name.empty ())
         {
-          std::string pfname = dir_name + file_ops::dir_sep_str ()
-                               + "private" + file_ops::dir_sep_str () + fname;
+          std::string pfname = dir_name + octave::sys::file_ops::dir_sep_str ()
+                               + "private" + octave::sys::file_ops::dir_sep_str () + fname;
 
           file_stat fs (pfname);
 
@@ -1340,7 +1340,7 @@
         return tfile;
     }
 
-  if (file.find_first_of (file_ops::dir_sep_chars ()) != std::string::npos)
+  if (file.find_first_of (octave::sys::file_ops::dir_sep_chars ()) != std::string::npos)
     {
       // Given name has a directory separator, so append it to each
       // element of the load path in turn.
@@ -1349,7 +1349,7 @@
            p != dir_info_list.end ();
            p++)
         {
-          std::string tfile = file_ops::concat (p->dir_name, file);
+          std::string tfile = octave::sys::file_ops::concat (p->dir_name, file);
 
           file_stat fs (tfile);
 
@@ -1372,7 +1372,7 @@
           for (octave_idx_type i = 0; i < len; i++)
             {
               if (all_files[i] == file)
-                return file_ops::concat (p->dir_name, file);
+                return octave::sys::file_ops::concat (p->dir_name, file);
             }
         }
     }
@@ -1385,7 +1385,7 @@
 {
   std::string retval;
 
-  if (dir.find_first_of (file_ops::dir_sep_chars ()) != std::string::npos
+  if (dir.find_first_of (octave::sys::file_ops::dir_sep_chars ()) != std::string::npos
       && (octave::sys::env::absolute_pathname (dir)
           || octave::sys::env::rooted_relative_pathname (dir)))
     {
@@ -1404,7 +1404,7 @@
 
           size_t dname_len = dname.length ();
 
-          if (dname.substr (dname_len - 1) == file_ops::dir_sep_str ())
+          if (dname.substr (dname_len - 1) == octave::sys::file_ops::dir_sep_str ())
             {
               dname = dname.substr (0, dname_len - 1);
               dname_len--;
@@ -1413,7 +1413,7 @@
           size_t dir_len = dir.length ();
 
           if (dname_len > dir_len
-              && file_ops::is_dir_sep (dname[dname_len - dir_len - 1])
+              && octave::sys::file_ops::is_dir_sep (dname[dname_len - dir_len - 1])
               && dir == dname.substr (dname_len - dir_len))
             {
               file_stat fs (p->dir_name);
@@ -1432,7 +1432,7 @@
 {
   std::list<std::string> retlist;
 
-  if (dir.find_first_of (file_ops::dir_sep_chars ()) != std::string::npos
+  if (dir.find_first_of (octave::sys::file_ops::dir_sep_chars ()) != std::string::npos
       && (octave::sys::env::absolute_pathname (dir)
           || octave::sys::env::rooted_relative_pathname (dir)))
     {
@@ -1451,7 +1451,7 @@
 
           size_t dname_len = dname.length ();
 
-          if (dname.substr (dname_len - 1) == file_ops::dir_sep_str ())
+          if (dname.substr (dname_len - 1) == octave::sys::file_ops::dir_sep_str ())
             {
               dname = dname.substr (0, dname_len - 1);
               dname_len--;
@@ -1460,7 +1460,7 @@
           size_t dir_len = dir.length ();
 
           if (dname_len > dir_len
-              && file_ops::is_dir_sep (dname[dname_len - dir_len - 1])
+              && octave::sys::file_ops::is_dir_sep (dname[dname_len - dir_len - 1])
               && dir == dname.substr (dname_len - dir_len))
             {
               file_stat fs (p->dir_name);
@@ -1491,7 +1491,7 @@
     {
       std::string file = flist[i];
 
-      if (file.find_first_of (file_ops::dir_sep_chars ()) != std::string::npos)
+      if (file.find_first_of (octave::sys::file_ops::dir_sep_chars ()) != std::string::npos)
         {
           if (octave::sys::env::absolute_pathname (file)
               || octave::sys::env::rooted_relative_pathname (file))
@@ -1507,7 +1507,7 @@
                    p != dir_info_list.end ();
                    p++)
                 {
-                  std::string tfile = file_ops::concat (p->dir_name, file);
+                  std::string tfile = octave::sys::file_ops::concat (p->dir_name, file);
 
                   file_stat fs (tfile);
 
@@ -1548,7 +1548,7 @@
 done:
 
   if (! dir_name.empty ())
-    retval = file_ops::concat (dir_name, file_name);
+    retval = octave::sys::file_ops::concat (dir_name, file_name);
 
   return retval;
 }
@@ -1570,7 +1570,7 @@
     {
       std::string file = flist[i];
 
-      if (file.find_first_of (file_ops::dir_sep_chars ()) != std::string::npos)
+      if (file.find_first_of (octave::sys::file_ops::dir_sep_chars ()) != std::string::npos)
         {
           if (octave::sys::env::absolute_pathname (file)
               || octave::sys::env::rooted_relative_pathname (file))
@@ -1586,7 +1586,7 @@
                    p != dir_info_list.end ();
                    p++)
                 {
-                  std::string tfile = file_ops::concat (p->dir_name, file);
+                  std::string tfile = octave::sys::file_ops::concat (p->dir_name, file);
 
                   file_stat fs (tfile);
 
@@ -1613,7 +1613,7 @@
           for (octave_idx_type j = 0; j < rel_flen; j++)
             {
               if (all_files[i] == rel_flist[j])
-                retlist.push_back (file_ops::concat (p->dir_name,
+                retlist.push_back (octave::sys::file_ops::concat (p->dir_name,
                                                      rel_flist[j]));
             }
         }
@@ -1936,7 +1936,7 @@
                 {
                   if (symbol_table::is_built_in_function_name (base))
                     {
-                      std::string fcn_path = file_ops::concat (dir_name, fname);
+                      std::string fcn_path = octave::sys::file_ops::concat (dir_name, fname);
 
                       warning_with_id ("Octave:shadowed-function",
                                        "function %s shadows a built-in function",
@@ -1958,7 +1958,7 @@
                       && sys_path.find (old.dir_name) != std::string::npos
                       && in_path_list (sys_path, old.dir_name))
                     {
-                      std::string fcn_path = file_ops::concat (dir_name, fname);
+                      std::string fcn_path = octave::sys::file_ops::concat (dir_name, fname);
 
                       warning_with_id ("Octave:shadowed-function",
                                        "function %s shadows a core library function",
@@ -2009,7 +2009,7 @@
       fcn_map_type& fm = method_map[class_name];
 
       std::string full_dir_name
-        = file_ops::concat (dir_name, "@" + class_name);
+        = octave::sys::file_ops::concat (dir_name, "@" + class_name);
 
       const dir_info::class_info& ci = q->second;
 
@@ -2077,7 +2077,7 @@
        i != private_fcn_map.end (); i++)
     {
       os << "\n*** private functions in "
-         << file_ops::concat (i->first, "private") << ":\n\n";
+         << octave::sys::file_ops::concat (i->first, "private") << ":\n\n";
 
       print_fcn_list (os, i->second);
     }
@@ -2171,7 +2171,7 @@
 
               if (! skip_p)
                 {
-                  std::string nm = file_ops::concat (dirname, elt);
+                  std::string nm = octave::sys::file_ops::concat (dirname, elt);
 
                   file_stat fs (nm);
 
@@ -2209,7 +2209,7 @@
 
   unwind_protect frame;
 
-  std::string file = file_ops::concat (dir, script_file);
+  std::string file = octave::sys::file_ops::concat (dir, script_file);
 
   file_stat fs (file);
 
--- a/libinterp/corefcn/load-save.cc	Wed May 18 14:58:29 2016 -0400
+++ b/libinterp/corefcn/load-save.cc	Thu May 19 00:33:18 2016 -0400
@@ -494,7 +494,7 @@
   std::string fname = find_data_file_in_load_path ("load", name, true);
 
   size_t dot_pos = fname.rfind (".");
-  size_t sep_pos = fname.find_last_of (file_ops::dir_sep_chars ());
+  size_t sep_pos = fname.find_last_of (octave::sys::file_ops::dir_sep_chars ());
 
   if (dot_pos == std::string::npos
       || (sep_pos != std::string::npos && dot_pos < sep_pos))
@@ -749,7 +749,7 @@
     }
   else
     {
-      std::string fname = file_ops::tilde_expand (orig_fname);
+      std::string fname = octave::sys::file_ops::tilde_expand (orig_fname);
 
       fname = find_file_to_load (fname, orig_fname);
 
@@ -1634,7 +1634,7 @@
     print_usage ();
   else
     {
-      std::string fname = file_ops::tilde_expand (argv[i]);
+      std::string fname = octave::sys::file_ops::tilde_expand (argv[i]);
 
       i++;
 
--- a/libinterp/corefcn/ls-mat5.cc	Wed May 18 14:58:29 2016 -0400
+++ b/libinterp/corefcn/ls-mat5.cc	Thu May 19 00:33:18 2016 -0400
@@ -881,7 +881,7 @@
                     if (fs.exists ())
                       {
                         size_t xpos
-                          = str.find_last_of (file_ops::dir_sep_chars ());
+                          = str.find_last_of (octave::sys::file_ops::dir_sep_chars ());
 
                         std::string dir_name = str.substr (0, xpos);
 
@@ -910,7 +910,7 @@
                           octave::sys::env::make_absolute (p.find_first_of (names));
 
                         size_t xpos
-                          = str.find_last_of (file_ops::dir_sep_chars ());
+                          = str.find_last_of (octave::sys::file_ops::dir_sep_chars ());
 
                         std::string dir_name = str.substr (0, xpos);
 
@@ -935,7 +935,7 @@
                 else
                   {
                     size_t xpos
-                      = fpath.find_last_of (file_ops::dir_sep_chars ());
+                      = fpath.find_last_of (octave::sys::file_ops::dir_sep_chars ());
 
                     std::string dir_name = fpath.substr (0, xpos);
 
--- a/libinterp/corefcn/oct-hist.cc	Wed May 18 14:58:29 2016 -0400
+++ b/libinterp/corefcn/oct-hist.cc	Thu May 19 00:33:18 2016 -0400
@@ -83,7 +83,7 @@
     file = env_file;
 
   if (file.empty ())
-    file = file_ops::concat (octave::sys::env::get_home_directory (),
+    file = octave::sys::file_ops::concat (octave::sys::env::get_home_directory (),
                              ".octave_hist");
 
   return file;
@@ -411,7 +411,7 @@
       reverse = true;
     }
 
-  std::string name = octave_tempnam ("", "oct-");
+  std::string name = octave::sys::tempnam ("", "oct-");
 
   std::fstream file (name.c_str (), std::ios::out);
 
--- a/libinterp/corefcn/symtab.cc	Wed May 18 14:58:29 2016 -0400
+++ b/libinterp/corefcn/symtab.cc	Thu May 19 00:33:18 2016 -0400
@@ -397,7 +397,7 @@
         {
           std::string class_name;
 
-          size_t pos = dir_name.find_last_of (file_ops::dir_sep_chars ());
+          size_t pos = dir_name.find_last_of (octave::sys::file_ops::dir_sep_chars ());
 
           if (pos != std::string::npos)
             {
@@ -1057,7 +1057,7 @@
 
       if (! file_name.empty ())
         {
-          size_t pos = file_name.find_last_of (file_ops::dir_sep_chars ());
+          size_t pos = file_name.find_last_of (octave::sys::file_ops::dir_sep_chars ());
 
           std::string dir_name = file_name.substr (0, pos);
 
@@ -1283,10 +1283,10 @@
     {
       // Look for a class specific function.
       std::string dispatch_type =
-        name.substr (1, name.find_first_of (file_ops::dir_sep_str ()) - 1);
+        name.substr (1, name.find_first_of (octave::sys::file_ops::dir_sep_str ()) - 1);
 
       std::string method;
-      size_t pos = name.find_last_of (file_ops::dir_sep_str ());
+      size_t pos = name.find_last_of (octave::sys::file_ops::dir_sep_str ());
       if (pos != std::string::npos)
         method = name.substr (pos + 1);
 
@@ -1333,7 +1333,7 @@
 {
   octave_value fcn;
 
-  std::string full_name = "@" + dispatch_type + file_ops::dir_sep_str () + name;
+  std::string full_name = "@" + dispatch_type + octave::sys::file_ops::dir_sep_str () + name;
   size_t pos = full_name.find_first_of (Vfilemarker);
 
   if (pos != std::string::npos)
--- a/libinterp/corefcn/syscalls.cc	Wed May 18 14:58:29 2016 -0400
+++ b/libinterp/corefcn/syscalls.cc	Thu May 19 00:33:18 2016 -0400
@@ -274,8 +274,8 @@
   std::string msg;
   pid_t pid;
 
-  pid = octave::sys::popen2 (exec_file, arg_list, sync_mode,
-                                 filedesc, msg, interactive);
+  pid = octave::sys::popen2 (exec_file, arg_list, sync_mode, filedesc,
+                             msg, interactive);
   if (pid < 0)
     error (msg.c_str ());
 
@@ -689,7 +689,7 @@
 
   std::string msg;
 
-  int status = octave_mkfifo (name, mode, msg);
+  int status = octave::sys::mkfifo (name, mode, msg);
 
   return ovl (status, msg);
 }
@@ -1065,7 +1065,7 @@
 
   std::string msg;
 
-  int status = octave_unlink (name, msg);
+  int status = octave::sys::unlink (name, msg);
 
   return ovl (status, msg);
 }
@@ -1294,7 +1294,7 @@
 
   std::string msg;
 
-  std::string result = octave_canonicalize_file_name (name, msg);
+  std::string result = octave::sys::canonicalize_file_name (name, msg);
 
   return ovl (result, msg.empty () ? 0 : -1, msg);
 }
--- a/libinterp/corefcn/sysdep.cc	Wed May 18 14:58:29 2016 -0400
+++ b/libinterp/corefcn/sysdep.cc	Thu May 19 00:33:18 2016 -0400
@@ -899,7 +899,7 @@
 
   string_vector sv = arg.xstring_vector_value ("tilde_expand: argument must be char or cellstr object");
 
-  sv = file_ops::tilde_expand (sv);
+  sv = octave::sys::file_ops::tilde_expand (sv);
 
   if (arg.is_cellstr ())
     return ovl (Cell (arg.dims (), sv));
--- a/libinterp/corefcn/urlwrite.cc	Wed May 18 14:58:29 2016 -0400
+++ b/libinterp/corefcn/urlwrite.cc	Thu May 19 00:33:18 2016 -0400
@@ -55,7 +55,7 @@
 static void
 delete_file (const std::string& file)
 {
-  octave_unlink (file);
+  octave::sys::unlink (file);
 }
 
 typedef octave_handle curl_handle;
@@ -809,7 +809,7 @@
 
   string_vector file_list;
 
-  glob_match pattern (file_ops::tilde_expand (pat));
+  glob_match pattern (octave::sys::file_ops::tilde_expand (pat));
   string_vector files = pattern.glob ();
 
   for (octave_idx_type i = 0; i < files.numel (); i++)
@@ -870,7 +870,7 @@
   std::string target;
 
   if (nargin == 3 && ! args(2).is_empty ())
-    target = args(2).xstring_value ("__ftp_mget__: TARGET must be a string") + file_ops::dir_sep_str ();
+    target = args(2).xstring_value ("__ftp_mget__: TARGET must be a string") + octave::sys::file_ops::dir_sep_str ();
 
   url_transfer curl = ch_manager::get_object (args(0));
 
--- a/libinterp/corefcn/utils.cc	Wed May 18 14:58:29 2016 -0400
+++ b/libinterp/corefcn/utils.cc	Thu May 19 00:33:18 2016 -0400
@@ -516,7 +516,7 @@
 
   if (dir.length () > 0)
     {
-      std::string tcontents = file_ops::concat (load_path::find_dir (dir),
+      std::string tcontents = octave::sys::file_ops::concat (load_path::find_dir (dir),
                                                 std::string ("Contents.m"));
 
       file_stat fs (tcontents);
--- a/libinterp/corefcn/variables.cc	Wed May 18 14:58:29 2016 -0400
+++ b/libinterp/corefcn/variables.cc	Thu May 19 00:33:18 2016 -0400
@@ -293,7 +293,7 @@
 {
   bool retval = (! text.empty ()
                  && text != "."
-                 && text.find_first_of (file_ops::dir_sep_chars ()) == std::string::npos
+                 && text.find_first_of (octave::sys::file_ops::dir_sep_chars ()) == std::string::npos
                  && text.find ("..") == std::string::npos
                  && text.rfind ('.') != std::string::npos);
 
--- a/libinterp/dldfcn/__fltk_uigetfile__.cc	Wed May 18 14:58:29 2016 -0400
+++ b/libinterp/dldfcn/__fltk_uigetfile__.cc	Thu May 19 00:33:18 2016 -0400
@@ -125,10 +125,10 @@
         }
 
       if (multi_type == Fl_File_Chooser::DIRECTORY)
-        retval(0) = file_ops::native_separator_path (std::string (fc.value ()));
+        retval(0) = octave::sys::file_ops::native_separator_path (std::string (fc.value ()));
       else
         {
-          retval(1) = file_ops::native_separator_path (
+          retval(1) = octave::sys::file_ops::native_separator_path (
                         std::string (fc.directory ()) + sep);
           retval(2) = fc.filter_value () + 1;
         }
--- a/libinterp/octave-value/ov-fcn-handle.cc	Wed May 18 14:58:29 2016 -0400
+++ b/libinterp/octave-value/ov-fcn-handle.cc	Thu May 19 00:33:18 2016 -0400
@@ -270,7 +270,7 @@
 
       if (fs.exists ())
         {
-          size_t xpos = str.find_last_of (file_ops::dir_sep_chars ());
+          size_t xpos = str.find_last_of (octave::sys::file_ops::dir_sep_chars ());
 
           std::string dir_name = str.substr (0, xpos);
 
@@ -296,7 +296,7 @@
 
           str = octave::sys::env::make_absolute (p.find_first_of (names));
 
-          size_t xpos = str.find_last_of (file_ops::dir_sep_chars ());
+          size_t xpos = str.find_last_of (octave::sys::file_ops::dir_sep_chars ());
 
           std::string dir_name = str.substr (0, xpos);
 
@@ -314,7 +314,7 @@
     {
       if (fpath.length () > 0)
         {
-          size_t xpos = fpath.find_last_of (file_ops::dir_sep_chars ());
+          size_t xpos = fpath.find_last_of (octave::sys::file_ops::dir_sep_chars ());
 
           std::string dir_name = fpath.substr (0, xpos);
 
--- a/libinterp/octave-value/ov-java.cc	Wed May 18 14:58:29 2016 -0400
+++ b/libinterp/octave-value/ov-java.cc	Thu May 19 00:33:18 2016 -0400
@@ -366,7 +366,7 @@
       java_dir = octave::sys::env::getenv ("OCTAVE_JAVA_DIR");
 
       if (java_dir.empty ())
-        java_dir = Vfcn_file_dir + file_ops::dir_sep_str () + "java";
+        java_dir = Vfcn_file_dir + octave::sys::file_ops::dir_sep_str () + "java";
     }
 
   return java_dir;
@@ -410,7 +410,7 @@
                   // append content of line without whitespace
                   int last = line.find_last_not_of (" \t\f\v\r\n");
 
-                  classpath.append (file_ops::tilde_expand (line.substr (0, last+1)));
+                  classpath.append (octave::sys::file_ops::tilde_expand (line.substr (0, last+1)));
                 }
             }
         }
@@ -429,7 +429,7 @@
   // find octave.jar file
   if (! retval.empty ())
     {
-      std::string sep = file_ops::dir_sep_str ();
+      std::string sep = octave::sys::file_ops::dir_sep_str ();
 
       std::string jar_file = java_dir + sep + "octave.jar";
 
@@ -474,7 +474,7 @@
               if (cwd != home_dir)
                 {
                   cp_file = "~" + sep + filename;
-                  cp_file = file_ops::tilde_expand (cp_file);
+                  cp_file = octave::sys::file_ops::tilde_expand (cp_file);
                   cp_exists = file_stat (cp_file);
                   if (cp_exists)
                     {
@@ -686,7 +686,7 @@
       vm_args.add ("-Djava.class.path=" + initial_class_path ());
       vm_args.add ("-Xrs");
       vm_args.add ("-Djava.system.class.loader=org.octave.OctClassLoader");
-      vm_args.read_java_opts (initial_java_dir () + file_ops::dir_sep_str () +
+      vm_args.read_java_opts (initial_java_dir () + octave::sys::file_ops::dir_sep_str () +
                               "java.opts");
 
 #if ! defined (__APPLE__) && ! defined (__MACH__)
--- a/libinterp/octave.cc	Wed May 18 14:58:29 2016 -0400
+++ b/libinterp/octave.cc	Thu May 19 00:33:18 2016 -0400
@@ -203,7 +203,7 @@
 static void
 execute_pkg_add (const std::string& dir)
 {
-  std::string file_name = file_ops::concat (dir, "PKG_ADD");
+  std::string file_name = octave::sys::file_ops::concat (dir, "PKG_ADD");
 
   try
     {
@@ -490,7 +490,7 @@
 
   octave_program_invocation_name = fname;
 
-  size_t pos = fname.find_last_of (file_ops::dir_sep_chars ());
+  size_t pos = fname.find_last_of (octave::sys::file_ops::dir_sep_chars ());
 
   octave_program_name
     = (pos != std::string::npos) ? fname.substr (pos+1) : fname;
--- a/libinterp/parse-tree/oct-parse.in.yy	Wed May 18 14:58:29 2016 -0400
+++ b/libinterp/parse-tree/oct-parse.in.yy	Thu May 19 00:33:18 2016 -0400
@@ -3158,7 +3158,7 @@
 
     std::string nm = lexer.fcn_file_name;
 
-    size_t pos = nm.find_last_of (file_ops::dir_sep_chars ());
+    size_t pos = nm.find_last_of (octave::sys::file_ops::dir_sep_chars ());
 
     if (pos != std::string::npos)
       nm = lexer.fcn_file_name.substr (pos+1);
@@ -3374,7 +3374,7 @@
 
   std::string nm = lexer.fcn_file_name;
 
-  size_t pos = nm.find_last_of (file_ops::dir_sep_chars ());
+  size_t pos = nm.find_last_of (octave::sys::file_ops::dir_sep_chars ());
 
   if (pos != std::string::npos)
     nm = lexer.fcn_file_name.substr (pos+1);
@@ -4250,7 +4250,7 @@
       file = octave::sys::env::base_pathname (file);
       file = file.substr (0, file.find_last_of ('.'));
 
-      size_t pos = file.find_last_of (file_ops::dir_sep_str ());
+      size_t pos = file.find_last_of (octave::sys::file_ops::dir_sep_str ());
       if (pos != std::string::npos)
         file = file.substr (pos+1);
     }
@@ -4349,7 +4349,7 @@
       nm = octave::sys::env::base_pathname (file);
       nm = nm.substr (0, nm.find_last_of ('.'));
 
-      size_t pos = nm.find_last_of (file_ops::dir_sep_str ());
+      size_t pos = nm.find_last_of (octave::sys::file_ops::dir_sep_str ());
       if (pos != std::string::npos)
         nm = nm.substr (pos+1);
     }
@@ -4494,7 +4494,7 @@
               if (! fname.empty ())
                 {
                   fname = octave::sys::env::make_absolute (fname);
-                  fname = fname.substr (0, fname.find_last_of (file_ops::dir_sep_str ()) + 1);
+                  fname = fname.substr (0, fname.find_last_of (octave::sys::file_ops::dir_sep_str ()) + 1);
 
                   file_stat fs (fname + nm);
 
@@ -4566,7 +4566,7 @@
 
   static std::map<std::string, int> source_call_depth;
 
-  std::string file_full_name = file_ops::tilde_expand (file_name);
+  std::string file_full_name = octave::sys::file_ops::tilde_expand (file_name);
 
   file_full_name = octave::sys::env::make_absolute (file_full_name);
 
@@ -4599,7 +4599,7 @@
   bool delete_fcn = false;
 
   // Find symbol name that would be in symbol_table, if it were loaded.
-  size_t dir_end = file_name.find_last_of (file_ops::dir_sep_chars ());
+  size_t dir_end = file_name.find_last_of (octave::sys::file_ops::dir_sep_chars ());
   dir_end = (dir_end == std::string::npos) ? 0 : dir_end + 1;
 
   size_t extension = file_name.find_last_of ('.');
@@ -4607,7 +4607,7 @@
     extension = file_name.length ();
 
   std::string symbol = file_name.substr (dir_end, extension - dir_end);
-  std::string full_name = octave_canonicalize_file_name (file_name);
+  std::string full_name = octave::sys::canonicalize_file_name (file_name);
 
   // Check if this file is already loaded (or in the path)
   octave_value loaded_sym = symbol_table::find (symbol);
@@ -4616,7 +4616,7 @@
       fcn = loaded_sym.function_value ();
       if (fcn)
         {
-          if (octave_canonicalize_file_name (fcn->fcn_file_name ())
+          if (octave::sys::canonicalize_file_name (fcn->fcn_file_name ())
               == full_name)
             delete_fcn = true;
           else
@@ -4714,7 +4714,7 @@
     retval = fname;
   else
     {
-      size_t dpos = fname.rfind (file_ops::dir_sep_char ());
+      size_t dpos = fname.rfind (octave::sys::file_ops::dir_sep_char ());
       size_t epos = fname.rfind ('.');
 
       if (epos <= dpos)
@@ -5495,7 +5495,7 @@
       file = octave::sys::env::base_pathname (file);
       file = file.substr (0, file.find_last_of ('.'));
 
-      size_t pos = file.find_last_of (file_ops::dir_sep_str ());
+      size_t pos = file.find_last_of (octave::sys::file_ops::dir_sep_str ());
       if (pos != std::string::npos)
         file = file.substr (pos+1);
     }
--- a/liboctave/system/dir-ops.cc	Wed May 18 14:58:29 2016 -0400
+++ b/liboctave/system/dir-ops.cc	Thu May 19 00:33:18 2016 -0400
@@ -51,7 +51,7 @@
     {
       close ();
 
-      std::string fullname = file_ops::tilde_expand (name);
+      std::string fullname = octave::sys::file_ops::tilde_expand (name);
 
       dir = static_cast<void *> (gnulib::opendir (fullname.c_str ()));
 
--- a/liboctave/system/file-ops.cc	Wed May 18 14:58:29 2016 -0400
+++ b/liboctave/system/file-ops.cc	Thu May 19 00:33:18 2016 -0400
@@ -58,694 +58,699 @@
 #  include <algorithm>
 #endif
 
-file_ops *file_ops::instance = 0;
-
-bool
-file_ops::instance_ok (void)
+namespace
+octave
 {
-  bool retval = true;
+  namespace
+  sys
+  {
+    file_ops *octave::sys::file_ops::instance = 0;
 
-  if (! instance)
+    bool
+    octave::sys::file_ops::instance_ok (void)
     {
+      bool retval = true;
+
+      if (! instance)
+        {
 #if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM))
-      char system_dir_sep_char = '\\';
-      std::string system_dir_sep_str = "\\";
+          char system_dir_sep_char = '\\';
+          std::string system_dir_sep_str = "\\";
 #else
-      char system_dir_sep_char = '/';
-      std::string system_dir_sep_str = "/";
+          char system_dir_sep_char = '/';
+          std::string system_dir_sep_str = "/";
 #endif
 #if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM)
-      std::string system_dir_sep_chars = "/\\";
+          std::string system_dir_sep_chars = "/\\";
 #else
-      std::string system_dir_sep_chars = system_dir_sep_str;
+          std::string system_dir_sep_chars = system_dir_sep_str;
 #endif
 
-      instance = new file_ops (system_dir_sep_char, system_dir_sep_str,
-                               system_dir_sep_chars);
+          instance = new file_ops (system_dir_sep_char, system_dir_sep_str,
+                                   system_dir_sep_chars);
 
-      if (instance)
-        singleton_cleanup_list::add (cleanup_instance);
+          if (instance)
+            singleton_cleanup_list::add (cleanup_instance);
+        }
+
+      if (! instance)
+        (*current_liboctave_error_handler)
+          ("unable to create file_ops object!");
+
+      return retval;
     }
 
-  if (! instance)
-    (*current_liboctave_error_handler)
-      ("unable to create file_ops object!");
-
-  return retval;
-}
+    // The following tilde-expansion code was stolen and adapted from
+    // readline.
 
-// The following tilde-expansion code was stolen and adapted from
-// readline.
+    // The default value of tilde_additional_prefixes.  This is set to
+    // whitespace preceding a tilde so that simple programs which do not
+    // perform any word separation get desired behavior.
+    static const char *default_prefixes[] = { " ~", "\t~", ":~", 0 };
 
-// The default value of tilde_additional_prefixes.  This is set to
-// whitespace preceding a tilde so that simple programs which do not
-// perform any word separation get desired behavior.
-static const char *default_prefixes[] = { " ~", "\t~", ":~", 0 };
+    // The default value of tilde_additional_suffixes.  This is set to
+    // whitespace or newline so that simple programs which do not perform
+    // any word separation get desired behavior.
+    static const char *default_suffixes[] = { " ", "\n", ":", 0 };
 
-// The default value of tilde_additional_suffixes.  This is set to
-// whitespace or newline so that simple programs which do not perform
-// any word separation get desired behavior.
-static const char *default_suffixes[] = { " ", "\n", ":", 0 };
+    // If non-null, this contains the address of a function that the
+    // application wants called before trying the standard tilde
+    // expansions.  The function is called with the text sans tilde, and
+    // returns a malloc()'ed string which is the expansion, or a NULL
+    // pointer if the expansion fails.
+    octave::sys::file_ops::tilde_expansion_hook octave::sys::file_ops::tilde_expansion_preexpansion_hook = 0;
 
-// If non-null, this contains the address of a function that the
-// application wants called before trying the standard tilde
-// expansions.  The function is called with the text sans tilde, and
-// returns a malloc()'ed string which is the expansion, or a NULL
-// pointer if the expansion fails.
-file_ops::tilde_expansion_hook file_ops::tilde_expansion_preexpansion_hook = 0;
+    // If non-null, this contains the address of a function to call if the
+    // standard meaning for expanding a tilde fails.  The function is
+    // called with the text (sans tilde, as in "foo"), and returns a
+    // malloc()'ed string which is the expansion, or a NULL pointer if
+    // there is no expansion.
+    octave::sys::file_ops::tilde_expansion_hook octave::sys::file_ops::tilde_expansion_failure_hook = 0;
 
-// If non-null, this contains the address of a function to call if the
-// standard meaning for expanding a tilde fails.  The function is
-// called with the text (sans tilde, as in "foo"), and returns a
-// malloc()'ed string which is the expansion, or a NULL pointer if
-// there is no expansion.
-file_ops::tilde_expansion_hook file_ops::tilde_expansion_failure_hook = 0;
+    // When non-null, this is a NULL terminated array of strings which are
+    // duplicates for a tilde prefix.  Bash uses this to expand '=~' and
+    // ':~'.
+    string_vector octave::sys::file_ops::tilde_additional_prefixes = default_prefixes;
 
-// When non-null, this is a NULL terminated array of strings which are
-// duplicates for a tilde prefix.  Bash uses this to expand '=~' and
-// ':~'.
-string_vector file_ops::tilde_additional_prefixes = default_prefixes;
-
-// When non-null, this is a NULL terminated array of strings which
-// match the end of a username, instead of just "/".  Bash sets this
-// to ':' and '=~'.
-string_vector file_ops::tilde_additional_suffixes = default_suffixes;
+    // When non-null, this is a NULL terminated array of strings which
+    // match the end of a username, instead of just "/".  Bash sets this
+    // to ':' and '=~'.
+    string_vector octave::sys::file_ops::tilde_additional_suffixes = default_suffixes;
 
-// Find the start of a tilde expansion in S, and return the index
-// of the tilde which starts the expansion.  Place the length of the
-// text which identified this tilde starter in LEN, excluding the
-// tilde itself.
+    // Find the start of a tilde expansion in S, and return the index
+    // of the tilde which starts the expansion.  Place the length of the
+    // text which identified this tilde starter in LEN, excluding the
+    // tilde itself.
 
-static size_t
-tilde_find_prefix (const std::string& s, size_t& len)
-{
-  len = 0;
+    static size_t
+    tilde_find_prefix (const std::string& s, size_t& len)
+    {
+      len = 0;
+
+      size_t s_len = s.length ();
 
-  size_t s_len = s.length ();
+      if (s_len == 0 || s[0] == '~')
+        return 0;
 
-  if (s_len == 0 || s[0] == '~')
-    return 0;
-
-  string_vector prefixes = file_ops::tilde_additional_prefixes;
+      string_vector prefixes = octave::sys::file_ops::tilde_additional_prefixes;
 
-  if (! prefixes.empty ())
-    {
-      for (size_t i = 0; i < s_len; i++)
+      if (! prefixes.empty ())
         {
-          for (int j = 0; j < prefixes.numel (); j++)
+          for (size_t i = 0; i < s_len; i++)
             {
-              size_t pfx_len = prefixes[j].length ();
+              for (int j = 0; j < prefixes.numel (); j++)
+                {
+                  size_t pfx_len = prefixes[j].length ();
 
-              if (prefixes[j] == s.substr (i, pfx_len))
-                {
-                  len = pfx_len - 1;
-                  return i + len;
+                  if (prefixes[j] == s.substr (i, pfx_len))
+                    {
+                      len = pfx_len - 1;
+                      return i + len;
+                    }
                 }
             }
         }
+
+      return s_len;
     }
 
-  return s_len;
-}
-
-// Find the end of a tilde expansion in S, and return the index
-// of the character which ends the tilde definition.
+    // Find the end of a tilde expansion in S, and return the index
+    // of the character which ends the tilde definition.
 
-static size_t
-tilde_find_suffix (const std::string& s)
-{
-  size_t s_len = s.length ();
+    static size_t
+    tilde_find_suffix (const std::string& s)
+    {
+      size_t s_len = s.length ();
 
-  string_vector suffixes = file_ops::tilde_additional_suffixes;
+      string_vector suffixes = octave::sys::file_ops::tilde_additional_suffixes;
+
+      size_t i = 0;
 
-  size_t i = 0;
-
-  for ( ; i < s_len; i++)
-    {
-      if (file_ops::is_dir_sep (s[i]))
-        break;
+      for ( ; i < s_len; i++)
+        {
+          if (octave::sys::file_ops::is_dir_sep (s[i]))
+            break;
 
-      if (! suffixes.empty ())
-        {
-          for (int j = 0; j < suffixes.numel (); j++)
+          if (! suffixes.empty ())
             {
-              size_t sfx_len = suffixes[j].length ();
+              for (int j = 0; j < suffixes.numel (); j++)
+                {
+                  size_t sfx_len = suffixes[j].length ();
 
-              if (suffixes[j] == s.substr (i, sfx_len))
-                return i;
+                  if (suffixes[j] == s.substr (i, sfx_len))
+                    return i;
+                }
             }
         }
+
+      return i;
     }
 
-  return i;
-}
-
-// Take FNAME and return the tilde prefix we want expanded.
-
-static std::string
-isolate_tilde_prefix (const std::string& fname)
-{
-  size_t f_len = fname.length ();
+    // Take FNAME and return the tilde prefix we want expanded.
 
-  size_t len = 1;
-
-  while (len < f_len && ! file_ops::is_dir_sep (fname[len]))
-    len++;
-
-  return fname.substr (1, len);
-}
-
-// Do the work of tilde expansion on FILENAME.  FILENAME starts with a
-// tilde.
+    static std::string
+    isolate_tilde_prefix (const std::string& fname)
+    {
+      size_t f_len = fname.length ();
 
-static std::string
-tilde_expand_word (const std::string& filename)
-{
-  size_t f_len = filename.length ();
-
-  if (f_len == 0 || filename[0] != '~')
-    return filename;
-
-  // A leading '~/' or a bare '~' is *always* translated to the value
-  // of $HOME or the home directory of the current user, regardless of
-  // any preexpansion hook.
+      size_t len = 1;
 
-  if (f_len == 1 || file_ops::is_dir_sep (filename[1]))
-    return octave::sys::env::get_home_directory () + filename.substr (1);
-
-  std::string username = isolate_tilde_prefix (filename);
-
-  size_t user_len = username.length ();
+      while (len < f_len && ! octave::sys::file_ops::is_dir_sep (fname[len]))
+        len++;
 
-  std::string dirname;
-
-  if (file_ops::tilde_expansion_preexpansion_hook)
-    {
-      std::string expansion
-        = file_ops::tilde_expansion_preexpansion_hook (username);
-
-      if (! expansion.empty ())
-        return expansion + filename.substr (user_len+1);
+      return fname.substr (1, len);
     }
 
-  // No preexpansion hook, or the preexpansion hook failed.  Look in the
-  // password database.
+    // Do the work of tilde expansion on FILENAME.  FILENAME starts with a
+    // tilde.
 
-  octave::sys::password pw = octave::sys::password::getpwnam (username);
+    static std::string
+    tilde_expand_word (const std::string& filename)
+    {
+      size_t f_len = filename.length ();
+
+      if (f_len == 0 || filename[0] != '~')
+        return filename;
 
-  if (! pw)
-    {
-      // If the calling program has a special syntax for expanding tildes,
-      // and we couldn't find a standard expansion, then let them try.
+      // A leading '~/' or a bare '~' is *always* translated to the value
+      // of $HOME or the home directory of the current user, regardless of
+      // any preexpansion hook.
+
+      if (f_len == 1 || octave::sys::file_ops::is_dir_sep (filename[1]))
+        return octave::sys::env::get_home_directory () + filename.substr (1);
 
-      if (file_ops::tilde_expansion_failure_hook)
+      std::string username = isolate_tilde_prefix (filename);
+
+      size_t user_len = username.length ();
+
+      std::string dirname;
+
+      if (octave::sys::file_ops::tilde_expansion_preexpansion_hook)
         {
           std::string expansion
-            = file_ops::tilde_expansion_failure_hook (username);
+            = octave::sys::file_ops::tilde_expansion_preexpansion_hook (username);
 
           if (! expansion.empty ())
-            dirname = expansion + filename.substr (user_len+1);
+            return expansion + filename.substr (user_len+1);
         }
 
-      // If we don't have a failure hook, or if the failure hook did not
-      // expand the tilde, return a copy of what we were passed.
+      // No preexpansion hook, or the preexpansion hook failed.  Look in the
+      // password database.
 
-      if (dirname.length () == 0)
-        dirname = filename;
-    }
-  else
-    dirname = pw.dir () + filename.substr (user_len+1);
-
-  return dirname;
-}
+      octave::sys::password pw = octave::sys::password::getpwnam (username);
 
-// If NAME has a leading ~ or ~user, Unix-style, expand it to the
-// user's home directory.  If no ~, or no <pwd.h>, just return NAME.
+      if (! pw)
+        {
+          // If the calling program has a special syntax for expanding tildes,
+          // and we couldn't find a standard expansion, then let them try.
 
-std::string
-file_ops::tilde_expand (const std::string& name)
-{
-  if (name.find ('~') == std::string::npos)
-    return name;
-  else
-    {
-      std::string result;
+          if (octave::sys::file_ops::tilde_expansion_failure_hook)
+            {
+              std::string expansion
+                = octave::sys::file_ops::tilde_expansion_failure_hook (username);
 
-      size_t name_len = name.length ();
-
-      // Scan through S expanding tildes as we come to them.
+              if (! expansion.empty ())
+                dirname = expansion + filename.substr (user_len+1);
+            }
 
-      size_t pos = 0;
+          // If we don't have a failure hook, or if the failure hook did not
+          // expand the tilde, return a copy of what we were passed.
 
-      while (1)
-        {
-          if (pos > name_len)
-            break;
+          if (dirname.length () == 0)
+            dirname = filename;
+        }
+      else
+        dirname = pw.dir () + filename.substr (user_len+1);
 
-          size_t len;
-
-          // Make START point to the tilde which starts the expansion.
-
-          size_t start = tilde_find_prefix (name.substr (pos), len);
+      return dirname;
+    }
 
-          result.append (name.substr (pos, start));
-
-          // Advance STRING to the starting tilde.
-
-          pos += start;
+    // If NAME has a leading ~ or ~user, Unix-style, expand it to the
+    // user's home directory.  If no ~, or no <pwd.h>, just return NAME.
 
-          // Make FINI be the index of one after the last character of the
-          // username.
-
-          size_t fini = tilde_find_suffix (name.substr (pos));
-
-          // If both START and FINI are zero, we are all done.
-
-          if (! (start || fini))
-            break;
+    std::string
+    octave::sys::file_ops::tilde_expand (const std::string& name)
+    {
+      if (name.find ('~') == std::string::npos)
+        return name;
+      else
+        {
+          std::string result;
 
-          // Expand the entire tilde word, and copy it into RESULT.
+          size_t name_len = name.length ();
 
-          std::string tilde_word = name.substr (pos, fini);
+          // Scan through S expanding tildes as we come to them.
 
-          pos += fini;
+          size_t pos = 0;
 
-          std::string expansion = tilde_expand_word (tilde_word);
-
-          result.append (expansion);
-        }
+          while (1)
+            {
+              if (pos > name_len)
+                break;
 
-      return result;
-    }
-}
+              size_t len;
 
-// A vector version of the above.
+              // Make START point to the tilde which starts the expansion.
+
+              size_t start = tilde_find_prefix (name.substr (pos), len);
 
-string_vector
-file_ops::tilde_expand (const string_vector& names)
-{
-  string_vector retval;
+              result.append (name.substr (pos, start));
 
-  int n = names.numel ();
+              // Advance STRING to the starting tilde.
 
-  retval.resize (n);
-
-  for (int i = 0; i < n; i++)
-    retval[i] = tilde_expand (names[i]);
+              pos += start;
 
-  return retval;
-}
+              // Make FINI be the index of one after the last character of the
+              // username.
+
+              size_t fini = tilde_find_suffix (name.substr (pos));
 
-std::string
-file_ops::concat (const std::string& dir, const std::string& file)
-{
-  return dir.empty ()
-         ? file
-         : (is_dir_sep (dir[dir.length ()-1])
-            ? dir + file
-            : dir + dir_sep_char () + file);
-}
+              // If both START and FINI are zero, we are all done.
+
+              if (! (start || fini))
+                break;
 
-std::string
-file_ops::native_separator_path (const std::string& path)
-{
-  std::string retval;
+              // Expand the entire tilde word, and copy it into RESULT.
+
+              std::string tilde_word = name.substr (pos, fini);
+
+              pos += fini;
 
-  if (dir_sep_char () == '/')
-    retval = path;
-  else
-    {
-      size_t n = path.length ();
-      for (size_t i = 0; i < n; i++)
-        {
-          if (path[i] == '/')
-            retval += dir_sep_char();
-          else
-            retval += path[i];
+              std::string expansion = tilde_expand_word (tilde_word);
+
+              result.append (expansion);
+            }
+
+          return result;
         }
     }
 
-  return retval;
-}
+    // A vector version of the above.
 
-int
-octave_mkdir (const std::string& nm, mode_t md)
-{
-  std::string msg;
-  return octave_mkdir (nm, md, msg);
-}
+    string_vector
+    octave::sys::file_ops::tilde_expand (const string_vector& names)
+    {
+      string_vector retval;
+
+      int n = names.numel ();
+
+      retval.resize (n);
 
-int
-octave_mkdir (const std::string& name, mode_t mode, std::string& msg)
-{
-  msg = "";
+      for (int i = 0; i < n; i++)
+        retval[i] = tilde_expand (names[i]);
 
-  int status = -1;
+      return retval;
+    }
 
-  status = gnulib::mkdir (name.c_str (), mode);
-
-  if (status < 0)
-    msg = gnulib::strerror (errno);
-
-  return status;
-}
+    std::string
+    octave::sys::file_ops::concat (const std::string& dir, const std::string& file)
+    {
+      return dir.empty ()
+        ? file
+        : (is_dir_sep (dir[dir.length ()-1])
+           ? dir + file
+           : dir + dir_sep_char () + file);
+    }
 
-int
-octave_mkfifo (const std::string& nm, mode_t md)
-{
-  std::string msg;
-  return octave_mkfifo (nm, md, msg);
-}
-
-int
-octave_mkfifo (const std::string& name, mode_t mode, std::string& msg)
-{
-  msg = "";
-
-  int status = -1;
+    std::string
+    octave::sys::file_ops::native_separator_path (const std::string& path)
+    {
+      std::string retval;
 
-  // With gnulib we will always have mkfifo, but some systems like MinGW
-  // don't have working mkfifo functions.  On those systems, mkfifo will
-  // always return -1 and set errno.
-
-  status = gnulib::mkfifo (name.c_str (), mode);
-
-  if (status < 0)
-    msg = gnulib::strerror (errno);
+      if (dir_sep_char () == '/')
+        retval = path;
+      else
+        {
+          size_t n = path.length ();
+          for (size_t i = 0; i < n; i++)
+            {
+              if (path[i] == '/')
+                retval += dir_sep_char();
+              else
+                retval += path[i];
+            }
+        }
 
-  return status;
-}
+      return retval;
+    }
 
-int
-octave_link (const std::string& old_name, const std::string& new_name)
-{
-  std::string msg;
-  return octave_link (old_name, new_name, msg);
-}
+    int
+    mkdir (const std::string& nm, mode_t md)
+    {
+      std::string msg;
+      return octave::sys::mkdir (nm, md, msg);
+    }
+
+    int
+    mkdir (const std::string& name, mode_t mode, std::string& msg)
+    {
+      msg = "";
+
+      int status = -1;
 
-int
-octave_link (const std::string& old_name,
-             const std::string& new_name, std::string& msg)
-{
-  msg = "";
+      status = gnulib::mkdir (name.c_str (), mode);
 
-  int status = -1;
+      if (status < 0)
+        msg = gnulib::strerror (errno);
 
-  status = gnulib::link (old_name.c_str (), new_name.c_str ());
+      return status;
+    }
 
-  if (status < 0)
-    msg = gnulib::strerror (errno);
-
-  return status;
-}
+    int
+    mkfifo (const std::string& nm, mode_t md)
+    {
+      std::string msg;
+      return mkfifo (nm, md, msg);
+    }
 
-int
-octave_symlink (const std::string& old_name, const std::string& new_name)
-{
-  std::string msg;
-  return octave_symlink (old_name, new_name, msg);
-}
+    int
+    mkfifo (const std::string& name, mode_t mode, std::string& msg)
+    {
+      msg = "";
+
+      int status = -1;
 
-int
-octave_symlink (const std::string& old_name,
-                const std::string& new_name, std::string& msg)
-{
-  msg = "";
+      // With gnulib we will always have mkfifo, but some systems like MinGW
+      // don't have working mkfifo functions.  On those systems, mkfifo will
+      // always return -1 and set errno.
 
-  int status = -1;
+      status = gnulib::mkfifo (name.c_str (), mode);
 
-  status = gnulib::symlink (old_name.c_str (), new_name.c_str ());
+      if (status < 0)
+        msg = gnulib::strerror (errno);
 
-  if (status < 0)
-    msg = gnulib::strerror (errno);
-
-  return status;
-}
+      return status;
+    }
 
-int
-octave_readlink (const std::string& path, std::string& result)
-{
-  std::string msg;
-  return octave_readlink (path, result, msg);
-}
+    int
+    link (const std::string& old_name, const std::string& new_name)
+    {
+      std::string msg;
+      return link (old_name, new_name, msg);
+    }
+
+    int
+    link (const std::string& old_name, const std::string& new_name,
+          std::string& msg)
+    {
+      msg = "";
 
-int
-octave_readlink (const std::string& path, std::string& result,
-                 std::string& msg)
-{
-  int status = -1;
+      int status = -1;
 
-  msg = "";
+      status = gnulib::link (old_name.c_str (), new_name.c_str ());
 
-  char buf[MAXPATHLEN+1];
+      if (status < 0)
+        msg = gnulib::strerror (errno);
 
-  status = gnulib::readlink (path.c_str (), buf, MAXPATHLEN);
+      return status;
+    }
 
-  if (status < 0)
-    msg = gnulib::strerror (errno);
-  else
+    int
+    symlink (const std::string& old_name, const std::string& new_name)
     {
-      buf[status] = '\0';
-      result = std::string (buf);
-      status = 0;
+      std::string msg;
+      return symlink (old_name, new_name, msg);
     }
 
-  return status;
-}
+    int
+    symlink (const std::string& old_name,
+                    const std::string& new_name, std::string& msg)
+    {
+      msg = "";
+
+      int status = -1;
 
-int
-octave_rename (const std::string& from, const std::string& to)
-{
-  std::string msg;
-  return octave_rename (from, to, msg);
-}
+      status = gnulib::symlink (old_name.c_str (), new_name.c_str ());
+
+      if (status < 0)
+        msg = gnulib::strerror (errno);
+
+      return status;
+    }
 
-int
-octave_rename (const std::string& from, const std::string& to,
-               std::string& msg)
-{
-  int status = -1;
+    int
+    readlink (const std::string& path, std::string& result)
+    {
+      std::string msg;
+      return readlink (path, result, msg);
+    }
 
-  msg = "";
+    int
+    readlink (const std::string& path, std::string& result, std::string& msg)
+    {
+      int status = -1;
 
-  status = gnulib::rename (from.c_str (), to.c_str ());
+      msg = "";
+
+      char buf[MAXPATHLEN+1];
+
+      status = gnulib::readlink (path.c_str (), buf, MAXPATHLEN);
 
-  if (status < 0)
-    msg = gnulib::strerror (errno);
+      if (status < 0)
+        msg = gnulib::strerror (errno);
+      else
+        {
+          buf[status] = '\0';
+          result = std::string (buf);
+          status = 0;
+        }
 
-  return status;
-}
+      return status;
+    }
 
-int
-octave_rmdir (const std::string& name)
-{
-  std::string msg;
-  return octave_rmdir (name, msg);
-}
+    int
+    rename (const std::string& from, const std::string& to)
+    {
+      std::string msg;
+      return rename (from, to, msg);
+    }
 
-int
-octave_rmdir (const std::string& name, std::string& msg)
-{
-  msg = "";
+    int
+    rename (const std::string& from, const std::string& to, std::string& msg)
+    {
+      int status = -1;
+
+      msg = "";
 
-  int status = -1;
+      status = gnulib::rename (from.c_str (), to.c_str ());
 
-  status = gnulib::rmdir (name.c_str ());
+      if (status < 0)
+        msg = gnulib::strerror (errno);
 
-  if (status < 0)
-    msg = gnulib::strerror (errno);
+      return status;
+    }
 
-  return status;
-}
+    int
+    rmdir (const std::string& name)
+    {
+      std::string msg;
+      return rmdir (name, msg);
+    }
 
-// And a version that works recursively.
+    int
+    rmdir (const std::string& name, std::string& msg)
+    {
+      msg = "";
+
+      int status = -1;
+
+      status = gnulib::rmdir (name.c_str ());
 
-int
-octave_recursive_rmdir (const std::string& name)
-{
-  std::string msg;
-  return octave_recursive_rmdir (name, msg);
-}
+      if (status < 0)
+        msg = gnulib::strerror (errno);
+
+      return status;
+    }
+
+    // And a version that works recursively.
 
-int
-octave_recursive_rmdir (const std::string& name, std::string& msg)
-{
-  msg = "";
+    int
+    recursive_rmdir (const std::string& name)
+    {
+      std::string msg;
+      return recursive_rmdir (name, msg);
+    }
 
-  int status = 0;
-
-  dir_entry dir (name);
-
-  if (dir)
+    int
+    recursive_rmdir (const std::string& name, std::string& msg)
     {
-      string_vector dirlist = dir.read ();
+      msg = "";
+
+      int status = 0;
 
-      for (octave_idx_type i = 0; i < dirlist.numel (); i++)
+      dir_entry dir (name);
+
+      if (dir)
         {
-          octave_quit ();
+          string_vector dirlist = dir.read ();
 
-          std::string nm = dirlist[i];
+          for (octave_idx_type i = 0; i < dirlist.numel (); i++)
+            {
+              octave_quit ();
 
-          // Skip current directory and parent.
-          if (nm == "." || nm == "..")
-            continue;
+              std::string nm = dirlist[i];
+
+              // Skip current directory and parent.
+              if (nm == "." || nm == "..")
+                continue;
 
-          std::string fullnm = name + file_ops::dir_sep_str () + nm;
+              std::string fullnm = name + octave::sys::file_ops::dir_sep_str () + nm;
+
+              // Get info about the file.  Don't follow links.
+              file_stat fs (fullnm, false);
 
-          // Get info about the file.  Don't follow links.
-          file_stat fs (fullnm, false);
+              if (fs)
+                {
+                  if (fs.is_dir ())
+                    {
+                      status = recursive_rmdir (fullnm, msg);
 
-          if (fs)
-            {
-              if (fs.is_dir ())
-                {
-                  status = octave_recursive_rmdir (fullnm, msg);
+                      if (status < 0)
+                        break;
+                    }
+                  else
+                    {
+                      status = unlink (fullnm, msg);
 
-                  if (status < 0)
-                    break;
+                      if (status < 0)
+                        break;
+                    }
                 }
               else
                 {
-                  status = octave_unlink (fullnm, msg);
-
-                  if (status < 0)
-                    break;
+                  msg = fs.error ();
+                  break;
                 }
             }
-          else
+
+          if (status >= 0)
             {
-              msg = fs.error ();
-              break;
+              dir.close ();
+              status = rmdir (name, msg);
             }
         }
-
-      if (status >= 0)
+      else
         {
-          dir.close ();
-          status = octave_rmdir (name, msg);
+          status = -1;
+
+          msg = dir.error ();
         }
+
+      return status;
     }
-  else
+
+    int
+    umask (mode_t mode)
+    {
+#if defined (HAVE_UMASK)
+      return umask (mode);
+#else
+      return 0;
+#endif
+    }
+
+    int
+    unlink (const std::string& name)
     {
-      status = -1;
+      std::string msg;
+      return unlink (name, msg);
+    }
+
+    int
+    unlink (const std::string& name, std::string& msg)
+    {
+      msg = "";
+
+      int status = -1;
 
-      msg = dir.error ();
+      status = gnulib::unlink (name.c_str ());
+
+      if (status < 0)
+        msg = gnulib::strerror (errno);
+
+      return status;
+    }
+
+    std::string
+    tempnam (const std::string& dir, const std::string& pfx)
+    {
+      std::string msg;
+      return tempnam (dir, pfx, msg);
     }
 
-  return status;
-}
+    std::string
+    tempnam (const std::string& dir, const std::string& pfx,
+                    std::string& msg)
+    {
+      msg = "";
 
-int
-octave_umask (mode_t mode)
-{
-#if defined (HAVE_UMASK)
-  return umask (mode);
-#else
-  return 0;
-#endif
-}
-
-int
-octave_unlink (const std::string& name)
-{
-  std::string msg;
-  return octave_unlink (name, msg);
-}
-
-int
-octave_unlink (const std::string& name, std::string& msg)
-{
-  msg = "";
+      std::string retval;
 
-  int status = -1;
-
-  status = gnulib::unlink (name.c_str ());
-
-  if (status < 0)
-    msg = gnulib::strerror (errno);
-
-  return status;
-}
-
-std::string
-octave_tempnam (const std::string& dir, const std::string& pfx)
-{
-  std::string msg;
-  return octave_tempnam (dir, pfx, msg);
-}
-
-std::string
-octave_tempnam (const std::string& dir, const std::string& pfx,
-                std::string& msg)
-{
-  msg = "";
-
-  std::string retval;
+      // get dir path to use for template
+      std::string templatename;
+      if (dir.empty ())
+        templatename = octave::sys::env::get_temp_directory ();
+      else if (! file_stat (dir, false).is_dir ())
+        templatename = octave::sys::env::get_temp_directory ();
+      else
+        templatename = dir;
 
-  // get dir path to use for template
-  std::string templatename;
-  if (dir.empty ())
-    templatename = octave::sys::env::get_temp_directory ();
-  else if (! file_stat (dir, false).is_dir ())
-    templatename = octave::sys::env::get_temp_directory ();
-  else
-    templatename = dir;
-
-  // add dir sep char if it is not there
-  if (*templatename.rbegin () != file_ops::dir_sep_char ())
-    templatename += file_ops::dir_sep_char ();
+      // add dir sep char if it is not there
+      if (*templatename.rbegin () != octave::sys::file_ops::dir_sep_char ())
+        templatename += octave::sys::file_ops::dir_sep_char ();
 
-  if (pfx.empty ())
-    templatename += "file";
-  else
-    templatename += pfx;
+      if (pfx.empty ())
+        templatename += "file";
+      else
+        templatename += pfx;
 
-  // add the required XXXXXX for the template
-  templatename += "XXXXXX";
-
-  // create and copy template to char array for call to gen_tempname
-  char tname [templatename.length () + 1];
-
-  strcpy (tname, templatename.c_str ());
+      // add the required XXXXXX for the template
+      templatename += "XXXXXX";
 
-  if (gen_tempname (tname, 0, 0, GT_NOCREATE) == -1)
-    msg = gnulib::strerror (errno);
-  else
-    retval = tname;
+      // create and copy template to char array for call to gen_tempname
+      char tname [templatename.length () + 1];
 
-  return retval;
-}
+      strcpy (tname, templatename.c_str ());
 
-std::string
-octave_canonicalize_file_name (const std::string& name)
-{
-  std::string msg;
-  return octave_canonicalize_file_name (name, msg);
-}
+      if (gen_tempname (tname, 0, 0, GT_NOCREATE) == -1)
+        msg = gnulib::strerror (errno);
+      else
+        retval = tname;
 
-std::string
-octave_canonicalize_file_name (const std::string& name, std::string& msg)
-{
-  msg = "";
-
-  std::string retval;
-
-  char *tmp = gnulib::canonicalize_file_name (name.c_str ());
-
-  if (tmp)
-    {
-      retval = tmp;
-      free (tmp);
+      return retval;
     }
 
+    std::string
+    canonicalize_file_name (const std::string& name)
+    {
+      std::string msg;
+      return canonicalize_file_name (name, msg);
+    }
+
+    std::string
+    canonicalize_file_name (const std::string& name, std::string& msg)
+    {
+      msg = "";
+
+      std::string retval;
+
+      char *tmp = gnulib::canonicalize_file_name (name.c_str ());
+
+      if (tmp)
+        {
+          retval = tmp;
+          free (tmp);
+        }
+
 #if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM))
-  // Canonical Windows file separator is backslash.
-  std::replace (retval.begin (), retval.end (), '/', '\\');
+      // Canonical Windows file separator is backslash.
+      std::replace (retval.begin (), retval.end (), '/', '\\');
 #endif
 
-  if (retval.empty ())
-    msg = gnulib::strerror (errno);
+      if (retval.empty ())
+        msg = gnulib::strerror (errno);
 
-  return retval;
+      return retval;
+    }
+  }
 }
-
--- a/liboctave/system/file-ops.h	Wed May 18 14:58:29 2016 -0400
+++ b/liboctave/system/file-ops.h	Thu May 19 00:33:18 2016 -0400
@@ -31,165 +31,344 @@
 
 #include "str-vec.h"
 
-struct
-OCTAVE_API
-file_ops
+namespace
+octave
 {
-public:
-
-  // Use a singleton class for dir_sep data members instead of just
-  // making them static members of the dir_path class so that we can
-  // ensure proper initialization.
-
-  file_ops (char dir_sep_char_arg = 0,
-            const std::string& dir_sep_str_arg = std::string ("/"),
-            const std::string& dir_sep_chars_arg = std::string ("/"))
-    : xdir_sep_char (dir_sep_char_arg), xdir_sep_str (dir_sep_str_arg),
-      xdir_sep_chars (dir_sep_chars_arg) { }
-
-  typedef std::string (*tilde_expansion_hook) (const std::string&);
-
-  static tilde_expansion_hook tilde_expansion_preexpansion_hook;
-
-  static tilde_expansion_hook tilde_expansion_failure_hook;
-
-  static string_vector tilde_additional_prefixes;
-
-  static string_vector tilde_additional_suffixes;
-
-  static char dir_sep_char (void)
-  {
-    return instance_ok () ? instance->xdir_sep_char : 0;
-  }
-
-  static std::string dir_sep_str (void)
-  {
-    return instance_ok () ? instance->xdir_sep_str : "";
-  }
-
-  static std::string dir_sep_chars (void)
+  namespace
+  sys
   {
-    return instance_ok () ? instance->xdir_sep_chars : "";
-  }
+    struct
+    OCTAVE_API
+    file_ops
+    {
+    public:
+
+      // Use a singleton class for dir_sep data members instead of just
+      // making them static members of the dir_path class so that we can
+      // ensure proper initialization.
+
+      file_ops (char dir_sep_char_arg = 0,
+                const std::string& dir_sep_str_arg = std::string ("/"),
+                const std::string& dir_sep_chars_arg = std::string ("/"))
+        : m_dir_sep_char (dir_sep_char_arg), m_dir_sep_str (dir_sep_str_arg),
+          m_dir_sep_chars (dir_sep_chars_arg) { }
+
+      typedef std::string (*tilde_expansion_hook) (const std::string&);
 
-  static bool is_dir_sep (char c)
-  {
-    std::string tmp = dir_sep_chars ();
-    return tmp.find (c) != std::string::npos;
-  }
+      static tilde_expansion_hook tilde_expansion_preexpansion_hook;
+
+      static tilde_expansion_hook tilde_expansion_failure_hook;
+
+      static string_vector tilde_additional_prefixes;
+
+      static string_vector tilde_additional_suffixes;
+
+      static char dir_sep_char (void)
+      {
+        return instance_ok () ? instance->m_dir_sep_char : 0;
+      }
+
+      static std::string dir_sep_str (void)
+      {
+        return instance_ok () ? instance->m_dir_sep_str : "";
+      }
 
-  static std::string tilde_expand (const std::string&);
+      static std::string dir_sep_chars (void)
+      {
+        return instance_ok () ? instance->m_dir_sep_chars : "";
+      }
+
+      static bool is_dir_sep (char c)
+      {
+        std::string tmp = dir_sep_chars ();
+        return tmp.find (c) != std::string::npos;
+      }
 
-  static string_vector tilde_expand (const string_vector&);
+      static std::string tilde_expand (const std::string&);
+
+      static string_vector tilde_expand (const string_vector&);
+
+      static std::string concat (const std::string&, const std::string&);
+
+      // Return the tail member of a filename.
+      static std::string tail (const std::string& path)
+      {
+        size_t ipos = path.find_last_of (dir_sep_chars ());
 
-  static std::string concat (const std::string&, const std::string&);
+        if (ipos != std::string::npos)
+          ipos++;
+        else
+          ipos = 0;
+
+        return path.substr (ipos);
+      }
+
+      // convert path from UNIX type separators to whatever is the system separators
+      static std::string native_separator_path (const std::string& path);
 
-  // Return the tail member of a filename.
-  static std::string tail (const std::string& path)
-  {
-    size_t ipos = path.find_last_of (dir_sep_chars ());
+    private:
+
+      static file_ops *instance;
+
+      static void cleanup_instance (void) { delete instance; instance = 0; }
+
+      // No copying!
+
+      file_ops (const file_ops&);
+
+      file_ops& operator = (const file_ops&);
 
-    if (ipos != std::string::npos)
-      ipos++;
-    else
-      ipos = 0;
+      static bool instance_ok (void);
+
+      char m_dir_sep_char;
+      std::string m_dir_sep_str;
+      std::string m_dir_sep_chars;
+    };
+
+    // We don't have these in the file_ops class with their simple names
+    // (i.e., mkdir instead of octave_mdir) because function names in
+    // standard headers may be #defined.
+
+    extern OCTAVE_API int
+    mkdir (const std::string&, mode_t);
+
+    extern OCTAVE_API int
+    mkdir (const std::string&, mode_t, std::string&);
+
+    extern OCTAVE_API int
+    mkfifo (const std::string&, mode_t);
 
-    return path.substr (ipos);
-  }
+    extern OCTAVE_API int
+    mkfifo (const std::string&, mode_t, std::string&);
+
+    extern OCTAVE_API int
+    link (const std::string&, const std::string&);
+
+    extern OCTAVE_API int
+    link (const std::string&, const std::string&, std::string&);
+
+    extern OCTAVE_API int
+    symlink (const std::string&, const std::string&);
+
+    extern OCTAVE_API int
+    symlink (const std::string&, const std::string&, std::string&);
+
+    extern OCTAVE_API int
+    readlink (const std::string&, std::string&);
+
+    extern OCTAVE_API int
+    readlink (const std::string&, std::string&, std::string&);
 
-  // convert path from UNIX type separators to whatever is the system separators
-  static std::string native_separator_path (const std::string& path);
+    extern OCTAVE_API int
+    rename (const std::string&, const std::string&);
+
+    extern OCTAVE_API int
+    rename (const std::string&, const std::string&, std::string&);
+
+    extern OCTAVE_API int
+    rmdir (const std::string&);
 
-private:
+    extern OCTAVE_API int
+    rmdir (const std::string&, std::string&);
+
+    extern OCTAVE_API int
+    recursive_rmdir (const std::string&);
+
+    extern OCTAVE_API int
+    recursive_rmdir (const std::string&, std::string&);
 
-  static file_ops *instance;
+    extern OCTAVE_API int
+    umask (mode_t);
 
-  static void cleanup_instance (void) { delete instance; instance = 0; }
+    extern OCTAVE_API int
+    unlink (const std::string&);
+
+    extern OCTAVE_API int
+    unlink (const std::string&, std::string&);
 
-  // No copying!
+    extern OCTAVE_API std::string
+    tempnam (const std::string&, const std::string&);
+
+    extern OCTAVE_API std::string
+    tempnam (const std::string&, const std::string&, std::string&);
 
-  file_ops (const file_ops&);
+    extern OCTAVE_API std::string
+    canonicalize_file_name (const std::string&);
+
+    extern OCTAVE_API std::string
+    canonicalize_file_name (const std::string&, std::string&);
+  }
+}
 
-  file_ops& operator = (const file_ops&);
+#if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS)
 
-  static bool instance_ok (void);
+OCTAVE_DEPRECATED ("use octave::sys::file_ops instead")
+  typedef octave::sys::file_ops file_ops;
 
-  char xdir_sep_char;
-  std::string xdir_sep_str;
-  std::string xdir_sep_chars;
-};
+OCTAVE_DEPRECATED ("use octave::sys::mkdir instead")
+inline int
+octave_mkdir (const std::string& nm, mode_t md)
+{
+  return octave::sys::mkdir (nm, md);
+}
+
+OCTAVE_DEPRECATED ("use octave::sys::mkdir instead")
+inline int
+octave_mkdir (const std::string& nm, mode_t md, std::string& msg)
+{
+  return octave::sys::mkdir (nm, md, msg);
+}
 
-// We don't have these in the file_ops class with their simple names
-// (i.e., mkdir instead of octave_mdir) because function names in
-// standard headers may be #defined.
+OCTAVE_DEPRECATED ("use octave::sys::mkfifo instead")
+inline int
+octave_mkfifo (const std::string& nm, mode_t md)
+{
+  return octave::sys::mkfifo (nm, md);
+}
 
-extern OCTAVE_API int
-octave_mkdir (const std::string& nm, mode_t md);
+OCTAVE_DEPRECATED ("use octave::sys::mkfifo instead")
+inline int
+octave_mkfifo (const std::string& nm, mode_t md, std::string& msg)
+{
+  return octave::sys::mkfifo (nm, md, msg);
+}
 
-extern OCTAVE_API int
-octave_mkdir (const std::string& nm, mode_t md, std::string& msg);
+OCTAVE_DEPRECATED ("use octave::sys::link instead")
+inline int
+octave_link (const std::string& old_name, const std::string& new_name)
+{
+  return octave::sys::link (old_name, new_name);
+}
 
-extern OCTAVE_API int
-octave_mkfifo (const std::string& nm, mode_t md);
+OCTAVE_DEPRECATED ("use octave::sys::link instead")
+inline int
+octave_link (const std::string& old_name, const std::string& new_name,
+             std::string& msg)
+{
+  return octave::sys::link (old_name, new_name, msg);
+}
 
-extern OCTAVE_API int
-octave_mkfifo (const std::string& nm, mode_t md, std::string& msg);
-
-extern OCTAVE_API int
-octave_link (const std::string&, const std::string&);
+OCTAVE_DEPRECATED ("use octave::sys::symlink instead")
+inline int
+octave_symlink (const std::string& old_name, const std::string& new_name)
+{
+  return octave::sys::symlink (old_name, new_name);
+}
 
-extern OCTAVE_API int
-octave_link (const std::string&, const std::string&, std::string&);
-
-extern OCTAVE_API int
-octave_symlink (const std::string&, const std::string&);
+OCTAVE_DEPRECATED ("use octave::sys::symlink instead")
+inline int
+octave_symlink (const std::string& old_name, const std::string& new_name,
+                std::string& msg)
+{
+  return octave::sys::symlink (old_name, new_name, msg);
+}
 
-extern OCTAVE_API int
-octave_symlink (const std::string&, const std::string&, std::string&);
+OCTAVE_DEPRECATED ("use octave::sys::readlink instead")
+inline int
+octave_readlink (const std::string& path, std::string& result)
+{
+  return octave::sys::readlink (path, result);
+}
 
-extern OCTAVE_API int
-octave_readlink (const std::string&, std::string&);
+OCTAVE_DEPRECATED ("use octave::sys::readlink instead")
+inline int
+octave_readlink (const std::string& path, std::string& result, std::string& msg)
+{
+  return octave::sys::readlink (path, result, msg);
+}
+
+OCTAVE_DEPRECATED ("use octave::sys::rename instead")
+inline int
+octave_rename (const std::string& from, const std::string& to)
+{
+  return octave::sys::rename (from, to);
+}
 
-extern OCTAVE_API int
-octave_readlink (const std::string&, std::string&, std::string&);
+OCTAVE_DEPRECATED ("use octave::sys::rename instead")
+inline int
+octave_rename (const std::string& from, const std::string& to, std::string& msg)
+{
+  return octave::sys::rename (from, to, msg);
+}
 
-extern OCTAVE_API int
-octave_rename (const std::string&, const std::string&);
+OCTAVE_DEPRECATED ("use octave::sys::rmdir instead")
+inline int
+octave_rmdir (const std::string& nm)
+{
+  return octave::sys::rmdir (nm);
+}
 
-extern OCTAVE_API int
-octave_rename (const std::string&, const std::string&, std::string&);
+OCTAVE_DEPRECATED ("use octave::sys::rmdir instead")
+inline int
+octave_rmdir (const std::string& nm, std::string& msg)
+{
+  return octave::sys::rmdir (nm, msg);
+}
 
-extern OCTAVE_API int
-octave_rmdir (const std::string&);
-
-extern OCTAVE_API int
-octave_rmdir (const std::string&, std::string&);
+OCTAVE_DEPRECATED ("use octave::sys::recursive_rmdir instead")
+inline int
+octave_recursive_rmdir (const std::string& nm)
+{
+  return octave::sys::recursive_rmdir (nm);
+}
 
-extern OCTAVE_API int
-octave_recursive_rmdir (const std::string&);
+OCTAVE_DEPRECATED ("use octave::sys::recursive_rmdir instead")
+inline int
+octave_recursive_rmdir (const std::string& nm, std::string& msg)
+{
+  return octave::sys::recursive_rmdir (nm, msg);
+}
 
-extern OCTAVE_API int
-octave_recursive_rmdir (const std::string&, std::string&);
+OCTAVE_DEPRECATED ("use octave::sys::umask instead")
+inline int
+octave_umask (mode_t md)
+{
+  return octave::sys::umask (md);
+}
 
-extern OCTAVE_API int
-octave_umask (mode_t);
+OCTAVE_DEPRECATED ("use octave::sys::unlink instead")
+inline int
+octave_unlink (const std::string& nm)
+{
+  return octave::sys::unlink (nm);
+}
 
-extern OCTAVE_API int
-octave_unlink (const std::string&);
+OCTAVE_DEPRECATED ("use octave::sys::unlink instead")
+inline int
+octave_unlink (const std::string& nm, std::string& msg)
+{
+  return octave::sys::unlink (nm, msg);
+}
 
-extern OCTAVE_API int
-octave_unlink (const std::string&, std::string&);
+OCTAVE_DEPRECATED ("use octave::sys::tempnam instead")
+inline std::string
+octave_tempnam (const std::string& dir, const std::string& pfx)
+{
+  return octave::sys::tempnam (dir, pfx);
+}
 
-extern OCTAVE_API std::string
-octave_tempnam (const std::string&, const std::string&);
-
-extern OCTAVE_API std::string
-octave_tempnam (const std::string&, const std::string&, std::string&);
+OCTAVE_DEPRECATED ("use octave::sys::tempnam instead")
+inline std::string
+octave_tempnam (const std::string& dir, const std::string& pfx,
+                std::string& msg)
+{
+  return octave::sys::tempnam (dir, pfx, msg);
+}
 
-extern OCTAVE_API std::string
-octave_canonicalize_file_name (const std::string&);
+OCTAVE_DEPRECATED ("use octave::sys::canonicalize_file_name instead")
+inline std::string
+octave_canonicalize_file_name (const std::string& nm)
+{
+  return octave::sys::canonicalize_file_name (nm);
+}
 
-extern OCTAVE_API std::string
-octave_canonicalize_file_name (const std::string&, std::string&);
+OCTAVE_DEPRECATED ("use octave::sys::canonicalize_file_name instead")
+inline std::string
+octave_canonicalize_file_name (const std::string& nm, std::string& msg)
+{
+  return octave::sys::canonicalize_file_name (nm, msg);
+}
 
 #endif
+
+#endif
--- a/liboctave/system/file-stat.cc	Wed May 18 14:58:29 2016 -0400
+++ b/liboctave/system/file-stat.cc	Thu May 19 00:33:18 2016 -0400
@@ -183,11 +183,11 @@
       initialized = false;
       fail = false;
 
-      std::string full_file_name = file_ops::tilde_expand (file_name);
+      std::string full_file_name = octave::sys::file_ops::tilde_expand (file_name);
 
 #if defined (__WIN32__)
       // Remove trailing slash.
-      if (file_ops::is_dir_sep (full_file_name[full_file_name.length () - 1])
+      if (octave::sys::file_ops::is_dir_sep (full_file_name[full_file_name.length () - 1])
           && full_file_name.length () != 1
           && ! (full_file_name.length () == 3 && full_file_name[1] == ':'))
         full_file_name.resize (full_file_name.length () - 1);
--- a/liboctave/system/lo-sysdep.cc	Wed May 18 14:58:29 2016 -0400
+++ b/liboctave/system/lo-sysdep.cc	Thu May 19 00:33:18 2016 -0400
@@ -68,7 +68,7 @@
 int
 octave_chdir (const std::string& path_arg)
 {
-  std::string path = file_ops::tilde_expand (path_arg);
+  std::string path = octave::sys::file_ops::tilde_expand (path_arg);
 
 #if defined (__WIN32__) && ! defined (__CYGWIN__)
   if (path.length () == 2 && path[1] == ':')
--- a/liboctave/system/oct-env.cc	Wed May 18 14:58:29 2016 -0400
+++ b/liboctave/system/oct-env.cc	Thu May 19 00:33:18 2016 -0400
@@ -283,7 +283,7 @@
           prog_invocation_name = program_name;
 
           size_t pos
-            = prog_invocation_name.find_last_of (file_ops::dir_sep_chars ());
+            = prog_invocation_name.find_last_of (octave::sys::file_ops::dir_sep_chars ());
 
           // Also keep a shortened version of the program name.
           prog_name = (pos == std::string::npos
@@ -307,7 +307,7 @@
       size_t len = home_dir.length ();
 
       if (len > 1 && home_dir == name.substr (0, len)
-          && (name.length () == len || file_ops::is_dir_sep (name[len])))
+          && (name.length () == len || octave::sys::file_ops::is_dir_sep (name[len])))
         {
           retval = "~";
           retval.append (name.substr (len));
@@ -326,13 +326,13 @@
       if (len == 0)
         return false;
 
-      if (file_ops::is_dir_sep (s[0]))
+      if (octave::sys::file_ops::is_dir_sep (s[0]))
         return true;
 
 #if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM)
       if ((len == 2 && isalpha (s[0]) && s[1] == ':')
           || (len > 2 && isalpha (s[0]) && s[1] == ':'
-              && file_ops::is_dir_sep (s[2])))
+              && octave::sys::file_ops::is_dir_sep (s[2])))
         return true;
 #endif
 
@@ -350,13 +350,13 @@
       if (len == 1 && s[0] == '.')
         return true;
 
-      if (len > 1 && s[0] == '.' && file_ops::is_dir_sep (s[1]))
+      if (len > 1 && s[0] == '.' && octave::sys::file_ops::is_dir_sep (s[1]))
         return true;
 
       if (len == 2 && s[0] == '.' && s[1] == '.')
         return true;
 
-      if (len > 2 && s[0] == '.' && s[1] == '.' && file_ops::is_dir_sep (s[2]))
+      if (len > 2 && s[0] == '.' && s[1] == '.' && octave::sys::file_ops::is_dir_sep (s[2]))
         return true;
 
       return false;
@@ -372,7 +372,7 @@
       if (! (do_absolute_pathname (s) || do_rooted_relative_pathname (s)))
         return s;
 
-      size_t pos = s.find_last_of (file_ops::dir_sep_chars ());
+      size_t pos = s.find_last_of (octave::sys::file_ops::dir_sep_chars ());
 
       if (pos == std::string::npos)
         return s;
@@ -397,8 +397,8 @@
 
       size_t pos = current_dir.length () - 1;
 
-      if (! file_ops::is_dir_sep (current_dir[pos]))
-        current_dir.append (file_ops::dir_sep_str ());
+      if (! octave::sys::file_ops::is_dir_sep (current_dir[pos]))
+        current_dir.append (octave::sys::file_ops::dir_sep_str ());
 
       // FIXME: this is probably not correct for all systems.
 
@@ -412,14 +412,14 @@
               if (i + 1 == slen)
                 return current_dir;
 
-              if (file_ops::is_dir_sep (s[i+1]))
+              if (octave::sys::file_ops::is_dir_sep (s[i+1]))
                 {
                   i += 2;
                   continue;
                 }
 
               if (s[i+1] == '.'
-                  && (i + 2 == slen || file_ops::is_dir_sep (s[i+2])))
+                  && (i + 2 == slen || octave::sys::file_ops::is_dir_sep (s[i+2])))
                 {
                   i += 2;
 
@@ -432,7 +432,7 @@
                 }
             }
 
-          size_t tmp = s.find_first_of (file_ops::dir_sep_chars (), i);
+          size_t tmp = s.find_first_of (octave::sys::file_ops::dir_sep_chars (), i);
 
           if (tmp == std::string::npos)
             {
@@ -487,7 +487,7 @@
         {
           octave::sys::password pw = octave::sys::password::getpwuid (octave::sys::getuid ());
 
-          hd = pw ? pw.dir () : std::string (file_ops::dir_sep_str ());
+          hd = pw ? pw.dir () : std::string (octave::sys::file_ops::dir_sep_str ());
         }
 
       return hd;
@@ -555,7 +555,7 @@
 
           if (len > 1)
             {
-              if (file_ops::is_dir_sep (tmp[--len]))
+              if (octave::sys::file_ops::is_dir_sep (tmp[--len]))
                 tmp.resize (len);
             }
 
@@ -583,10 +583,10 @@
 
       while (n--)
         {
-          while (file_ops::is_dir_sep (path[i]) && i > 0)
+          while (octave::sys::file_ops::is_dir_sep (path[i]) && i > 0)
             i--;
 
-          while (! file_ops::is_dir_sep (path[i]) && i > 0)
+          while (! octave::sys::file_ops::is_dir_sep (path[i]) && i > 0)
             i--;
 
           i++;
--- a/liboctave/util/cmd-edit.cc	Wed May 18 14:58:29 2016 -0400
+++ b/liboctave/util/cmd-edit.cc	Thu May 19 00:33:18 2016 -0400
@@ -1473,7 +1473,7 @@
 {
   if (instance_ok ())
     {
-      std::string file = file_ops::tilde_expand (file_arg);
+      std::string file = octave::sys::file_ops::tilde_expand (file_arg);
 
       instance->do_read_init_file (file);
     }
--- a/liboctave/util/cmd-hist.cc	Wed May 18 14:58:29 2016 -0400
+++ b/liboctave/util/cmd-hist.cc	Thu May 19 00:33:18 2016 -0400
@@ -550,7 +550,7 @@
 {
   if (instance_ok ())
     {
-      std::string f = file_ops::tilde_expand (f_arg);
+      std::string f = octave::sys::file_ops::tilde_expand (f_arg);
 
       instance->do_set_file (f);
     }
--- a/liboctave/util/url-transfer.cc	Wed May 18 14:58:29 2016 -0400
+++ b/liboctave/util/url-transfer.cc	Thu May 19 00:33:18 2016 -0400
@@ -48,20 +48,20 @@
 void
 base_url_transfer::delete_file (const std::string& file)
 {
-  octave_unlink (file);
+  octave::sys::unlink (file);
 }
 
 void
 base_url_transfer::mget_directory (const std::string& directory,
                                    const std::string& target)
 {
-  std::string sep = file_ops::dir_sep_str ();
+  std::string sep = octave::sys::file_ops::dir_sep_str ();
   file_stat fs (directory);
 
   if (! fs || ! fs.is_dir ())
     {
       std::string msg;
-      int status = octave_mkdir (directory, 0777, msg);
+      int status = octave::sys::mkdir (directory, 0777, msg);
 
       if (status < 0)
         {
@@ -132,7 +132,7 @@
 
   std::string realdir
     = (base.length () == 0
-       ? directory : base + file_ops::dir_sep_str () + directory);
+       ? directory : base + octave::sys::file_ops::dir_sep_str () + directory);
 
   mkdir (directory);
 
@@ -160,7 +160,7 @@
               if (file == "." || file == "..")
                 continue;
 
-              std::string realfile = realdir + file_ops::dir_sep_str () + file;
+              std::string realfile = realdir + octave::sys::file_ops::dir_sep_str () + file;
               file_stat fs (realfile);
 
               if (! fs.exists ())