Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #include <libc/stubs.h>
  2. #include <stdio.h>              /* For FILENAME_MAX */
  3. #include <errno.h>              /* For errno */
  4. #include <string.h>             /* For strlen() */
  5. #include <sys/stat.h>
  6. #include <libc/dosio.h>
  7.  
  8. static inline int is_slash(char c)
  9. {
  10.  return c=='/' || c=='\\';
  11. }
  12.  
  13. void fix_slashes(char * in,char * out)
  14. {
  15.  int slash_count;
  16.  for(slash_count=1;in && out && *in;in++)
  17.  {
  18.   if(is_slash(*in))
  19.   {
  20.    slash_count++;
  21.    continue;
  22.   } else {
  23.    if(slash_count)
  24.    {
  25.     slash_count=0;
  26.     *out++='/';
  27.    }
  28.    *out++=*in;
  29.   }
  30.  }
  31.  *out='\0';
  32. }
  33.  
  34. char * __libc_combine_path(char * c);
  35.  
  36. void _fixpath(const char *in, char *out)
  37. {
  38.  char * combined;
  39.  combined=__libc_combine_path((char *)in);
  40.  fix_slashes(combined,out);
  41. }
  42.