Get lowercase file extension from path */
| 5555 | |
| 5556 | /* Get lowercase file extension from path */ |
| 5557 | static const char *file_ext(const char *path) { |
| 5558 | if (!path) { |
| 5559 | return NULL; |
| 5560 | } |
| 5561 | const char *dot = strrchr(path, '.'); |
| 5562 | if (!dot) { |
| 5563 | return NULL; |
| 5564 | } |
| 5565 | static CBM_TLS char buf[CBM_SZ_16]; |
| 5566 | int len = (int)strlen(dot); |
| 5567 | if (len >= (int)sizeof(buf)) { |
| 5568 | return NULL; |
| 5569 | } |
| 5570 | for (int i = 0; i < len; i++) { |
| 5571 | buf[i] = (char)((dot[i] >= 'A' && dot[i] <= 'Z') ? dot[i] + CBM_SZ_32 : dot[i]); |
| 5572 | } |
| 5573 | buf[len] = '\0'; |
| 5574 | return buf; |
| 5575 | } |
| 5576 | |
| 5577 | /* ── Architecture aspect implementations ───────────────────────── */ |
| 5578 |