1: /* makedir.c - make a directory */
   2: 
   3: #include "../h/mh.h"
   4: #include <stdio.h>
   5: 
   6: 
   7: makedir (dir)
   8: register char *dir;
   9: {
  10:     int     pid;
  11:     register char  *cp;
  12: 
  13:     m_update ();
  14:     (void) fflush (stdout);
  15: 
  16: #ifdef  BSD42
  17:     if (getuid () == geteuid ()) {
  18:     if (mkdir (dir, 0755) == NOTOK) {
  19:         advise (dir, "unable to create directory");
  20:         return 0;
  21:     }
  22:     }
  23:     else
  24: #endif	BSD42
  25:     switch (pid = vfork ()) {
  26:     case NOTOK:
  27:         advise ("fork", "unable to");
  28:         return 0;
  29: 
  30:     case OK:
  31:         (void) setgid (getgid ());
  32:         (void) setuid (getuid ());
  33: 
  34:         execl ("/bin/mkdir", "mkdir", dir, NULLCP);
  35:         execl ("/usr/bin/mkdir", "mkdir", dir, NULLCP);
  36:         fprintf (stderr, "unable to exec ");
  37:         perror ("mkdir");
  38:         _exit (-1);
  39: 
  40:     default:
  41:         if (pidXwait (pid, "mkdir"))
  42:         return 0;
  43:         break;
  44:     }
  45: 
  46:     if ((cp = m_find ("folder-protect")) == NULL)
  47:     cp = foldprot;
  48:     (void) chmod (dir, atooi (cp));
  49:     return 1;
  50: }

Defined functions

makedir defined in line 7; used 2 times
Last modified: 1985-12-02
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 971
Valid CSS Valid XHTML 1.0 Strict