xref: /original-bsd/usr.bin/uucp/port/mkdir.c (revision 2301fdfb)
1 #ifndef lint
2 static char sccsid[] = "@(#)mkdir.c	5.2 (Berkeley) 06/20/85";
3 #endif
4 
5 #ifndef BSD4_2
6 #include <stdio.h>
7 
8 /*
9  * make a directory. Also make sure that the directory is owned
10  * by the right userid
11  */
12 mkdir(path, mode)
13 char *path;
14 int mode;
15 {
16 	int pid, status, w;
17 
18 	if (pid=fork()) {
19 		while ((w = wait(&status)) != pid && w != -1)
20 			;
21 		(void) chmod(path, mode);
22 	} else {
23 		(void) umask(~mode);
24 		(void) execlp("mkdir", "mkdir", path, (char *)NULL);
25 		perror(path);
26 		_exit(1);
27 	}
28 	return status;
29 }
30 #endif !BSD4_2
31