diff liboctave/file-ops.cc @ 2668:0d865ef7478f

[project @ 1997-02-13 18:21:47 by jwe]
author jwe
date Thu, 13 Feb 1997 18:22:39 +0000
parents 06595bc7f2d0
children 8b262e771614
line wrap: on
line diff
--- a/liboctave/file-ops.cc	Mon Feb 10 04:07:08 1997 +0000
+++ b/liboctave/file-ops.cc	Thu Feb 13 18:22:39 1997 +0000
@@ -238,6 +238,19 @@
   return mkdir (name.c_str (), mode);
 }
 
+int
+oct_mkdir (const string& name, mode_t mode, string& msg)
+{
+  msg = string ();
+
+  int status = mkdir (name.c_str (), mode);
+
+  if (status < 0)
+    msg = strerror (errno);
+
+  return status;
+}
+
 // I don't know how to emulate this on systems that don't provide it.
 
 int
@@ -251,6 +264,24 @@
 #endif
 }
 
+int
+oct_mkfifo (const string& name, mode_t mode, string& msg)
+{
+  msg = string ();
+
+#if defined (HAVE_MKFIFO)
+  int status = mkfifo (name.c_str (), mode);
+
+  if (status < 0)
+    msg = strerror (errno);
+
+  return status;
+#else
+  ::error ("mkfifo: not implemented on this system");
+  return -1;
+#endif
+}
+
 // We provide a replacement for rename().
 
 int
@@ -259,6 +290,19 @@
   return rename (from.c_str (), to.c_str ());
 }
 
+int
+oct_rename (const string& from, const string& to, string& msg)
+{
+  msg = string ();
+
+  int status = rename (from.c_str (), to.c_str ());
+
+  if (status < 0)
+    msg = strerror (errno);
+
+  return status;
+}
+
 // We provide a replacement for rmdir().
 
 int
@@ -267,6 +311,19 @@
   return rmdir (name.c_str ());
 }
 
+int
+oct_rmdir (const string& name, string& msg)
+{
+  msg = string ();
+
+  int status = rmdir (name.c_str ());
+
+  if (status < 0)
+    msg = strerror (errno);
+
+  return status;
+}
+
 // We provide a replacement for tempnam().
 
 string
@@ -305,6 +362,19 @@
   return unlink (name.c_str ());
 }
 
+int
+oct_unlink (const string& name, string& errmsg)
+{
+  errmsg = string ();
+
+  int status = unlink (name.c_str ());
+
+  if (status < 0)
+    errmsg = strerror (errno);
+
+  return status;
+}
+
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***