blob: 3c35eb0ca88c86862aeea073c78d078743a174f3 [file] [log] [blame]
Guido van Rossumd4d77281994-08-19 10:51:31 +00001/* Mkdir for the Macintosh.
2 Public domain by Guido van Rossum, CWI, Amsterdam (July 1987).
3 Pathnames must be Macintosh paths, with colons as separators. */
4
5#include "macdefs.h"
6
7/* Create a directory. */
8
9int
10mkdir(path, mode)
11 char *path;
12 int mode; /* Ignored */
13{
14 HFileParam pb;
Guido van Rossumd4d77281994-08-19 10:51:31 +000015
16 if (!hfsrunning()) {
17 errno= ENODEV;
18 return -1;
19 }
Jack Jansen67132b31995-01-18 13:55:41 +000020 pb.ioNamePtr= (StringPtr) Pstring(path);
Guido van Rossumd4d77281994-08-19 10:51:31 +000021 pb.ioVRefNum= 0;
22 pb.ioDirID= 0;
23 if (PBDirCreate((HParmBlkPtr)&pb, FALSE) != noErr) {
24 errno= EACCES;
25 return -1;
26 }
27 return 0;
28}