home *** CD-ROM | disk | FTP | other *** search
- /*--------------------------------------------------------------------*/
- /* m k d i r . c */
- /* */
- /* Support routines for UUPC/extended */
- /* */
- /* Changes Copyright 1990, 1991 (c) Andrew H. Derbyshire */
- /* */
- /* History: */
- /* 21Nov1991 Break out of lib.c ahd */
- /*--------------------------------------------------------------------*/
-
- #include <direct.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <time.h>
-
- /*--------------------------------------------------------------------*/
- /* UUPC/extended include files */
- /*--------------------------------------------------------------------*/
-
- #include "lib.h"
-
- currentfile();
-
- /*--------------------------------------------------------------------*/
- /* M K D I R */
- /* */
- /* Like mkdir() but create intermediate directories as well */
- /*--------------------------------------------------------------------*/
-
- int MKDIR(const char *inpath)
- {
- char *cp;
- char *path;
-
- if (*inpath == '\0')
- return 0;
-
- path = strdup(inpath);
- checkref(path);
- cp = path ;
-
- while ((cp = strchr(cp, '\\')) != nil(char)) {
- *cp = '/';
- }
-
- /* see if we need to make any intermediate directories */
- cp = path ;
- while ((cp = strchr(cp, '/')) != nil(char)) {
- *cp = '\0';
- mkdir(path);
- *cp = '/';
- cp++;
- }
-
- free(path);
-
- /* make last dir */
- return mkdir(inpath);
-
- } /*MKDIR*/
-