changeset 21736:0504351a45e6

use namespace for file_stat classes * file-stat.h, file-stat.cc: Put base_file_stat, file_stat, and file_fstat in octave::sys namespace. Change all uses.
author John W. Eaton <jwe@octave.org>
date Thu, 19 May 2016 01:22:06 -0400
parents 60212efcd9cb
children ab6c639f0678
files libinterp/corefcn/__magick_read__.cc libinterp/corefcn/debug.cc libinterp/corefcn/dirfns.cc libinterp/corefcn/file-io.cc libinterp/corefcn/graphics.cc libinterp/corefcn/load-path.cc libinterp/corefcn/load-save.cc libinterp/corefcn/ls-mat5.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/__init_gnuplot__.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/file-ops.cc liboctave/system/file-stat.cc liboctave/system/file-stat.h liboctave/util/cmd-hist.cc liboctave/util/oct-glob.cc liboctave/util/oct-shlib.cc liboctave/util/url-transfer.cc
diffstat 26 files changed, 484 insertions(+), 458 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/__magick_read__.cc	Thu May 19 01:05:45 2016 -0400
+++ b/libinterp/corefcn/__magick_read__.cc	Thu May 19 01:22:06 2016 -0400
@@ -1488,7 +1488,7 @@
   // If writemode is set to append, read the image and append to it. Even
   // if set to append, make sure that something was read at all.
   const std::string writemode = options.getfield ("writemode").string_value ();
