9 date 92.12.15.00.20.22; author jromine; state Exp;
14 date 92.11.06.03.27.09; author jromine; state Exp;
19 date 92.11.02.18.57.39; author jromine; state Exp;
24 date 92.02.11.00.37.20; author jromine; state Exp;
29 date 92.02.07.19.19.16; author jromine; state Exp;
34 date 92.01.23.23.12.43; author jromine; state Exp;
39 date 90.04.05.15.31.10; author sources; state Exp;
44 date 90.04.05.14.45.19; author sources; state Exp;
49 date 90.03.12.10.13.12; author sources; state Exp;
54 date 90.02.05.14.31.31; author sources; state Exp;
59 date 90.02.05.13.33.39; author sources; state Exp;
64 date 90.02.05.13.16.47; author sources; state Exp;
78 @/* makedir.c - make a directory */
80 static char ident[] = "@@(#)$Id: makedir.c,v 1.12 1992/11/06 03:27:09 jromine Exp jromine $";
83 #if defined (BSD42) || defined (hpux)
84 /* Modified to try recursive create. Really, this should be broken
85 * out into a subr so that SYS5 systems can do this too. I don't
86 * have a SYS5 machine around to test anymore, so someone else will
87 * have to send me the code.
94 #if defined (BSD42) || defined (hpux) || defined(SVR4) || \
95 defined(ncr) || defined (_AIX) || defined(AUX)
97 #include <sys/param.h>
99 #endif /* BSD42 ... */
101 #include <sys/types.h>
102 #include <sys/stat.h>
104 #if defined(SVR4) || defined(ncr)
115 #if defined (BSD42) || defined (hpux) || defined (SYS5DIR)
117 char path[MAXPATHLEN];
121 (void) fflush (stdout);
123 #if defined (BSD42) || defined (hpux) || defined (SYS5DIR)
124 if (getuid () == geteuid ()) {
125 c = strcpy(path, dir);
127 while ((c = index((c + 1), '/')) != NULL) {
129 if (access(path, X_OK)) {
130 if (errno != ENOENT){
131 advise (dir, "unable to create directory");
134 if (mkdir(path, 0775)) {
135 advise (dir, "unable to create directory");
142 if (mkdir (dir, 0755) == NOTOK) {
143 advise (dir, "unable to create directory");
148 #endif /* BSD42 or hpux or SYS5DIR */
149 switch (pid = vfork ()) {
151 advise ("fork", "unable to");
155 (void) setgid (getgid ());
156 (void) setuid (getuid ());
158 execl ("/bin/mkdir", "mkdir", dir, NULLCP);
159 execl ("/usr/bin/mkdir", "mkdir", dir, NULLCP);
160 fprintf (stderr, "unable to exec ");
165 if (pidXwait (pid, "mkdir"))
170 if ((cp = m_find ("folder-protect")) == NULL)
172 (void) chmod (dir, atooi (cp));
186 static char ident[] = "@@(#)$Id: makedir.c,v 1.11 1992/11/02 18:57:39 jromine Exp jromine $";
193 #endif BSD42 or hpux or SYS5DIR
204 static char ident[] = "@@(#)$Id: makedir.c,v 1.10 1992/02/11 00:37:20 jromine Exp jromine $";
207 #if defined (BSD42) || defined (hpux) || defined(SVR4) || defined(ncr) || defined (_AIX)
224 static char ident[] = "@@(#)$Id: makedir.c,v 1.9 1992/02/07 19:19:16 jromine Exp jromine $";
227 #if defined (BSD42) || defined (hpux) || defined(SVR4) || defined(ncr)
238 static char ident[] = "@@(#)$Id: makedir.c,v 1.8 1992/02/07 19:19:00 jromine Exp jromine $";
241 #if defined (BSD42) || defined (hpux) || defined(SVR4)
255 static char ident[] = "@@(#)$Id: makedir.c,v 1.6 1990/04/05 15:31:10 sources Exp jromine $";
258 #if defined (BSD42) || defined (hpux)
273 static char ident[] = "@@(#)$Id:$";
276 #if defined (BSD42) || defined (hpux)
287 static char ident[] = "$Id:";
293 @replace strchr with index
308 register char path[MAXPATHLEN];
311 while ((c = strchr((c + 1), '/')) != NULL) {
317 @allow recursive create on BSD42
323 #ifdef BSD42 || defined (hpux)
345 if (mkdir (dir, 0755) == NOTOK) {
346 advise (dir, "unable to create directory");