Get lowercase file extension from path */
| 8825 | |
| 8826 | /* Get lowercase file extension from path */ |
| 8827 | static const char *file_ext(const char *path) { |
| 8828 | if (!path) { |
| 8829 | return NULL; |
| 8830 | } |
| 8831 | const char *dot = strrchr(path, '.'); |
| 8832 | if (!dot) { |
| 8833 | return NULL; |
| 8834 | } |
| 8835 | static CBM_TLS char buf[CBM_SZ_16]; |
| 8836 | int len = (int)strlen(dot); |
| 8837 | if (len >= (int)sizeof(buf)) { |
| 8838 | return NULL; |
| 8839 | } |
| 8840 | for (int i = 0; i < len; i++) { |
| 8841 | buf[i] = (char)((dot[i] >= 'A' && dot[i] <= 'Z') ? dot[i] + CBM_SZ_32 : dot[i]); |
| 8842 | } |
| 8843 | buf[len] = '\0'; |
| 8844 | return buf; |
| 8845 | } |
| 8846 | |
| 8847 | /* ── Architecture aspect implementations ───────────────────────── */ |
| 8848 |