summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2016-02-02 20:01:33 +0200
committerEli Zaretskii <eliz@gnu.org>2016-02-02 20:01:33 +0200
commitf6213ce79981747b3cb2c8213710986b93999fe5 (patch)
tree79eb99c5cbcb1e401935d58af902a1ce379782f8 /lib-src
parente42e662f26523ba0d10c41ab6deead85077c9f79 (diff)
downloademacs-f6213ce79981747b3cb2c8213710986b93999fe5.tar.gz
Fix file-name recognition in 'etags'
* lib-src/etags.c (get_language_from_filename): If FILE includes a leading directory, compare only its basename to the known file names in lang_names[]. * test/etags/Makefile (RBSRC): Adapt to recent test1.ruby renaming. * test/etags/ETAGS.good_1: * test/etags/ETAGS.good_2: * test/etags/ETAGS.good_3: * test/etags/ETAGS.good_4: * test/etags/ETAGS.good_5: * test/etags/ETAGS.good_6: * test/etags/CTAGS.good: Adapt to changes in Ruby file names and to the results in Makefile due to the above etags.c fix.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/etags.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib-src/etags.c b/lib-src/etags.c
index acf20ddceb9..760685a6693 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -1485,8 +1485,16 @@ get_language_from_filename (char *file, int case_sensitive)
{
language *lang;
const char **name, **ext, *suffix;
+ char *slash;
/* Try whole file name first. */
+ slash = strrchr (file, '/');
+ if (slash != NULL)
+ file = slash + 1;
+#ifdef DOS_NT
+ else if (file[0] && file[1] == ':')
+ file += 2;
+#endif
for (lang = lang_names; lang->name != NULL; lang++)
if (lang->filenames != NULL)
for (name = lang->filenames; *name != NULL; name++)