-  if (writemode == "append" && file_stat (filename).exists ())
+  if (writemode == "append" && octave::sys::file_stat (filename).exists ())
     {
       std::vector<Magick::Image> ini_imvec;
       read_file (filename, ini_imvec);
@@ -1897,7 +1897,7 @@
   // We can't actually get FormatVersion but even Matlab sometimes can't.
   template_info.setfield ("FormatVersion", octave_value (""));
 
-  const file_stat fs (filename);
+  const octave::sys::file_stat fs (filename);
   if (! fs)
     error ("imfinfo: error reading '%s': %s", filename.c_str (),
            fs.error ().c_str ());
--- a/libinterp/corefcn/debug.cc	Thu May 19 01:05:45 2016 -0400
+++ b/libinterp/corefcn/debug.cc	Thu May 19 01:22:06 2016 -0400
@@ -78,7 +78,7 @@
 {
   std::string retval;
 
-  file_stat fs (fname);
+  octave::sys::file_stat fs (fname);
 
   if (fs)
     {
--- a/libinterp/corefcn/dirfns.cc	Thu May 19 01:05:45 2016 -0400
+++ b/libinterp/corefcn/dirfns.cc	Thu May 19 01:22:06 2016 -0400
@@ -225,7 +225,7 @@
 
   dirname = octave::sys::file_ops::tilde_expand (dirname);
 
-  file_stat fs (dirname);
+  octave::sys::file_stat fs (dirname);
 
   if (fs && fs.is_dir ())
     {
--- a/libinterp/corefcn/file-io.cc	Thu May 19 01:05:45 2016 -0400
+++ b/libinterp/corefcn/file-io.cc	Thu May 19 01:22:06 2016 -0400
@@ -452,7 +452,7 @@
 
   std::string fname = octave::sys::file_ops::tilde_expand (name);
 
-  file_stat fs (fname);
+  octave::sys::file_stat fs (fname);
 
   if (! (md & std::ios::out))
     fname = find_data_file_in_load_path ("fopen", fname);
--- a/libinterp/corefcn/graphics.cc	Thu May 19 01:05:45 2016 -0400
+++ b/libinterp/corefcn/graphics.cc	Thu May 19 01:22:06 2016 -0400
@@ -10805,7 +10805,7 @@
                 {
                   std::string dirname = file.substr (0, pos+1);
 
-                  file_stat fs (dirname);
+                  octave::sys::file_stat fs (dirname);
 
                   if (! fs || ! fs.is_dir ())
                     error ("drawnow: nonexistent directory '%s'",
--- a/libinterp/corefcn/load-path.cc	Thu May 19 01:05:45 2016 -0400
+++ b/libinterp/corefcn/load-path.cc	Thu May 19 01:22:06 2016 -0400
@@ -55,7 +55,7 @@
 void
 load_path::dir_info::update (void)
 {
-  file_stat fs (dir_name);
+  octave::sys::file_stat fs (dir_name);
 
   if (fs)
     {
@@ -137,7 +137,7 @@
 
   dir_time_last_checked = octave::sys::time (static_cast<time_t> (0));
 
-  file_stat fs (dir_name);
+  octave::sys::file_stat fs (dir_name);
 
   if (fs)
     {
@@ -197,7 +197,7 @@
 
           std::string full_name = octave::sys::file_ops::concat (d, fname);
 
-          file_stat fs (full_name);
+          octave::sys::file_stat fs (full_name);
 
           if (fs)
             {
@@ -306,7 +306,7 @@
 
   std::string pd = octave::sys::file_ops::concat (d, "private");
 
-  file_stat fs (pd);
+  octave::sys::file_stat fs (pd);
 
   if (fs && fs.is_dir ())
     method_file_map[class_name].private_file_map = get_fcn_files (pd);
@@ -757,7 +757,7 @@
     do_move (i, at_end);
   else
     {
-      file_stat fs (dir);
+      octave::sys::file_stat fs (dir);
 
       if (fs)
         {
@@ -1310,7 +1310,7 @@
           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);
+          octave::sys::file_stat fs (pfname);
 
           if (fs.exists () && fs.is_reg ())
             retval = pfname;
@@ -1328,7 +1328,7 @@
   if (octave::sys::env::absolute_pathname (file)
       || octave::sys::env::rooted_relative_pathname (file))
     {
-      file_stat fs (file);
+      octave::sys::file_stat fs (file);
 
       return fs.exists () ? file : retval;
     }
@@ -1351,7 +1351,7 @@
         {
           std::string tfile = octave::sys::file_ops::concat (p->dir_name, file);
 
-          file_stat fs (tfile);
+          octave::sys::file_stat fs (tfile);
 
           if (fs.exists ())
             return tfile;
@@ -1389,7 +1389,7 @@
       && (octave::sys::env::absolute_pathname (dir)
           || octave::sys::env::rooted_relative_pathname (dir)))
     {
-      file_stat fs (dir);
+      octave::sys::file_stat fs (dir);
 
       if (fs.exists () && fs.is_dir ())
         return dir;
@@ -1416,7 +1416,7 @@
               && 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);
+              octave::sys::file_stat fs (p->dir_name);
 
               if (fs.exists () && fs.is_dir ())
                 return p->dir_name;
@@ -1436,7 +1436,7 @@
       && (octave::sys::env::absolute_pathname (dir)
           || octave::sys::env::rooted_relative_pathname (dir)))
     {
-      file_stat fs (dir);
+      octave::sys::file_stat fs (dir);
 
       if (fs.exists () && fs.is_dir ())
         retlist.push_back (dir);
@@ -1463,7 +1463,7 @@
               && 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);
+              octave::sys::file_stat fs (p->dir_name);
 
               if (fs.exists () && fs.is_dir ())
                 retlist.push_back (p->dir_name);
@@ -1496,7 +1496,7 @@
           if (octave::sys::env::absolute_pathname (file)
               || octave::sys::env::rooted_relative_pathname (file))
             {
-              file_stat fs (file);
+              octave::sys::file_stat fs (file);
 
               if (fs.exists ())
                 return file;
@@ -1509,7 +1509,7 @@
                 {
                   std::string tfile = octave::sys::file_ops::concat (p->dir_name, file);
 
-                  file_stat fs (tfile);
+                  octave::sys::file_stat fs (tfile);
 
                   if (fs.exists ())
                     return tfile;
@@ -1575,7 +1575,7 @@
           if (octave::sys::env::absolute_pathname (file)
               || octave::sys::env::rooted_relative_pathname (file))
             {
-              file_stat fs (file);
+              octave::sys::file_stat fs (file);
 
               if (fs.exists ())
                 retlist.push_back (file);
@@ -1588,7 +1588,7 @@
                 {
                   std::string tfile = octave::sys::file_ops::concat (p->dir_name, file);
 
-                  file_stat fs (tfile);
+                  octave::sys::file_stat fs (tfile);
 
                   if (fs.exists ())
                     retlist.push_back (tfile);
@@ -2173,7 +2173,7 @@
                 {
                   std::string nm = octave::sys::file_ops::concat (dirname, elt);
 
-                  file_stat fs (nm);
+                  octave::sys::file_stat fs (nm);
 
                   if (fs && fs.is_dir ())
                     retval += dir_path::path_sep_str () + genpath (nm, skip);
@@ -2211,7 +2211,7 @@
 
   std::string file = octave::sys::file_ops::concat (dir, script_file);
 
-  file_stat fs (file);
+  octave::sys::file_stat fs (file);
 
   if (fs.exists ())
     source_file (file, "base");
--- a/libinterp/corefcn/load-save.cc	Thu May 19 01:05:45 2016 -0400
+++ b/libinterp/corefcn/load-save.cc	Thu May 19 01:22:06 2016 -0400
@@ -502,14 +502,14 @@
       // Either no '.' in name or no '.' appears after last directory
       // separator.
 
-      file_stat fs (fname);
+      octave::sys::file_stat fs (fname);
 
       if (! (fs.exists () && fs.is_reg ()))
         fname = find_file_to_load (fname + ".mat", orig_name);
     }
   else
     {
-      file_stat fs (fname);
+      octave::sys::file_stat fs (fname);
 
       if (! (fs.exists () && fs.is_reg ()))
         {
--- a/libinterp/corefcn/ls-mat5.cc	Thu May 19 01:05:45 2016 -0400
+++ b/libinterp/corefcn/ls-mat5.cc	Thu May 19 01:22:06 2016 -0400
@@ -876,7 +876,7 @@
                     // First check if just replacing matlabroot is enough
                     std::string str = OCTAVE_EXEC_PREFIX +
                                       fpath.substr (mroot.length ());
-                    file_stat fs (str);
+                    octave::sys::file_stat fs (str);
 
                     if (fs.exists ())
                       {
--- a/libinterp/corefcn/symtab.cc	Thu May 19 01:05:45 2016 -0400
+++ b/libinterp/corefcn/symtab.cc	Thu May 19 01:22:06 2016 -0400
@@ -335,7 +335,7 @@
                              || (Vignore_function_time_stamp
                                  && fcn->is_system_fcn_file ())))
                         {
-                          file_stat fs (ff);
+                          octave::sys::file_stat fs (ff);
 
                           if (fs)
                             {
--- a/libinterp/corefcn/syscalls.cc	Thu May 19 01:05:45 2016 -0400
+++ b/libinterp/corefcn/syscalls.cc	Thu May 19 01:22:06 2016 -0400
@@ -60,7 +60,7 @@
 #include "input.h"
 
 static octave_scalar_map
-mk_stat_map (const base_file_stat& fs)
+mk_stat_map (const base_octave::sys::file_stat& fs)
 {
   octave_scalar_map m;
 
@@ -89,7 +89,7 @@
 }
 
 static octave_value_list
-mk_stat_result (const base_file_stat& fs)
+mk_stat_result (const base_octave::sys::file_stat& fs)
 {
   if (fs)
     return ovl (octave_value (mk_stat_map (fs)), 0, "");
@@ -627,7 +627,7 @@
 
   std::string fname = args(0).xstring_value ("lstat: NAME must be a string");
 
-  file_stat fs (fname, false);
+  octave::sys::file_stat fs (fname, false);
 
   return mk_stat_result (fs);
 }
@@ -860,7 +860,7 @@
     {
       std::string fname = args(0).xstring_value ("stat: NAME must be a string");
 
-      file_stat fs (fname);
+      octave::sys::file_stat fs (fname);
 
       retval = mk_stat_result (fs);
     }
@@ -883,7 +883,7 @@
 
   double mode = args(0).xdouble_value ("S_ISREG: invalid MODE value");
 
-  return ovl (file_stat::is_reg (static_cast<mode_t> (mode)));
+  return ovl (octave::sys::file_stat::is_reg (static_cast<mode_t> (mode)));
 }
 
 DEFUNX ("S_ISDIR", FS_ISDIR, args, ,
@@ -901,7 +901,7 @@
 
   double mode = args(0).xdouble_value ("S_ISDIR: invalid MODE value");
 
-  return ovl (file_stat::is_dir (static_cast<mode_t> (mode)));
+  return ovl (octave::sys::file_stat::is_dir (static_cast<mode_t> (mode)));
 }
 
 DEFUNX ("S_ISCHR", FS_ISCHR, args, ,
@@ -919,7 +919,7 @@
 
   double mode = args(0).xdouble_value ("S_ISCHR: invalid MODE value");
 
-  return ovl (file_stat::is_chr (static_cast<mode_t> (mode)));
+  return ovl (octave::sys::file_stat::is_chr (static_cast<mode_t> (mode)));
 }
 
 DEFUNX ("S_ISBLK", FS_ISBLK, args, ,
@@ -937,7 +937,7 @@
 
   double mode = args(0).xdouble_value ("S_ISBLK: invalid MODE value");
 
-  return ovl (file_stat::is_blk (static_cast<mode_t> (mode)));
+  return ovl (octave::sys::file_stat::is_blk (static_cast<mode_t> (mode)));
 }
 
 DEFUNX ("S_ISFIFO", FS_ISFIFO, args, ,
@@ -955,7 +955,7 @@
 
   double mode = args(0).xdouble_value ("S_ISFIFO: invalid MODE value");
 
-  return ovl (file_stat::is_fifo (static_cast<mode_t> (mode)));
+  return ovl (octave::sys::file_stat::is_fifo (static_cast<mode_t> (mode)));
 }
 
 DEFUNX ("S_ISLNK", FS_ISLNK, args, ,
@@ -973,7 +973,7 @@
 
   double mode = args(0).xdouble_value ("S_ISLNK: invalid MODE value");
 
-  return ovl (file_stat::is_lnk (static_cast<mode_t> (mode)));
+  return ovl (octave::sys::file_stat::is_lnk (static_cast<mode_t> (mode)));
 }
 
 DEFUNX ("S_ISSOCK", FS_ISSOCK, args, ,
@@ -991,7 +991,7 @@
 
   double mode = args(0).xdouble_value ("S_ISSOCK: invalid MODE value");
 
-  return ovl (file_stat::is_sock (static_cast<mode_t> (mode)));
+  return ovl (octave::sys::file_stat::is_sock (static_cast<mode_t> (mode)));
 }
 
 DEFUN (gethostname, args, ,
--- a/libinterp/corefcn/sysdep.cc	Thu May 19 01:05:45 2016 -0400
+++ b/libinterp/corefcn/sysdep.cc	Thu May 19 01:22:06 2016 -0400
@@ -300,8 +300,8 @@
 
   // POSIX Code
 
-  file_stat fs_file1 (file1);
-  file_stat fs_file2 (file2);
+  octave::sys::file_stat fs_file1 (file1);
+  octave::sys::file_stat fs_file2 (file2);
 
   return (fs_file1 && fs_file2
           && fs_file1.ino () == fs_file2.ino ()
--- a/libinterp/corefcn/urlwrite.cc	Thu May 19 01:05:45 2016 -0400
+++ b/libinterp/corefcn/urlwrite.cc	Thu May 19 01:22:06 2016 -0400
@@ -359,7 +359,7 @@
   // create it, and the download fails.  We use unwind_protect to do
   // it so that the deletion happens no matter how we exit the function.
 
-  file_stat fs (filename);
+  octave::sys::file_stat fs (filename);
 
   std::ofstream ofile (filename.c_str (), std::ios::out | std::ios::binary);
 
@@ -816,7 +816,7 @@
     {
       std::string file = files(i);
 
-      file_stat fs (file);
+      octave::sys::file_stat fs (file);
 
       if (! fs.exists ())
         error ("__ftp__mput: file does not exist");
--- a/libinterp/corefcn/utils.cc	Thu May 19 01:05:45 2016 -0400
+++ b/libinterp/corefcn/utils.cc	Thu May 19 01:22:06 2016 -0400
@@ -448,7 +448,7 @@
       // Load path will also search "." first, but we don't want to
       // issue a warning if the file is found in the current directory,
       // so do an explicit check for that.
-      file_stat fs (fname);
+      octave::sys::file_stat fs (fname);
 
       bool local_file_ok
         = fs.exists () && (fs.is_reg () || ! require_regular_file);
@@ -485,7 +485,7 @@
     {
       if (octave::sys::env::absolute_pathname (name))
         {
-          file_stat fs (name);
+          octave::sys::file_stat fs (name);
 
           if (fs.exists () && ! fs.is_dir ())
             retval = name;
@@ -519,7 +519,7 @@
       std::string tcontents = octave::sys::file_ops::concat (load_path::find_dir (dir),
                                                 std::string ("Contents.m"));
 
-      file_stat fs (tcontents);
+      octave::sys::file_stat fs (tcontents);
 
       if (fs.exists ())
         retval = octave::sys::env::make_absolute (tcontents);
@@ -543,7 +543,7 @@
     {
       if (octave::sys::env::absolute_pathname (name))
         {
-          file_stat fs (name);
+          octave::sys::file_stat fs (name);
 
           if (fs.exists ())
             retval = name;
@@ -572,7 +572,7 @@
     {
       if (octave::sys::env::absolute_pathname (name))
         {
-          file_stat fs (name);
+          octave::sys::file_stat fs (name);
 
           if (fs.exists ())
             retval = name;
--- a/libinterp/corefcn/variables.cc	Thu May 19 01:05:45 2016 -0400
+++ b/libinterp/corefcn/variables.cc	Thu May 19 01:22:06 2016 -0400
@@ -462,7 +462,7 @@
       if (file_name.empty ())
         file_name = name;
 
-      file_stat fs (file_name);
+      octave::sys::file_stat fs (file_name);
 
       if (fs)
         {
--- a/libinterp/dldfcn/__init_gnuplot__.cc	Thu May 19 01:05:45 2016 -0400
+++ b/libinterp/dldfcn/__init_gnuplot__.cc	Thu May 19 01:22:06 2016 -0400
@@ -178,7 +178,7 @@
   string_vector args (gnuplot_binary);
   std::string gnuplot_path = search_path_for_file (path, args);
 
-  file_stat fs (gnuplot_path);
+  octave::sys::file_stat fs (gnuplot_path);
 
   if (! fs.exists () && ! exeext.empty ())
     {
@@ -186,7 +186,7 @@
 
       gnuplot_path = search_path_for_file (path, args);
 
-      fs = file_stat (gnuplot_path);
+      fs = octave::sys::file_stat (gnuplot_path);
     }
 
   return fs.exists ();
--- a/libinterp/octave-value/ov-fcn-handle.cc	Thu May 19 01:05:45 2016 -0400
+++ b/libinterp/octave-value/ov-fcn-handle.cc	Thu May 19 01:22:06 2016 -0400
@@ -266,7 +266,7 @@
       // First check if just replacing matlabroot is enough
       std::string str = OCTAVE_EXEC_PREFIX +
                         fpath.substr (octaveroot.length ());
-      file_stat fs (str);
+      octave::sys::file_stat fs (str);
 
       if (fs.exists ())
         {
--- a/libinterp/octave-value/ov-java.cc	Thu May 19 01:05:45 2016 -0400
+++ b/libinterp/octave-value/ov-java.cc	Thu May 19 01:22:06 2016 -0400
@@ -433,7 +433,7 @@
 
       std::string jar_file = java_dir + sep + "octave.jar";
 
-      file_stat jar_exists (jar_file);
+      octave::sys::file_stat jar_exists (jar_file);
 
       if (jar_exists)
         {
@@ -457,11 +457,11 @@
             {
               std::string filename = cp_list[i];
               std::string cp_file = filename;
-              file_stat   cp_exists;
+              octave::sys::file_stat   cp_exists;
 
               // Try to find classpath file in the current directory.
 
-              cp_exists = file_stat (cp_file);
+              cp_exists = octave::sys::file_stat (cp_file);
               if (cp_exists)
                 {
                   // File found.  Add its contents to the static classpath.
@@ -475,7 +475,7 @@
                 {
                   cp_file = "~" + sep + filename;
                   cp_file = octave::sys::file_ops::tilde_expand (cp_file);
-                  cp_exists = file_stat (cp_file);
+                  cp_exists = octave::sys::file_stat (cp_file);
                   if (cp_exists)
                     {
                       // File found.  Add its contents to the static classpath.
@@ -489,7 +489,7 @@
               if (cwd != java_dir)
                 {
                   cp_file = java_dir + sep + filename;
-                  cp_exists = file_stat (cp_file);
+                  cp_exists = octave::sys::file_stat (cp_file);
                   if (cp_exists)
                     {
                       // File found.  Add its contents to the static classpath.
--- a/libinterp/octave.cc	Thu May 19 01:05:45 2016 -0400
+++ b/libinterp/octave.cc	Thu May 19 01:22:06 2016 -0400
@@ -396,7 +396,7 @@
 
           // Names alone are not enough.
 
-          file_stat fs_home_rc (home_rc);
+          octave::sys::file_stat fs_home_rc (home_rc);
 
           if (fs_home_rc)
             {
--- a/libinterp/parse-tree/oct-parse.in.yy	Thu May 19 01:05:45 2016 -0400
+++ b/libinterp/parse-tree/oct-parse.in.yy	Thu May 19 01:22:06 2016 -0400
@@ -3207,7 +3207,7 @@
 
       std::string nm = fcn->fcn_file_name ();
 
-      file_stat fs (nm);
+      octave::sys::file_stat fs (nm);
 
       if (fs && fs.is_newer (now))
         warning_with_id ("Octave:future-time-stamp",
@@ -4496,7 +4496,7 @@
                   fname = octave::sys::env::make_absolute (fname);
                   fname = fname.substr (0, fname.find_last_of (octave::sys::file_ops::dir_sep_str ()) + 1);
 
-                  file_stat fs (fname + nm);
+                  octave::sys::file_stat fs (fname + nm);
 
                   if (fs.exists ())
                     {
--- a/liboctave/system/file-ops.cc	Thu May 19 01:05:45 2016 -0400
+++ b/liboctave/system/file-ops.cc	Thu May 19 01:22:06 2016 -0400
@@ -595,7 +595,7 @@
               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);
+              octave::sys::file_stat fs (fullnm, false);
 
               if (fs)
                 {
@@ -688,7 +688,7 @@
       std::string templatename;
       if (dir.empty ())
         templatename = octave::sys::env::get_temp_directory ();
-      else if (! file_stat (dir, false).is_dir ())
+      else if (! octave::sys::file_stat (dir, false).is_dir ())
         templatename = octave::sys::env::get_temp_directory ();
       else
         templatename = dir;
--- a/liboctave/system/file-stat.cc	Thu May 19 01:05:45 2016 -0400
+++ b/liboctave/system/file-stat.cc	Thu May 19 01:22:06 2016 -0400
@@ -36,248 +36,255 @@
 #include "file-stat.h"
 #include "statdefs.h"
 
-// FIXME: the is_* and mode_as_string functions are only valid
-// for initialized objects.  If called for an object that is not
-// initialized, they should throw an exception.
-
-bool
-base_file_stat::is_blk (void) const
-{
-  return exists () && is_blk (fs_mode);
-}
-
-bool
-base_file_stat::is_chr (void) const
-{
-  return exists () && is_chr (fs_mode);
-}
-
-bool
-base_file_stat::is_dir (void) const
-{
-  return exists () && is_dir (fs_mode);
-}
-
-bool
-base_file_stat::is_fifo (void) const
-{
-  return exists () && is_fifo (fs_mode);
-}
-
-bool
-base_file_stat::is_lnk (void) const
-{
-  return exists () && is_lnk (fs_mode);
-}
-
-bool
-base_file_stat::is_reg (void) const
+namespace octave
 {
-  return exists () && is_reg (fs_mode);
-}
+  namespace sys
+  {
+    // FIXME: the is_* and mode_as_string functions are only valid
+    // for initialized objects.  If called for an object that is not
+    // initialized, they should throw an exception.
+
+    bool
+    base_file_stat::is_blk (void) const
+    {
+      return exists () && is_blk (m_mode);
+    }
+
+    bool
+    base_file_stat::is_chr (void) const
+    {
+      return exists () && is_chr (m_mode);
+    }
+
+    bool
+    base_file_stat::is_dir (void) const
+    {
+      return exists () && is_dir (m_mode);
+    }
 
-bool
-base_file_stat::is_sock (void) const
-{
-  return exists () && is_sock (fs_mode);
-}
+    bool
+    base_file_stat::is_fifo (void) const
+    {
+      return exists () && is_fifo (m_mode);
+    }
+
+    bool
+    base_file_stat::is_lnk (void) const
+    {
+      return exists () && is_lnk (m_mode);
+    }
 
-bool
-base_file_stat::is_blk (mode_t mode)
-{
+    bool
+    base_file_stat::is_reg (void) const
+    {
+      return exists () && is_reg (m_mode);
+    }
+
+    bool
+    base_file_stat::is_sock (void) const
+    {
+      return exists () && is_sock (m_mode);
+    }
+
+    bool
+    base_file_stat::is_blk (mode_t mode)
+    {
 #if defined (S_ISBLK)
-  return S_ISBLK (mode);
+      return S_ISBLK (mode);
 #else
-  return false;
+      return false;
 #endif
-}
+    }
 
-bool
-base_file_stat::is_chr (mode_t mode)
-{
+    bool
+    base_file_stat::is_chr (mode_t mode)
+    {
 #if defined (S_ISCHR)
-  return S_ISCHR (mode);
+      return S_ISCHR (mode);
 #else
-  return false;
-#endif
-}
-
-bool
-base_file_stat::is_dir (mode_t mode)
-{
-#if defined (S_ISDIR)
-  return S_ISDIR (mode);
-#else
-  return false;
+      return false;
 #endif
-}
+    }
 
-bool
-base_file_stat::is_fifo (mode_t mode)
-{
-#if defined (S_ISFIFO)
-  return S_ISFIFO (mode);
+    bool
+    base_file_stat::is_dir (mode_t mode)
+    {
+#if defined (S_ISDIR)
+      return S_ISDIR (mode);
 #else
-  return false;
+      return false;
 #endif
-}
+    }
 
-bool
-base_file_stat::is_lnk (mode_t mode)
-{
-#if defined (S_ISLNK)
-  return S_ISLNK (mode);
+    bool
+    base_file_stat::is_fifo (mode_t mode)
+    {
+#if defined (S_ISFIFO)
+      return S_ISFIFO (mode);
 #else
-  return false;
+      return false;
 #endif
-}
+    }
 
-bool
-base_file_stat::is_reg (mode_t mode)
-{
+    bool
+    base_file_stat::is_lnk (mode_t mode)
+    {
+#if defined (S_ISLNK)
+      return S_ISLNK (mode);
+#else
+      return false;
+#endif
+    }
+
+    bool
+    base_file_stat::is_reg (mode_t mode)
+    {
 #if defined (S_ISREG)
-  return S_ISREG (mode);
+      return S_ISREG (mode);
 #else
-  return false;
+      return false;
 #endif
-}
+    }
 
-bool
-base_file_stat::is_sock (mode_t mode)
-{
+    bool
+    base_file_stat::is_sock (mode_t mode)
+    {
 #if defined (S_ISSOCK)
-  return S_ISSOCK (mode);
+      return S_ISSOCK (mode);
 #else
-  return false;
+      return false;
 #endif
-}
+    }
 
-std::string
-base_file_stat::mode_as_string (void) const
-{
-  char buf[12];
+    std::string
+    base_file_stat::mode_as_string (void) const
+    {
+      char buf[12];
 
-  strmode (fs_mode, buf);
+      strmode (m_mode, buf);
 
-  return std::string (buf);
-}
+      return std::string (buf);
+    }
 
-// Has FILE been modified since TIME?  Returns 1 for yes, 0 for no,
-// and -1 for any error.
+    // Has FILE been modified since TIME?  Returns 1 for yes, 0 for no,
+    // and -1 for any error.
 
-int
-base_file_stat::is_newer (const std::string& file, const octave::sys::time& time)
-{
-  file_stat fs (file);
+    int
+    base_file_stat::is_newer (const std::string& file,
+                              const octave::sys::time& time)
+    {
+      file_stat fs (file);
 
-  return fs ? fs.is_newer (time) : -1;
-}
-
-// Private stuff:
+      return fs ? fs.is_newer (time) : -1;
+    }
 
-void
-file_stat::update_internal (bool force)
-{
-  if (! initialized || force)
+    // Private stuff:
+
+    void
+    file_stat::update_internal (bool force)
     {
-      initialized = false;
-      fail = false;
+      if (! initialized || force)
+        {
+          initialized = false;
+          fail = false;
 
-      std::string full_file_name = octave::sys::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 (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);
+          // Remove trailing slash.
+          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);
 #endif
 
-      const char *cname = full_file_name.c_str ();
+          const char *cname = full_file_name.c_str ();
 
-      struct stat buf;
+          struct stat buf;
 
-      int status = follow_links
-                   ? stat (cname, &buf) : gnulib::lstat (cname, &buf);
+          int status = follow_links
+            ? stat (cname, &buf) : gnulib::lstat (cname, &buf);
 
-      if (status < 0)
-        {
-          fail = true;
-          errmsg = gnulib::strerror (errno);
-        }
-      else
-        {
-          fs_mode = buf.st_mode;
-          fs_ino = buf.st_ino;
-          fs_dev = buf.st_dev;
-          fs_nlink = buf.st_nlink;
-          fs_uid = buf.st_uid;
-          fs_gid = buf.st_gid;
-          fs_size = buf.st_size;
-          fs_atime = buf.st_atime;
-          fs_mtime = buf.st_mtime;
-          fs_ctime = buf.st_ctime;
+          if (status < 0)
+            {
+              fail = true;
+              errmsg = gnulib::strerror (errno);
+            }
+          else
+            {
+              m_mode = buf.st_mode;
+              m_ino = buf.st_ino;
+              m_dev = buf.st_dev;
+              m_nlink = buf.st_nlink;
+              m_uid = buf.st_uid;
+              m_gid = buf.st_gid;
+              m_size = buf.st_size;
+              m_atime = buf.st_atime;
+              m_mtime = buf.st_mtime;
+              m_ctime = buf.st_ctime;
 
 #if defined (HAVE_STRUCT_STAT_ST_RDEV)
-          fs_rdev = buf.st_rdev;
+              m_rdev = buf.st_rdev;
 #endif
 
 #if defined (HAVE_STRUCT_STAT_ST_BLKSIZE)
-          fs_blksize = buf.st_blksize;
+              m_blksize = buf.st_blksize;
 #endif
 
 #if defined (HAVE_STRUCT_STAT_ST_BLOCKS)
-          fs_blocks = buf.st_blocks;
+              m_blocks = buf.st_blocks;
 #endif
-        }
+            }
 
-      initialized = true;
+          initialized = true;
+        }
     }
-}
 
-void
-file_fstat::update_internal (bool force)
-{
-  if (! initialized || force)
+    void
+    file_fstat::update_internal (bool force)
     {
-      initialized = false;
-      fail = false;
+      if (! initialized || force)
+        {
+          initialized = false;
+          fail = false;
 
-      struct stat buf;
+          struct stat buf;
 
-      int status = gnulib::fstat (fid, &buf);
+          int status = gnulib::fstat (fid, &buf);
 
-      if (status < 0)
-        {
-          fail = true;
-          errmsg = gnulib::strerror (errno);
-        }
-      else
-        {
-          fs_mode = buf.st_mode;
-          fs_ino = buf.st_ino;
-          fs_dev = buf.st_dev;
-          fs_nlink = buf.st_nlink;
-          fs_uid = buf.st_uid;
-          fs_gid = buf.st_gid;
-          fs_size = buf.st_size;
-          fs_atime = buf.st_atime;
-          fs_mtime = buf.st_mtime;
-          fs_ctime = buf.st_ctime;
+          if (status < 0)
+            {
+              fail = true;
+              errmsg = gnulib::strerror (errno);
+            }
+          else
+            {
+              m_mode = buf.st_mode;
+              m_ino = buf.st_ino;
+              m_dev = buf.st_dev;
+              m_nlink = buf.st_nlink;
+              m_uid = buf.st_uid;
+              m_gid = buf.st_gid;
+              m_size = buf.st_size;
+              m_atime = buf.st_atime;
+              m_mtime = buf.st_mtime;
+              m_ctime = buf.st_ctime;
 
 #if defined (HAVE_STRUCT_STAT_ST_RDEV)
-          fs_rdev = buf.st_rdev;
+              m_rdev = buf.st_rdev;
 #endif
 
 #if defined (HAVE_STRUCT_STAT_ST_BLKSIZE)
-          fs_blksize = buf.st_blksize;
+              m_blksize = buf.st_blksize;
 #endif
 
 #if defined (HAVE_STRUCT_STAT_ST_BLOCKS)
-          fs_blocks = buf.st_blocks;
+              m_blocks = buf.st_blocks;
 #endif
-        }
+            }
 
-      initialized = true;
+          initialized = true;
+        }
     }
+  }
 }
--- a/liboctave/system/file-stat.h	Thu May 19 01:05:45 2016 -0400
+++ b/liboctave/system/file-stat.h	Thu May 19 01:22:06 2016 -0400
@@ -31,286 +31,305 @@
 
 #include <sys/types.h>
 
-class
-OCTAVE_API
-base_file_stat
+namespace octave
 {
-public:
+  namespace sys
+  {
+    class
+    OCTAVE_API
+    base_file_stat
+    {
+    public:
 
-  base_file_stat (void)
-    : initialized (false), fail (false), errmsg (), fs_mode (),
-      fs_ino (), fs_dev (), fs_nlink (), fs_uid (), fs_gid (),
-      fs_size (), fs_atime (), fs_mtime (), fs_ctime (), fs_rdev (),
-      fs_blksize (), fs_blocks () { }
+      base_file_stat (void)
+        : initialized (false), fail (false), errmsg (), m_mode (),
+          m_ino (), m_dev (), m_nlink (), m_uid (), m_gid (),
+          m_size (), m_atime (), m_mtime (), m_ctime (), m_rdev (),
+          m_blksize (), m_blocks () { }
 
-  base_file_stat (const base_file_stat& fs)
-    : initialized (fs.initialized), fail (fs.fail), errmsg (fs.errmsg),
-      fs_mode (fs.fs_mode), fs_ino (fs.fs_ino), fs_dev (fs.fs_dev),
-      fs_nlink (fs.fs_nlink), fs_uid (fs.fs_uid), fs_gid (fs.fs_gid),
-      fs_size (fs.fs_size), fs_atime (fs.fs_atime), fs_mtime (fs.fs_mtime),
-      fs_ctime (fs.fs_ctime), fs_rdev (fs.fs_rdev),
-      fs_blksize (fs.fs_blksize), fs_blocks (fs.fs_blocks) { }
+      base_file_stat (const base_file_stat& fs)
+        : initialized (fs.initialized), fail (fs.fail), errmsg (fs.errmsg),
+          m_mode (fs.m_mode), m_ino (fs.m_ino), m_dev (fs.m_dev),
+          m_nlink (fs.m_nlink), m_uid (fs.m_uid), m_gid (fs.m_gid),
+          m_size (fs.m_size), m_atime (fs.m_atime), m_mtime (fs.m_mtime),
+          m_ctime (fs.m_ctime), m_rdev (fs.m_rdev),
+          m_blksize (fs.m_blksize), m_blocks (fs.m_blocks) { }
 
-  base_file_stat& operator = (const base_file_stat& fs)
-  {
-    if (this != &fs)
+      base_file_stat& operator = (const base_file_stat& fs)
+        {
+          if (this != &fs)
+            {
+              initialized = fs.initialized;
+              fail = fs.fail;
+              errmsg = fs.errmsg;
+              m_mode = fs.m_mode;
+              m_ino = fs.m_ino;
+              m_dev = fs.m_dev;
+              m_nlink = fs.m_nlink;
+              m_uid = fs.m_uid;
+              m_gid = fs.m_gid;
+              m_size = fs.m_size;
+              m_atime = fs.m_atime;
+              m_mtime = fs.m_mtime;
+              m_ctime = fs.m_ctime;
+              m_rdev = fs.m_rdev;
+              m_blksize = fs.m_blksize;
+              m_blocks = fs.m_blocks;
+            }
+
+          return *this;
+        }
+
+      // The minimum difference in file time stamp values.
+      // FIXME: This value should come from the filesystem itself.
+      //        How can we get that info?
+      octave::sys::time time_resolution (void) const
       {
-        initialized = fs.initialized;
-        fail = fs.fail;
-        errmsg = fs.errmsg;
-        fs_mode = fs.fs_mode;
-        fs_ino = fs.fs_ino;
-        fs_dev = fs.fs_dev;
-        fs_nlink = fs.fs_nlink;
-        fs_uid = fs.fs_uid;
-        fs_gid = fs.fs_gid;
-        fs_size = fs.fs_size;
-        fs_atime = fs.fs_atime;
-        fs_mtime = fs.fs_mtime;
-        fs_ctime = fs.fs_ctime;
-        fs_rdev = fs.fs_rdev;
-        fs_blksize = fs.fs_blksize;
-        fs_blocks = fs.fs_blocks;
+        static octave::sys::time resolution (1.0);
+        return resolution;
       }
 
-    return *this;
-  }
+      // File status and info.  The is_XXX functions will return false for
+      // file_stat objects that are not properly initialized.  The others
+      // should all return 0 (or the equivalent, for the given object)
+      // which is likely not meaningful.
 
-  // The minimum difference in file time stamp values.
-  // FIXME: This value should come from the filesystem itself.
-  //        How can we get that info?
-  octave::sys::time time_resolution (void) const
-  {
-    static octave::sys::time resolution (1.0);
-    return resolution;
-  }
-
-  // File status and info.  The is_XXX functions will return false for
-  // file_stat objects that are not properly initialized.  The others
-  // should all return 0 (or the equivalent, for the given object)
-  // which is likely not meaningful.
+      bool is_blk (void) const;
+      bool is_chr (void) const;
+      bool is_dir (void) const;
+      bool is_fifo (void) const;
+      bool is_lnk (void) const;
+      bool is_reg (void) const;
+      bool is_sock (void) const;
 
-  bool is_blk (void) const;
-  bool is_chr (void) const;
-  bool is_dir (void) const;
-  bool is_fifo (void) const;
-  bool is_lnk (void) const;
-  bool is_reg (void) const;
-  bool is_sock (void) const;
+      static bool is_blk (mode_t mode);
+      static bool is_chr (mode_t mode);
+      static bool is_dir (mode_t mode);
+      static bool is_fifo (mode_t mode);
+      static bool is_lnk (mode_t mode);
+      static bool is_reg (mode_t mode);
+      static bool is_sock (mode_t mode);
 
-  static bool is_blk (mode_t mode);
-  static bool is_chr (mode_t mode);
-  static bool is_dir (mode_t mode);
-  static bool is_fifo (mode_t mode);
-  static bool is_lnk (mode_t mode);
-  static bool is_reg (mode_t mode);
-  static bool is_sock (mode_t mode);
+      ino_t ino (void) const { return m_ino; }
+      dev_t dev (void) const { return m_dev; }
 
-  ino_t ino (void) const { return fs_ino; }
-  dev_t dev (void) const { return fs_dev; }
+      nlink_t nlink (void) const { return m_nlink; }
+
+      uid_t uid (void) const { return m_uid; }
+      gid_t gid (void) const { return m_gid; }
 
-  nlink_t nlink (void) const { return fs_nlink; }
+      off_t size (void) const { return m_size; }
 
-  uid_t uid (void) const { return fs_uid; }
-  gid_t gid (void) const { return fs_gid; }
-
-  off_t size (void) const { return fs_size; }
+      octave::sys::time atime (void) const { return m_atime; }
+      octave::sys::time mtime (void) const { return m_mtime; }
+      octave::sys::time ctime (void) const { return m_ctime; }
 
-  octave::sys::time atime (void) const { return fs_atime; }
-  octave::sys::time mtime (void) const { return fs_mtime; }
-  octave::sys::time ctime (void) const { return fs_ctime; }
+      dev_t rdev (void) const { return m_rdev; }
 
-  dev_t rdev (void) const { return fs_rdev; }
+      long blksize (void) const { return m_blksize; }
+      long blocks (void) const { return m_blocks; }
 
-  long blksize (void) const { return fs_blksize; }
-  long blocks (void) const { return fs_blocks; }
+      mode_t mode (void) const { return m_mode; }
 
-  mode_t mode (void) const { return fs_mode; }
+      std::string mode_as_string (void) const;
 
-  std::string mode_as_string (void) const;
+      bool ok (void) const { return initialized && ! fail; }
 
-  bool ok (void) const { return initialized && ! fail; }
+      operator bool () const { return ok (); }
 
-  operator bool () const { return ok (); }
+      bool exists (void) const { return ok (); }
 
-  bool exists (void) const { return ok (); }
-
-  std::string error (void) const { return ok () ? "" : errmsg; }
+      std::string error (void) const { return ok () ? "" : errmsg; }
 
-  // Has the file referenced by this object been modified since TIME?
-  bool is_newer (const octave::sys::time& time) const { return fs_mtime > time; }
+      // Has the file referenced by this object been modified since TIME?
+      bool is_newer (const octave::sys::time& time) const { return m_mtime > time; }
 
-  // It's nice to be able to hide the file_stat object if we don't
-  // really care about it.
-  static int is_newer (const std::string&, const octave::sys::time&);
+      // It's nice to be able to hide the file_stat object if we don't
+      // really care about it.
+      static int is_newer (const std::string&, const octave::sys::time&);
 
-protected:
-
-  virtual ~base_file_stat (void) { }
+    protected:
 
-  // TRUE means we have already called stat.
-  bool initialized;
+      virtual ~base_file_stat (void) { }
 
-  // TRUE means the stat for this file failed.
-  bool fail;
-
-  // If a failure occurs, this contains the system error text.
-  std::string errmsg;
+      // TRUE means we have already called stat.
+      bool initialized;
 
-  // file type and permissions
-  mode_t fs_mode;
+      // TRUE means the stat for this file failed.
+      bool fail;
 
-  // serial number
-  ino_t fs_ino;
+      // If a failure occurs, this contains the system error text.
+      std::string errmsg;
 
-  // device number
-  dev_t fs_dev;
+      // file type and permissions
+      mode_t m_mode;
 
-  // number of links
-  nlink_t fs_nlink;
+      // serial number
+      ino_t m_ino;
 
-  // user ID of owner
-  uid_t fs_uid;
-
-  // group ID of owner
-  gid_t fs_gid;
+      // device number
+      dev_t m_dev;
 
-  // size in bytes, for regular files
-  off_t fs_size;
+      // number of links
+      nlink_t m_nlink;
 
-  // time of last access
-  octave::sys::time fs_atime;
+      // user ID of owner
+      uid_t m_uid;
 
-  // time of last modification
-  octave::sys::time fs_mtime;
+      // group ID of owner
+      gid_t m_gid;
 
-  // time of last file status change
-  octave::sys::time fs_ctime;
+      // size in bytes, for regular files
+      off_t m_size;
 
-  // device number for special files
-  dev_t fs_rdev;
-
-  // best I/O block size
-  long fs_blksize;
+      // time of last access
+      octave::sys::time m_atime;
 
-  // number of 512-byte blocks allocated
-  long fs_blocks;
-};
+      // time of last modification
+      octave::sys::time m_mtime;
 
-class
-OCTAVE_API
-file_stat : public base_file_stat
-{
-public:
+      // time of last file status change
+      octave::sys::time m_ctime;
+
+      // device number for special files
+      dev_t m_rdev;
 
-  file_stat (const std::string& n = "", bool fl = true)
-    : base_file_stat (), file_name (n), follow_links (fl)
-  {
-    if (! file_name.empty ())
-      update_internal ();
-  }
+      // best I/O block size
+      long m_blksize;
+
+      // number of 512-byte blocks allocated
+      long m_blocks;
+    };
 
-  file_stat (const file_stat& fs)
-    : base_file_stat (fs), file_name (fs.file_name),
-      follow_links (fs.follow_links) { }
+    class
+    OCTAVE_API
+    file_stat : public base_file_stat
+    {
+    public:
 
-  file_stat& operator = (const file_stat& fs)
-  {
-    if (this != &fs)
+      file_stat (const std::string& n = "", bool fl = true)
+        : base_file_stat (), file_name (n), follow_links (fl)
       {
-        base_file_stat::operator = (fs);
-
-        file_name = fs.file_name;
-        follow_links = fs.follow_links;
+        if (! file_name.empty ())
+          update_internal ();
       }
 
-    return *this;
-  }
-
-  ~file_stat (void) { }
+      file_stat (const file_stat& fs)
+        : base_file_stat (fs), file_name (fs.file_name),
+        follow_links (fs.follow_links) { }
 
-  void get_stats (bool force = false)
-  {
-    if (! initialized || force)
-      update_internal (force);
-  }
+      file_stat& operator = (const file_stat& fs)
+        {
+          if (this != &fs)
+            {
+              base_file_stat::operator = (fs);
 
-  void get_stats (const std::string& n, bool force = false)
-  {
-    if (n != file_name || ! initialized || force)
-      {
-        initialized = false;
+              file_name = fs.file_name;
+              follow_links = fs.follow_links;
+            }
 
-        file_name = n;
+          return *this;
+        }
 
-        update_internal (force);
-      }
-  }
+      ~file_stat (void) { }
 
-private:
-
-  // Name of the file.
-  std::string file_name;
+      void get_stats (bool force = false)
+      {
+        if (! initialized || force)
+          update_internal (force);
+      }
 
-  // TRUE means follow symbolic links to the ultimate file (stat).
-  // FALSE means get information about the link itself (lstat).
-  bool follow_links;
+      void get_stats (const std::string& n, bool force = false)
+      {
+        if (n != file_name || ! initialized || force)
+          {
+            initialized = false;
+
+            file_name = n;
 
-  void update_internal (bool force = false);
-};
+            update_internal (force);
+          }
+      }
 
-class
-OCTAVE_API
-file_fstat : public base_file_stat
-{
-public:
+    private:
+
+      // Name of the file.
+      std::string file_name;
 
-  file_fstat (int n) : base_file_stat (), fid (n)
-  {
-    update_internal ();
-  }
+      // TRUE means follow symbolic links to the ultimate file (stat).
+      // FALSE means get information about the link itself (lstat).
+      bool follow_links;
 
-  file_fstat (const file_fstat& fs)
-    : base_file_stat (fs), fid (fs.fid) { }
+      void update_internal (bool force = false);
+    };
 
-  file_fstat& operator = (const file_fstat& fs)
-  {
-    if (this != &fs)
+    class
+    OCTAVE_API
+    file_fstat : public base_file_stat
+    {
+    public:
+
+      file_fstat (int n) : base_file_stat (), fid (n)
       {
-        base_file_stat::operator = (fs);
-
-        fid = fs.fid;
+        update_internal ();
       }
 
-    return *this;
-  }
+      file_fstat (const file_fstat& fs)
+        : base_file_stat (fs), fid (fs.fid) { }
 
-  ~file_fstat (void) { }
+      file_fstat& operator = (const file_fstat& fs)
+        {
+          if (this != &fs)
+            {
+              base_file_stat::operator = (fs);
+
+              fid = fs.fid;
+            }
 
-  void get_stats (bool force = false)
-  {
-    if (! initialized || force)
-      update_internal (force);
-  }
+          return *this;
+        }
+
+      ~file_fstat (void) { }
 
-  void get_stats (int n, bool force = false)
-  {
-    if (n != fid || ! initialized || force)
+      void get_stats (bool force = false)
+      {
+        if (! initialized || force)
+          update_internal (force);
+      }
+
+      void get_stats (int n, bool force = false)
       {
-        initialized = false;
+        if (n != fid || ! initialized || force)
+          {
+            initialized = false;
 
-        fid = n;
+            fid = n;
 
-        update_internal (force);
+            update_internal (force);
+          }
       }
-  }
+
+    private:
+
+      // Open file descriptor.
+      int fid;
 
-private:
+      void update_internal (bool force = false);
+    };
+  }
+}
+
+#if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS)
 
-  // Open file descriptor.
-  int fid;
+OCTAVE_DEPRECATED ("use octave::sys::base_file_stat instead")
+typedef octave::sys::base_file_stat base_file_stat;
 
-  void update_internal (bool force = false);
-};
+OCTAVE_DEPRECATED ("use octave::sys::file_stat instead")
+typedef octave::sys::file_stat file_stat;
+
+OCTAVE_DEPRECATED ("use octave::sys::file_fstat instead")
+typedef octave::sys::file_fstat file_fstat;
 
 #endif
+
+#endif
--- a/liboctave/util/cmd-hist.cc	Thu May 19 01:05:45 2016 -0400
+++ b/liboctave/util/cmd-hist.cc	Thu May 19 01:22:06 2016 -0400
@@ -394,7 +394,7 @@
 
               if (! f.empty ())
                 {
-                  file_stat fs (f);
+                  octave::sys::file_stat fs (f);
 
                   if (! fs)
                     {
--- a/liboctave/util/oct-glob.cc	Thu May 19 01:05:45 2016 -0400
+++ b/liboctave/util/oct-glob.cc	Thu May 19 01:22:06 2016 -0400
@@ -42,7 +42,7 @@
 static bool
 single_match_exists (const std::string& file)
 {
-  file_stat s (file);
+  octave::sys::file_stat s (file);
 
   return s.exists ();
 }
--- a/liboctave/util/oct-shlib.cc	Thu May 19 01:05:45 2016 -0400
+++ b/liboctave/util/oct-shlib.cc	Thu May 19 01:22:06 2016 -0400
@@ -74,7 +74,7 @@
 bool
 octave_shlib::shlib_rep::is_out_of_date (void) const
 {
-  file_stat fs (file);
+  octave::sys::file_stat fs (file);
   return (fs && fs.is_newer (tm_loaded));
 }
 
@@ -82,7 +82,7 @@
 octave_shlib::shlib_rep::fake_reload (void)
 {
   // We can't actually reload the library, but we'll pretend we did.
-  file_stat fs (file);
+  octave::sys::file_stat fs (file);
   if (fs && fs.is_newer (tm_loaded))
     {
       tm_loaded = fs.mtime ();
--- a/liboctave/util/url-transfer.cc	Thu May 19 01:05:45 2016 -0400
+++ b/liboctave/util/url-transfer.cc	Thu May 19 01:22:06 2016 -0400
@@ -56,7 +56,7 @@
                                    const std::string& target)
 {
   std::string sep = octave::sys::file_ops::dir_sep_str ();
-  file_stat fs (directory);
+  octave::sys::file_stat fs (directory);
 
   if (! fs || ! fs.is_dir ())
     {
@@ -161,7 +161,7 @@
                 continue;
 
               std::string realfile = realdir + octave::sys::file_ops::dir_sep_str () + file;
-              file_stat fs (realfile);
+              octave::sys::file_stat fs (realfile);
 
               if (! fs.exists ())
                 {