Annotation of coherent/g/usr/lib/uucp/tay104/unix/mkdirs.c, revision 1.1.1.1

1.1       root        1: /* mkdirs.c
                      2:    Create any directories needed for a file name.  */
                      3: 
                      4: #include "uucp.h"
                      5: 
                      6: #include "uudefs.h"
                      7: #include "sysdep.h"
                      8: #include "system.h"
                      9: 
                     10: #include <errno.h>
                     11: 
                     12: boolean
                     13: fsysdep_make_dirs (zfile, fpublic)
                     14:      const char *zfile;
                     15:      boolean fpublic;
                     16: {
                     17:   char *zcopy, *z;
                     18:   int imode;
                     19: 
                     20:   zcopy = zbufcpy (zfile);
                     21: 
                     22:   if (fpublic)
                     23:     imode = IPUBLIC_DIRECTORY_MODE;
                     24:   else
                     25:     imode = IDIRECTORY_MODE;
                     26: 
                     27:   for (z = zcopy; *z != '\0'; z++)
                     28:     {
                     29:       if (*z == '/' && z != zcopy)
                     30:        {
                     31:          *z = '\0';
                     32:          if (! fsysdep_directory (zcopy))
                     33:            {
                     34:              if (mkdir (zcopy, imode) != 0)
                     35:                {
                     36:                  ulog (LOG_ERROR, "mkdir (%s): %s", zcopy,
                     37:                        strerror (errno));
                     38:                  ubuffree (zcopy);
                     39:                  return FALSE;
                     40:                }
                     41:            }
                     42:          *z = '/';
                     43:        }
                     44:     }
                     45: 
                     46:   ubuffree (zcopy);
                     47: 
                     48:   return TRUE;
                     49: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.