xref: /original-bsd/usr.bin/uucp/port/mkdir.c (revision c3e32dec)
1 /*-
2  * Copyright (c) 1985, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.proprietary.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)mkdir.c	8.1 (Berkeley) 06/06/93";
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