| 19 | /* Functions definied in this file */ |
| 20 | |
| 21 | size_t dirname_length(const char *name) |
| 22 | { |
| 23 | register char *pos, *gpos; |
| 24 | #ifdef BASKSLASH_MBTAIL |
| 25 | CHARSET_INFO *fs= fs_character_set(); |
| 26 | #endif |
| 27 | #ifdef FN_DEVCHAR |
| 28 | if ((pos=(char*)strrchr(name,FN_DEVCHAR)) == 0) |
| 29 | #endif |
| 30 | pos=(char*) name-1; |
| 31 | |
| 32 | gpos= pos++; |
| 33 | for ( ; *pos ; pos++) /* Find last FN_LIBCHAR */ |
| 34 | { |
| 35 | #ifdef BASKSLASH_MBTAIL |
| 36 | uint l; |
| 37 | if (use_mb(fs) && (l= my_ismbchar(fs, pos, pos + 3))) |
| 38 | { |
| 39 | pos+= l - 1; |
| 40 | continue; |
| 41 | } |
| 42 | #endif |
| 43 | if (*pos == FN_LIBCHAR || *pos == '/') |
| 44 | gpos=pos; |
| 45 | } |
| 46 | return (size_t) (gpos+1-(char*) name); |
| 47 | } |
| 48 | |
| 49 | |
| 50 | /* |
no test coverage detected