home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / UUPC11XS.ZIP / LIB / NORMALIZ.C < prev    next >
C/C++ Source or Header  |  1992-11-27  |  2KB  |  68 lines

  1. /*--------------------------------------------------------------------*/
  2. /*    n o r m a l i z . c                                             */
  3. /*                                                                    */
  4. /*    Normalize a path for UUPC/extended                              */
  5. /*                                                                    */
  6. /*    Copyright (c) 1992 by Kendra Electronic Wonderworks; all        */
  7. /*    rights reserved except those explicitly granted by the          */
  8. /*    UUPC/extended license.                                          */
  9. /*--------------------------------------------------------------------*/
  10.  
  11. /*--------------------------------------------------------------------*/
  12. /*                          RCS Information                           */
  13. /*--------------------------------------------------------------------*/
  14.  
  15. /*
  16.  *    $Header: E:\SRC\UUPC\LIB\RCS\NORMALIZ.C 1.1 1992/11/22 21:06:14 ahd Exp $
  17.  *
  18.  *    Revision history:
  19.  *    $Log: NORMALIZ.C $
  20.  * Revision 1.1  1992/11/22  21:06:14  ahd
  21.  * Initial revision
  22.  *
  23.  *
  24.  */
  25.  
  26. /*--------------------------------------------------------------------*/
  27. /*                   Standard library include files                   */
  28. /*--------------------------------------------------------------------*/
  29.  
  30. #include <stdio.h>
  31. #include <stdlib.h>
  32. #include <string.h>
  33. #include <time.h>
  34. #include <sys/types.h>
  35.  
  36. /*--------------------------------------------------------------------*/
  37. /*                    UUPC/extended include files                     */
  38. /*--------------------------------------------------------------------*/
  39.  
  40. #include "lib.h"
  41.  
  42. /*--------------------------------------------------------------------*/
  43. /*    n o r m a l i z e                                               */
  44. /*                                                                    */
  45. /*    Normalize a DOS Path                                            */
  46. /*--------------------------------------------------------------------*/
  47.  
  48. char *normalize( const char *path )
  49. {
  50.    static char save[FILENAME_MAX];
  51.    int column;
  52.  
  53.    char *p = _fullpath( save, path, sizeof save );
  54.  
  55.    if ( p == NULL )
  56.       return NULL;
  57.  
  58.    while ((p = strchr(p,'\\')) != NULL)
  59.       *p++ = '/';
  60.  
  61.    column = strlen( save ) - 1;
  62.    if ( save[column] == '/' )
  63.        save[column] = '\0';
  64.  
  65.    return strlwr( save );
  66.  
  67. } /* normalize */
  68.