Guido van Rossum | d4d7728 | 1994-08-19 10:51:31 +0000 | [diff] [blame] | 1 | /* 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 | |
| 9 | int |
| 10 | mkdir(path, mode) |
| 11 | char *path; |
| 12 | int mode; /* Ignored */ |
| 13 | { |
| 14 | HFileParam pb; |
Guido van Rossum | d4d7728 | 1994-08-19 10:51:31 +0000 | [diff] [blame] | 15 | |
| 16 | if (!hfsrunning()) { |
| 17 | errno= ENODEV; |
| 18 | return -1; |
| 19 | } |
Jack Jansen | 67132b3 | 1995-01-18 13:55:41 +0000 | [diff] [blame] | 20 | pb.ioNamePtr= (StringPtr) Pstring(path); |
Guido van Rossum | d4d7728 | 1994-08-19 10:51:31 +0000 | [diff] [blame] | 21 | 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 | } |