60     else if (path[1] == 
':' || path[2] == 
'\\')
 
   75             if (*path == expectedchar) { path++; 
break; }
 
  100     if (!path || max_len <= 0)
 
  111     else if (path[1] == 
':' || path[2] == 
'\\')
 
  120     pathlen = (int)
strlen (path);
 
  123     for (i = 0; i<pathlen; i++)
 
  126         if (*path == expectedchar) levels++;
 
  129         if ( (levels == levelreq) && (*path != expectedchar) && (copypnt < (max_len-1)))
 
  130             output[copypnt++] = *path;
 
  137     output[copypnt] = 
'\0';
 
  140     if (output[0] != 
'\0')
 
  151 int fatfs_split_path(
char *full_path, 
char *path, 
int max_path, 
char *filename, 
int max_filename)
 
  169         strindex = (int)
strlen(full_path) - (int)
strlen(filename);
 
  170         if (strindex > max_path)
 
  173         memcpy(path, full_path, strindex);
 
  174         path[strindex-1] = 
'\0';
 
  182 static int FileString_StrCmpNoCase(
char *s1, 
char *s2, 
int n)
 
  193         if ((a>=
'A') && (a<=
'Z'))
 
  195         if ((b>=
'A') && (b<=
'Z'))
 
  205         if ( (*s1 == 0) || (*s2 == 0) )
 
  217 static int FileString_GetExtension(
char *str)
 
  226             dotPos = (int)(strSrc-str);
 
  237 static int FileString_TrimLength(
char *str, 
int strLen)
 
  240     char *strSrc = str+strLen-1;
 
  246             length = (int)(strSrc - str);
 
  264     int ext1Pos, ext2Pos;
 
  265     int file1Len, file2Len;
 
  268     ext1Pos = FileString_GetExtension(strA);
 
  269     ext2Pos = FileString_GetExtension(strB);
 
  274     if ((ext1Pos==-1) && (ext2Pos!=-1))
 
  276     if ((ext2Pos==-1) && (ext1Pos!=-1))
 
  283         ext1 = strA+ext1Pos+1;
 
  284         ext2 = strB+ext2Pos+1;
 
  291         if (FileString_StrCmpNoCase(ext1, ext2, (
int)
strlen(ext1))!=0)
 
  302         file1Len = (int)
strlen(strA);
 
  303         file2Len = (int)
strlen(strB);
 
  307     file1Len = FileString_TrimLength(strA, file1Len);
 
  308     file2Len = FileString_TrimLength(strB, file2Len);
 
  311     if (file1Len!=file2Len)
 
  315     if (FileString_StrCmpNoCase(strA, strB, file1Len)!=0)
 
  332                 if (*path == 
'\\' || *path == 
'/')
 
  348     while (*in && len <= 11)
 
  355         else if ((a>=
'A') && (a<=
'Z'))
 
  375     int ext_pos = FileString_GetExtension(filename);
 
  377     if (ext_pos > 0 && out && maxlen)
 
  379         filename += ext_pos + 1;
 
  381         while (*filename && len < (maxlen-1))
 
  383             char a = *filename++;
 
  386             if ((a>=
'A') && (a<=
'Z'))
 
  407     char seperator = 
'/';
 
  409     if (path && filename && out && maxlen > 0)
 
  411         while (*path && len < (maxlen-2))
 
  421         if (last != 
'\\' && last != 
'/')
 
  424         while (*filename && len < (maxlen-1))
 
  426             *out++ = *filename++;
 
  440 #ifdef FAT_STRING_TESTBENCH 
  481     assert(FileString_GetExtension(
"C:\\file.zip") == 
strlen(
"C:\\file"));
 
  482     assert(FileString_GetExtension(
"C:\\file.zip.ext") == 
strlen(
"C:\\file.zip"));
 
  483     assert(FileString_GetExtension(
"C:\\file.zip.") == 
strlen(
"C:\\file.zip"));
 
  485     assert(FileString_TrimLength(
"C:\\file.zip", 
strlen(
"C:\\file.zip")) == 
strlen(
"C:\\file.zip"));
 
  486     assert(FileString_TrimLength(
"C:\\file.zip   ", 
strlen(
"C:\\file.zip   ")) == 
strlen(
"C:\\file.zip"));