Why doesn't ls use fnmatch() when matching against extensions in $LS_COLORS?
Nikolai Weibull <[email protected]> Thu, 6 Jul 2006 17:11:09 +0000 (UTC)
| Newsgroups | gmane.comp.gnu.core-utils.bugs,gmane.comp.gnu.fileutils.bugs |
|---|---|
| Message-ID | <[email protected]> |
The test that ls employs for determining if a file should be given some certain kind of highlighting when listed currently uses strncmp() to compare the last few characters of a file's name against the extensions found in $LS_COLORS. Why is fnmatch() not being used to do this test? As it is now, the '*' can only be given as a prefix and is just part of a big charade. It also makes matching things like *.r[0-9][0-9] for parts in a rar-archive set impossible without listing them explicitly in your dircolors file. I assume that there is some higher reason for this, as a patch to use fnmatch() instead of strncmp() is incredibly trivial, but I fail to see what it is. Thanks. nikolai