home *** CD-ROM | disk | FTP | other *** search
/ Super Net 1 / SUPERNET_1.iso / PC / OTROS / EXTRAS / UUCODE / UUPC / TEST / UPC12ES1.ZIP / LIB / mkdir.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-11  |  3.2 KB  |  95 lines

  1. /*--------------------------------------------------------------------*/
  2. /*    m k d i r . c                                                   */
  3. /*                                                                    */
  4. /*    Support routines for UUPC/extended                              */
  5. /*--------------------------------------------------------------------*/
  6.  
  7. /*--------------------------------------------------------------------*/
  8. /*    Changes Copyright (c) 1989 by Andrew H. Derbyshire.             */
  9. /*                                                                    */
  10. /*    Changes Copyright (c) 1990-1993 by Kendra Electronic            */
  11. /*    Wonderworks.                                                    */
  12. /*                                                                    */
  13. /*    All rights reserved except those explicitly granted by the      */
  14. /*    UUPC/extended license agreement.                                */
  15. /*--------------------------------------------------------------------*/
  16.  
  17. /*--------------------------------------------------------------------*/
  18. /*                          RCS Information                           */
  19. /*--------------------------------------------------------------------*/
  20.  
  21. /*
  22.  *    $Id: mkdir.c 1.4 1993/04/11 00:31:31 dmwatt Exp $
  23.  *
  24.  *    Revision history:
  25.  *    $Log: mkdir.c $
  26.  *     Revision 1.4  1993/04/11  00:31:31  dmwatt
  27.  *     Global edits for year, TEXT, etc.
  28.  *
  29.  *     Revision 1.4  1993/04/11  00:31:31  dmwatt
  30.  *     Global edits for year, TEXT, etc.
  31.  *
  32.  *     Revision 1.3  1993/03/24  01:57:30  ahd
  33.  *     Delete unneeded currentfile()
  34.  *
  35.  */
  36.  
  37. #include <stdio.h>
  38. #include <stdlib.h>
  39. #include <string.h>
  40. #include <time.h>
  41.  
  42. #ifdef __GNUC__
  43. #include <os2.h>
  44. #else
  45. #include <direct.h>
  46. #endif
  47.  
  48. /*--------------------------------------------------------------------*/
  49. /*                    UUPC/extended include files                     */
  50. /*--------------------------------------------------------------------*/
  51.  
  52. #include "lib.h"
  53.  
  54. /*--------------------------------------------------------------------*/
  55. /*    M K D I R                                                       */
  56. /*                                                                    */
  57. /*    Like mkdir() but create intermediate directories as well        */
  58. /*--------------------------------------------------------------------*/
  59.  
  60. int MKDIR(const char *inpath)
  61. {
  62.    char *cp;
  63.    char *path;
  64.  
  65.    if (*inpath == '\0')
  66.       return 0;
  67.  
  68.    cp = path = normalize(inpath );
  69.  
  70.  
  71. /*--------------------------------------------------------------------*/
  72. /*        See if we need to make any intermediate directories         */
  73. /*--------------------------------------------------------------------*/
  74.  
  75.    cp = path ;
  76.    while ((cp = strchr(cp, '/')) != nil(char)) {
  77.       *cp = '\0';
  78.  
  79. #ifndef __GNUC__
  80.       mkdir(path);
  81. #else
  82.       DosCreateDir( path, 0);
  83. #endif
  84.       *cp = '/';
  85.       cp++;
  86.    }
  87.  
  88. /*--------------------------------------------------------------------*/
  89. /*                           Make last dir                            */
  90. /*--------------------------------------------------------------------*/
  91.  
  92.    return mkdir(inpath);
  93.  
  94. } /*MKDIR*/
  95.