summaryrefslogtreecommitdiffstats
path: root/Mac/Compat/mkdir.c
diff options
context:
space:
mode:
Diffstat (limited to 'Mac/Compat/mkdir.c')
-rw-r--r--Mac/Compat/mkdir.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/Mac/Compat/mkdir.c b/Mac/Compat/mkdir.c
new file mode 100644
index 0000000..b064761
--- /dev/null
+++ b/Mac/Compat/mkdir.c
@@ -0,0 +1,30 @@
+/* Mkdir 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"
+
+/* Create a directory. */
+
+int
+mkdir(path, mode)
+ char *path;
+ int mode; /* Ignored */
+{
+ HFileParam pb;
+ char name[MAXPATH];
+
+ if (!hfsrunning()) {
+ errno= ENODEV;
+ return -1;
+ }
+ strncpy(name, path, sizeof name);
+ pb.ioNamePtr= (StringPtr) c2pstr(name);
+ pb.ioVRefNum= 0;
+ pb.ioDirID= 0;
+ if (PBDirCreate((HParmBlkPtr)&pb, FALSE) != noErr) {
+ errno= EACCES;
+ return -1;
+ }
+ return 0;
+}