summaryrefslogtreecommitdiffstats
path: root/Mac/Compat/mkdir.c
blob: b0647610a5875265f121d6d98390375ebefd9627 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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;
}