summaryrefslogtreecommitdiffstats
path: root/Mac/Compat/rmdir.c
diff options
context:
space:
mode:
Diffstat (limited to 'Mac/Compat/rmdir.c')
-rw-r--r--Mac/Compat/rmdir.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/Mac/Compat/rmdir.c b/Mac/Compat/rmdir.c
new file mode 100644
index 0000000..f31052f
--- /dev/null
+++ b/Mac/Compat/rmdir.c
@@ -0,0 +1,22 @@
+/* Rmdir for the Macintosh.
+ Public domain by Guido van Rossum, CWI, Amsterdam (July 1987).
+ Pathnames must be Macintosh paths, with colons as separators. */
+
+#include "macdefs.h"
+
+int
+rmdir(path)
+ char *path;
+{
+ IOParam pb;
+ char name[MAXPATH];
+
+ strncpy(name, path, sizeof name);
+ pb.ioNamePtr= (StringPtr) c2pstr(name);
+ pb.ioVRefNum= 0;
+ if (PBDelete((ParmBlkPtr)&pb, FALSE) != noErr) {
+ errno= EACCES;
+ return -1;
+ }
+ return 0;
+}