| 292 | */ |
| 293 | |
| 294 | size_t normalize_dirname(char *to, const char *from) |
| 295 | { |
| 296 | size_t length; |
| 297 | char buff[FN_REFLEN]; |
| 298 | DBUG_ENTER("normalize_dirname"); |
| 299 | |
| 300 | /* |
| 301 | Despite the name, this actually converts the name to the system's |
| 302 | format (TODO: name this properly). |
| 303 | */ |
| 304 | (void) intern_filename(buff, from); |
| 305 | length= strlen(buff); /* Fix that '/' is last */ |
| 306 | if (length && |
| 307 | #ifdef FN_DEVCHAR |
| 308 | buff[length - 1] != FN_DEVCHAR && |
| 309 | #endif |
| 310 | buff[length - 1] != FN_LIBCHAR && buff[length - 1] != '/') |
| 311 | { |
| 312 | /* we need reserve 2 bytes for the trailing slash and the zero */ |
| 313 | if (length >= sizeof (buff) - 1) |
| 314 | length= sizeof (buff) - 2; |
| 315 | buff[length]= FN_LIBCHAR; |
| 316 | buff[length + 1]= '\0'; |
| 317 | } |
| 318 | |
| 319 | length=cleanup_dirname(to, buff); |
| 320 | |
| 321 | DBUG_RETURN(length); |
| 322 | } |
| 323 | |
| 324 | |
| 325 | /** |
no test coverage detected