head 1.13; access; symbols; locks; strict; comment @ * @; 1.13 date 92.12.15.00.20.22; author jromine; state Exp; branches; next 1.12; 1.12 date 92.11.06.03.27.09; author jromine; state Exp; branches; next 1.11; 1.11 date 92.11.02.18.57.39; author jromine; state Exp; branches; next 1.10; 1.10 date 92.02.11.00.37.20; author jromine; state Exp; branches; next 1.9; 1.9 date 92.02.07.19.19.16; author jromine; state Exp; branches; next 1.7; 1.7 date 92.01.23.23.12.43; author jromine; state Exp; branches; next 1.6; 1.6 date 90.04.05.15.31.10; author sources; state Exp; branches; next 1.5; 1.5 date 90.04.05.14.45.19; author sources; state Exp; branches; next 1.4; 1.4 date 90.03.12.10.13.12; author sources; state Exp; branches; next 1.3; 1.3 date 90.02.05.14.31.31; author sources; state Exp; branches; next 1.2; 1.2 date 90.02.05.13.33.39; author sources; state Exp; branches; next 1.1; 1.1 date 90.02.05.13.16.47; author sources; state Exp; branches; next ; desc @@ 1.13 log @endif sugar @ text @/* makedir.c - make a directory */ #ifndef lint static char ident[] = "@@(#)$Id: makedir.c,v 1.12 1992/11/06 03:27:09 jromine Exp jromine $"; #endif /* lint */ #if defined (BSD42) || defined (hpux) /* Modified to try recursive create. Really, this should be broken * out into a subr so that SYS5 systems can do this too. I don't * have a SYS5 machine around to test anymore, so someone else will * have to send me the code. */ #endif #include "../h/mh.h" #include #if defined (BSD42) || defined (hpux) || defined(SVR4) || \ defined(ncr) || defined (_AIX) || defined(AUX) #include #include #include #endif /* BSD42 ... */ #ifdef SYS5DIR #include #include #endif /* SYS5DIR */ #if defined(SVR4) || defined(ncr) #include #endif extern int errno; makedir (dir) register char *dir; { int pid; register char *cp; #if defined (BSD42) || defined (hpux) || defined (SYS5DIR) register char *c; char path[MAXPATHLEN]; #endif /* BSD42 */ m_update (); (void) fflush (stdout); #if defined (BSD42) || defined (hpux) || defined (SYS5DIR) if (getuid () == geteuid ()) { c = strcpy(path, dir); while ((c = index((c + 1), '/')) != NULL) { *c = (char)0; if (access(path, X_OK)) { if (errno != ENOENT){ advise (dir, "unable to create directory"); return 0; } if (mkdir(path, 0775)) { advise (dir, "unable to create directory"); return 0; } } *c = '/'; } if (mkdir (dir, 0755) == NOTOK) { advise (dir, "unable to create directory"); return 0; } } else #endif /* BSD42 or hpux or SYS5DIR */ switch (pid = vfork ()) { case NOTOK: advise ("fork", "unable to"); return 0; case OK: (void) setgid (getgid ()); (void) setuid (getuid ()); execl ("/bin/mkdir", "mkdir", dir, NULLCP); execl ("/usr/bin/mkdir", "mkdir", dir, NULLCP); fprintf (stderr, "unable to exec "); perror ("mkdir"); _exit (-1); default: if (pidXwait (pid, "mkdir")) return 0; break; } if ((cp = m_find ("folder-protect")) == NULL) cp = foldprot; (void) chmod (dir, atooi (cp)); return 1; } @ 1.12 log @AUX fixup @ text @d3 2 a4 2 static char ident[] = "@@(#)$Id: makedir.c,v 1.11 1992/11/02 18:57:39 jromine Exp jromine $"; #endif lint d41 1 a41 1 #endif BSD42 d71 1 a71 1 #endif BSD42 or hpux or SYS5DIR @ 1.11 log @_AIX @ text @d3 1 a3 1 static char ident[] = "@@(#)$Id: makedir.c,v 1.10 1992/02/11 00:37:20 jromine Exp jromine $"; d17 2 a18 1 #if defined (BSD42) || defined (hpux) || defined(SVR4) || defined(ncr) || defined (_AIX) d22 1 a22 1 #endif BSD42 d26 1 a26 1 #endif SYS5DIR @ 1.10 log @ncr changes @ text @d3 1 a3 1 static char ident[] = "@@(#)$Id: makedir.c,v 1.9 1992/02/07 19:19:16 jromine Exp jromine $"; d17 1 a17 1 #if defined (BSD42) || defined (hpux) || defined(SVR4) || defined(ncr) @ 1.9 log @SVR4 @ text @d3 1 a3 1 static char ident[] = "@@(#)$Id: makedir.c,v 1.8 1992/02/07 19:19:00 jromine Exp jromine $"; d17 1 a17 1 #if defined (BSD42) || defined (hpux) || defined(SVR4) d26 1 a26 1 #ifdef SVR4 @ 1.7 log @ifdef bug @ text @d3 1 a3 1 static char ident[] = "@@(#)$Id: makedir.c,v 1.6 1990/04/05 15:31:10 sources Exp jromine $"; d17 1 a17 1 #if defined (BSD42) || defined (hpux) d21 1 a21 1 #endif BDS42 d26 3 @ 1.6 log @add ID @ text @d3 1 a3 1 static char ident[] = "@@(#)$Id:$"; d34 1 a34 1 #if defined (BSD42) || defined (hpux) @ 1.5 log @add ID @ text @d3 1 a3 1 static char ident[] = "$Id:"; @ 1.4 log @replace strchr with index @ text @d2 3 @ 1.3 log @SYS5DIR fixes @ text @d23 2 d33 1 a33 1 register char path[MAXPATHLEN]; d43 1 a43 1 while ((c = strchr((c + 1), '/')) != NULL) { @ 1.2 log @allow recursive create on BSD42 @ text @d19 4 d37 1 a37 1 #ifdef BSD42 || defined (hpux) d62 1 a62 1 #endif BSD42 @ 1.1 log @Initial revision @ text @d3 8 d14 6 a19 1 d25 4 d33 1 a33 1 #ifdef BSD42 d35 21 a55 4 if (mkdir (dir, 0755) == NOTOK) { advise (dir, "unable to create directory"); return 0; } @