1 /*- 2 * Copyright (c) 1985 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.proprietary.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)mkdir.c 5.3 (Berkeley) 04/24/91"; 10 #endif /* not lint */ 11 12 #ifndef BSD4_2 13 #include <stdio.h> 14 15 /* 16 * make a directory. Also make sure that the directory is owned 17 * by the right userid 18 */ 19 mkdir(path, mode) 20 char *path; 21 int mode; 22 { 23 int pid, status, w; 24 25 if (pid=fork()) { 26 while ((w = wait(&status)) != pid && w != -1) 27 ; 28 (void) chmod(path, mode); 29 } else { 30 (void) umask(~mode); 31 (void) execlp("mkdir", "mkdir", path, (char *)NULL); 32 perror(path); 33 _exit(1); 34 } 35 return status; 36 } 37 #endif !BSD4_2 38