[svn:parrot] r45983 - trunk/src/pmc

fperrad at svn.parrot.org fperrad at svn.parrot.org
Sat Apr 24 13:03:54 UTC 2010


Author: fperrad
Date: Sat Apr 24 13:03:53 2010
New Revision: 45983
URL: https://trac.parrot.org/parrot/changeset/45983

Log:
[pmc] implement OS.chmod()

Modified:
   trunk/src/pmc/os.pmc

Modified: trunk/src/pmc/os.pmc
==============================================================================
--- trunk/src/pmc/os.pmc	Sat Apr 24 11:55:13 2010	(r45982)
+++ trunk/src/pmc/os.pmc	Sat Apr 24 13:03:53 2010	(r45983)
@@ -563,6 +563,32 @@
         }
     }
 
+/*
+
+=item C<chmod(STRING *path, INTVAL mode)>
+
+=cut
+
+*/
+
+    METHOD chmod(STRING *path, INTVAL mode) {
+        char * const cpath = Parrot_str_to_cstring(INTERP, path);
+
+#ifndef WIN32
+        const int    error = chmod(cpath, mode);
+#else
+        const int    error = _chmod(cpath, mode);
+#endif
+
+        Parrot_str_free_cstring(cpath);
+
+        if (error) {
+            const char * const errmsg = strerror(errno);
+            Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_EXTERNAL_ERROR,
+                errmsg);
+        }
+    }
+
 }
 
 /*


More information about the parrot-commits mailing list