| 3851 | If extensions are the same, compare by file names instead. */ |
| 3852 | |
| 3853 | static int |
| 3854 | cmp_extension (struct fileinfo const *a, struct fileinfo const *b, |
| 3855 | int (*cmp) (char const *, char const *)) |
| 3856 | { |
| 3857 | char const *base1 = strrchr (a->name, '.'); |
| 3858 | char const *base2 = strrchr (b->name, '.'); |
| 3859 | int diff = cmp (base1 ? base1 : "", base2 ? base2 : ""); |
| 3860 | return diff ? diff : cmp (a->name, b->name); |
| 3861 | } |
| 3862 | |
| 3863 | /* Return the (cached) screen width, |
| 3864 | for the NAME associated with the passed fileinfo F. */ |