Commit f6213ce7 authored by Eli Zaretskii's avatar Eli Zaretskii

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.
parent e42e662f
......@@ -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++)
......
This diff is collapsed.
......@@ -2362,49 +2362,101 @@ function Square.something:Bar Bar14,148
local function test.me22b 25,297
local function test.me22b me22b25,297
make-src/Makefile,1133
make-src/Makefile,2175
LATEST=1,0
RELEASELIST=2,10
ADASRC=4,104
ASRC=5,171
CSRC=6,197
CPSRC=10,423
ELSRC=13,614
ERLSRC=14,661
FORTHSRC=15,702
FSRC=16,726
HTMLSRC=17,776
JAVASRC=18,844
LUASRC=19,907
MAKESRC=20,926
OBJCSRC=21,943
OBJCPPSRC=22,999
PASSRC=23,1035
PERLSRC=24,1053
PHPSRC=25,1108
PSSRC=26,1156
PROLSRC=27,1173
PYTSRC=28,1210
TEXSRC=29,1227
YSRC=30,1282
SRCS=31,1325
NONSRCS=35,1577
VHDLFLAGS=37,1624
COBOLFLAGS=38,1827
POSTSCRIPTFLAGS=39,1889
TCLFLAGS=40,1943
GETOPTOBJS=42,2002
RXINCLUDE=43,2034
REGEXOBJS=44,2056
CHECKOBJS=46,2075
CHECKFLAGS=47,2105
OBJS=48,2145
CPPFLAGS=49,2190
LDFLAGS=50,2259
WARNINGS=51,2282
CFLAGS=52,2466
FASTCFLAGS=55,2530
FASTCFLAGSWARN=56,2591
FILTER=58,2641
@-$($72,3063
@-$($73,3112
@-$($74,3176
@-$($75,3222
@-$($76,3290
@-$($77,3382
@$(81,3465
@$(82,3513
@$(83,3576
@$(84,3621
@$(85,3688
@$(86,3779
${CHECKOBJS}: CFLAGS=88,3805
@env CHECKEROPTS=92,3921
@$(98,4093
@$(106,4249
@$(110,4373
@$(114,4499
@for i in $(SRCS); do echo $$i;140,5320
$(160,6058
$(163,6119
$(166,6182
$(169,6233
$(172,6322
sdiff --suppress-common-lines --width=width186,6619
sdiff --suppress-common-lines --width=width189,6708
sdiff --suppress-common-lines --width=width192,6796
sdiff --suppress-common-lines --width=width195,6885
TEXTAGS=204,7127
TEXTAGS=def:newcommand:newenvironment ${RUN} etags$* --regex=regex204,7127
${RUN} etags12 --members -o $@ --regex=regex207,7244
${RUN} ./ctags -o $@ --regex=regex213,7393
${RUN} ctags$* -wtTd --globals --members -o $@ --regex=regex216,7469
TEXTAGS=219,7588
TEXTAGS=def:newcommand:newenvironment ${RUN} ctags$* -wt -o $@ --regex=regex219,7588
${RUN} ./extags -e --regex-c=c222,7715
REGEX=59,2695
xx=60,2741
MAKE:MAKE62,2790
RUN=63,2825
RUN=64,2865
OPTIONS=65,2870
ARGS=66,2922
infiles 68,2940
quiettest:quiettest70,3002
test:test79,3409
${CHECKOBJS}:${CHECKOBJS}88,3805
checker:checker90,3849
standalone:standalone96,4062
prof:prof101,4168
fastetags:fastetags104,4198
fastctags:fastctags108,4322
staticetags:staticetags112,4446
rsynctofly:rsynctofly116,4608
rsyncfromfly:rsyncfromfly119,4698
web ftp publish:web ftp publish122,4794
release distrib:release distrib129,5115
tags:tags134,5255
clean:clean136,5267
srclist:srclist139,5302
regexfile:regexfile143,5391
/home/www/pub/etags.c.gz:/home/www/pub/etags.c.gz149,5566
/home/www/pub/software/unix/etags.tar.gz:/home/www/pub/software/unix/etags.tar.gz156,5825
regex.o:regex.o159,6031
getopt.o:getopt.o162,6086
getopt1.o:getopt1.o165,6147
etags:etags168,6210
ctags:ctags171,6299
man manpage:man manpage174,6396
etags.1.man:etags.1.man176,6422
maintaining.info:maintaining.info179,6475
TAGS:TAGS182,6557
%ediff:%ediff185,6587
oediff:oediff188,6677
%cdiff:%cdiff191,6764
xdiff:xdiff194,6854
ETAGS:ETAGS197,6942
ETAGS%:ETAGS%200,7012
ETAGS13 ETAGS14 ETAGS15:ETAGS13 ETAGS14 ETAGS15203,7084
ETAGS12:ETAGS12206,7216
OTAGS:OTAGS209,7304
CTAGS:CTAGS212,7369
CTAGS%:CTAGS%215,7443
CTAGS13 CTAGS14 CTAGS15:CTAGS13 CTAGS14 CTAGS15218,7545
EXTAGS:EXTAGS221,7680
.PRECIOUS:.PRECIOUS224,7838
FRC:FRC226,7894
objc-src/Subprocess.h,98
#define Subprocess 41,1217
......@@ -3009,7 +3061,7 @@ module ModuleExample1,0
def module_instance_method46,1051
def ModuleExample.module_class_methodmodule_class_method49,1131
ruby-src/test1.ruby,635
ruby-src/test1.ru,635
class A1,0
def a(2,8
def b(5,38
......
......@@ -2931,50 +2931,101 @@ function Square.something:Bar Bar14,148
local function test.me22b 25,297
local function test.me22b me22b25,297
make-src/Makefile,1156
make-src/Makefile,2175
LATEST=1,0
RELEASELIST=2,10
ADASRC=4,104
ASRC=5,171
CSRC=6,197
CPSRC=10,423
ELSRC=13,614
ERLSRC=14,661
FORTHSRC=15,702
FSRC=16,726
HTMLSRC=17,776
JAVASRC=18,844
LUASRC=19,907
MAKESRC=20,926
OBJCSRC=21,943
OBJCPPSRC=22,999
PASSRC=23,1035
PERLSRC=24,1053
PHPSRC=25,1108
PSSRC=26,1156
PROLSRC=27,1173
PYTSRC=28,1210
TEXSRC=29,1227
YSRC=30,1282
SRCS=31,1325
NONSRCS=35,1577
VHDLFLAGS=37,1624
COBOLFLAGS=38,1827
POSTSCRIPTFLAGS=39,1889
TCLFLAGS=40,1943
GETOPTOBJS=42,2002
RXINCLUDE=43,2034
REGEXOBJS=44,2056
CHECKOBJS=46,2075
CHECKFLAGS=47,2105
OBJS=48,2145
CPPFLAGS=49,2190
LDFLAGS=50,2259
WARNINGS=51,2282
CFLAGS=52,2466
FASTCFLAGS=55,2530
FASTCFLAGSWARN=56,2591
FILTER=58,2641
@-$($72,3063
@-$($73,3112
@-$($74,3176
@-$($75,3222
@-$($76,3290
@-$($77,3382
@$(81,3465
@$(82,3513
@$(83,3576
@$(84,3621
@$(85,3688
@$(86,3779
${CHECKOBJS}: CFLAGS=88,3805
@env CHECKEROPTS=92,3921
@$(98,4093
@$(106,4249
@$(110,4373
@$(114,4499
@for i in $(140,5320
@for i in $(SRCS); do echo $$i;140,5320
$(160,6058
$(163,6119
$(166,6182
$(169,6233
$(172,6322
sdiff --suppress-common-lines --width=width186,6619
sdiff --suppress-common-lines --width=width189,6708
sdiff --suppress-common-lines --width=width192,6796
sdiff --suppress-common-lines --width=width195,6885
TEXTAGS=204,7127
TEXTAGS=def:newcommand:newenvironment ${RUN} etags$* --regex=regex204,7127
${RUN} etags12 --members -o $@ --regex=regex207,7244
${RUN} ./ctags -o $@ --regex=regex213,7393
${RUN} ctags$* -wtTd --globals --members -o $@ --regex=regex216,7469
TEXTAGS=219,7588
TEXTAGS=def:newcommand:newenvironment ${RUN} ctags$* -wt -o $@ --regex=regex219,7588
${RUN} ./extags -e --regex-c=c222,7715
REGEX=59,2695
xx=60,2741
MAKE:MAKE62,2790
RUN=63,2825
RUN=64,2865
OPTIONS=65,2870
ARGS=66,2922
infiles 68,2940
quiettest:quiettest70,3002
test:test79,3409
${CHECKOBJS}:${CHECKOBJS}88,3805
checker:checker90,3849
standalone:standalone96,4062
prof:prof101,4168
fastetags:fastetags104,4198
fastctags:fastctags108,4322
staticetags:staticetags112,4446
rsynctofly:rsynctofly116,4608
rsyncfromfly:rsyncfromfly119,4698
web ftp publish:web ftp publish122,4794
release distrib:release distrib129,5115
tags:tags134,5255
clean:clean136,5267
srclist:srclist139,5302
regexfile:regexfile143,5391
/home/www/pub/etags.c.gz:/home/www/pub/etags.c.gz149,5566
/home/www/pub/software/unix/etags.tar.gz:/home/www/pub/software/unix/etags.tar.gz156,5825
regex.o:regex.o159,6031
getopt.o:getopt.o162,6086
getopt1.o:getopt1.o165,6147
etags:etags168,6210
ctags:ctags171,6299
man manpage:man manpage174,6396
etags.1.man:etags.1.man176,6422
maintaining.info:maintaining.info179,6475
TAGS:TAGS182,6557
%ediff:%ediff185,6587
oediff:oediff188,6677
%cdiff:%cdiff191,6764
xdiff:xdiff194,6854
ETAGS:ETAGS197,6942
ETAGS%:ETAGS%200,7012
ETAGS13 ETAGS14 ETAGS15:ETAGS13 ETAGS14 ETAGS15203,7084
ETAGS12:ETAGS12206,7216
OTAGS:OTAGS209,7304
CTAGS:CTAGS212,7369
CTAGS%:CTAGS%215,7443
CTAGS13 CTAGS14 CTAGS15:CTAGS13 CTAGS14 CTAGS15218,7545
EXTAGS:EXTAGS221,7680
.PRECIOUS:.PRECIOUS224,7838
FRC:FRC226,7894
objc-src/Subprocess.h,98
#define Subprocess 41,1217
......@@ -3580,7 +3631,7 @@ module ModuleExample1,0
def module_instance_method46,1051
def ModuleExample.module_class_methodmodule_class_method49,1131
ruby-src/test1.ruby,635
ruby-src/test1.ru,635
class A1,0
def a(2,8
def b(5,38
......
......@@ -2682,49 +2682,101 @@ function Square.something:Bar Bar14,148
local function test.me22b 25,297
local function test.me22b me22b25,297
make-src/Makefile,1133
make-src/Makefile,2175
LATEST=1,0
RELEASELIST=2,10
ADASRC=4,104
ASRC=5,171
CSRC=6,197
CPSRC=10,423
ELSRC=13,614
ERLSRC=14,661
FORTHSRC=15,702
FSRC=16,726
HTMLSRC=17,776
JAVASRC=18,844
LUASRC=19,907
MAKESRC=20,926
OBJCSRC=21,943
OBJCPPSRC=22,999
PASSRC=23,1035
PERLSRC=24,1053
PHPSRC=25,1108
PSSRC=26,1156
PROLSRC=27,1173
PYTSRC=28,1210
TEXSRC=29,1227
YSRC=30,1282
SRCS=31,1325
NONSRCS=35,1577
VHDLFLAGS=37,1624
COBOLFLAGS=38,1827
POSTSCRIPTFLAGS=39,1889
TCLFLAGS=40,1943
GETOPTOBJS=42,2002
RXINCLUDE=43,2034
REGEXOBJS=44,2056
CHECKOBJS=46,2075
CHECKFLAGS=47,2105
OBJS=48,2145
CPPFLAGS=49,2190
LDFLAGS=50,2259
WARNINGS=51,2282
CFLAGS=52,2466
FASTCFLAGS=55,2530
FASTCFLAGSWARN=56,2591
FILTER=58,2641
@-$($72,3063
@-$($73,3112
@-$($74,3176
@-$($75,3222
@-$($76,3290
@-$($77,3382
@$(81,3465
@$(82,3513
@$(83,3576
@$(84,3621
@$(85,3688
@$(86,3779
${CHECKOBJS}: CFLAGS=88,3805
@env CHECKEROPTS=92,3921
@$(98,4093
@$(106,4249
@$(110,4373
@$(114,4499
@for i in $(SRCS); do echo $$i;140,5320
$(160,6058
$(163,6119
$(166,6182
$(169,6233
$(172,6322
sdiff --suppress-common-lines --width=width186,6619
sdiff --suppress-common-lines --width=width189,6708
sdiff --suppress-common-lines --width=width192,6796
sdiff --suppress-common-lines --width=width195,6885
TEXTAGS=204,7127
TEXTAGS=def:newcommand:newenvironment ${RUN} etags$* --regex=regex204,7127
${RUN} etags12 --members -o $@ --regex=regex207,7244
${RUN} ./ctags -o $@ --regex=regex213,7393
${RUN} ctags$* -wtTd --globals --members -o $@ --regex=regex216,7469
TEXTAGS=219,7588
TEXTAGS=def:newcommand:newenvironment ${RUN} ctags$* -wt -o $@ --regex=regex219,7588
${RUN} ./extags -e --regex-c=c222,7715
REGEX=59,2695
xx=60,2741
MAKE:MAKE62,2790
RUN=63,2825
RUN=64,2865
OPTIONS=65,2870
ARGS=66,2922
infiles 68,2940
quiettest:quiettest70,3002
test:test79,3409
${CHECKOBJS}:${CHECKOBJS}88,3805
checker:checker90,3849
standalone:standalone96,4062
prof:prof101,4168
fastetags:fastetags104,4198
fastctags:fastctags108,4322
staticetags:staticetags112,4446
rsynctofly:rsynctofly116,4608
rsyncfromfly:rsyncfromfly119,4698
web ftp publish:web ftp publish122,4794
release distrib:release distrib129,5115
tags:tags134,5255
clean:clean136,5267
srclist:srclist139,5302
regexfile:regexfile143,5391
/home/www/pub/etags.c.gz:/home/www/pub/etags.c.gz149,5566
/home/www/pub/software/unix/etags.tar.gz:/home/www/pub/software/unix/etags.tar.gz156,5825
regex.o:regex.o159,6031
getopt.o:getopt.o162,6086
getopt1.o:getopt1.o165,6147
etags:etags168,6210
ctags:ctags171,6299
man manpage:man manpage174,6396
etags.1.man:etags.1.man176,6422
maintaining.info:maintaining.info179,6475
TAGS:TAGS182,6557
%ediff:%ediff185,6587
oediff:oediff188,6677
%cdiff:%cdiff191,6764
xdiff:xdiff194,6854
ETAGS:ETAGS197,6942
ETAGS%:ETAGS%200,7012
ETAGS13 ETAGS14 ETAGS15:ETAGS13 ETAGS14 ETAGS15203,7084
ETAGS12:ETAGS12206,7216
OTAGS:OTAGS209,7304
CTAGS:CTAGS212,7369
CTAGS%:CTAGS%215,7443
CTAGS13 CTAGS14 CTAGS15:CTAGS13 CTAGS14 CTAGS15218,7545
EXTAGS:EXTAGS221,7680
.PRECIOUS:.PRECIOUS224,7838
FRC:FRC226,7894
objc-src/Subprocess.h,98
#define Subprocess 41,1217
......@@ -3356,7 +3408,7 @@ module ModuleExample1,0
def module_instance_method46,1051
def ModuleExample.module_class_methodmodule_class_method49,1131
ruby-src/test1.ruby,635
ruby-src/test1.ru,635
class A1,0
def a(2,8
def b(5,38
......
......@@ -2526,49 +2526,101 @@ function Square.something:Bar Bar14,148
local function test.me22b 25,297
local function test.me22b me22b25,297
make-src/Makefile,1133
make-src/Makefile,2175
LATEST=1,0
RELEASELIST=2,10
ADASRC=4,104
ASRC=5,171
CSRC=6,197
CPSRC=10,423
ELSRC=13,614
ERLSRC=14,661
FORTHSRC=15,702
FSRC=16,726
HTMLSRC=17,776
JAVASRC=18,844
LUASRC=19,907
MAKESRC=20,926
OBJCSRC=21,943
OBJCPPSRC=22,999
PASSRC=23,1035
PERLSRC=24,1053
PHPSRC=25,1108
PSSRC=26,1156
PROLSRC=27,1173
PYTSRC=28,1210
TEXSRC=29,1227
YSRC=30,1282
SRCS=31,1325
NONSRCS=35,1577
VHDLFLAGS=37,1624
COBOLFLAGS=38,1827
POSTSCRIPTFLAGS=39,1889
TCLFLAGS=40,1943
GETOPTOBJS=42,2002
RXINCLUDE=43,2034
REGEXOBJS=44,2056
CHECKOBJS=46,2075
CHECKFLAGS=47,2105
OBJS=48,2145
CPPFLAGS=49,2190
LDFLAGS=50,2259
WARNINGS=51,2282
CFLAGS=52,2466
FASTCFLAGS=55,2530
FASTCFLAGSWARN=56,2591
FILTER=58,2641
@-$($72,3063
@-$($73,3112
@-$($74,3176
@-$($75,3222
@-$($76,3290
@-$($77,3382
@$(81,3465
@$(82,3513
@$(83,3576
@$(84,3621
@$(85,3688
@$(86,3779
${CHECKOBJS}: CFLAGS=88,3805
@env CHECKEROPTS=92,3921
@$(98,4093
@$(106,4249
@$(110,4373
@$(114,4499
@for i in $(SRCS); do echo $$i;140,5320
$(160,6058
$(163,6119
$(166,6182
$(169,6233
$(172,6322
sdiff --suppress-common-lines --width=width186,6619
sdiff --suppress-common-lines --width=width189,6708
sdiff --suppress-common-lines --width=width192,6796
sdiff --suppress-common-lines --width=width195,6885
TEXTAGS=204,7127
TEXTAGS=def:newcommand:newenvironment ${RUN} etags$* --regex=regex204,7127
${RUN} etags12 --members -o $@ --regex=regex207,7244
${RUN} ./ctags -o $@ --regex=regex213,7393
${RUN} ctags$* -wtTd --globals --members -o $@ --regex=regex216,7469
TEXTAGS=219,7588
TEXTAGS=def:newcommand:newenvironment ${RUN} ctags$* -wt -o $@ --regex=regex219,7588
${RUN} ./extags -e --regex-c=c222,7715
REGEX=59,2695
xx=60,2741
MAKE:MAKE62,2790
RUN=63,2825
RUN=64,2865
OPTIONS=65,2870
ARGS=66,2922
infiles 68,2940
quiettest:quiettest70,3002
test:test79,3409
${CHECKOBJS}:${CHECKOBJS}88,3805
checker:checker90,3849
standalone:standalone96,4062
prof:prof101,4168
fastetags:fastetags104,4198
fastctags:fastctags108,4322
staticetags:staticetags112,4446
rsynctofly:rsynctofly116,4608
rsyncfromfly:rsyncfromfly119,4698
web ftp publish:web ftp publish122,4794
release distrib:release distrib129,5115
tags:tags134,5255
clean:clean136,5267
srclist:srclist139,5302
regexfile:regexfile143,5391
/home/www/pub/etags.c.gz:/home/www/pub/etags.c.gz149,5566
/home/www/pub/software/unix/etags.tar.gz:/home/www/pub/software/unix/etags.tar.gz156,5825
regex.o:regex.o159,6031
getopt.o:getopt.o162,6086
getopt1.o:getopt1.o165,6147
etags:etags168,6210
ctags:ctags171,6299
man manpage:man manpage174,6396
etags.1.man:etags.1.man176,6422
maintaining.info:maintaining.info179,6475
TAGS:TAGS182,6557
%ediff:%ediff185,6587
oediff:oediff188,6677
%cdiff:%cdiff191,6764
xdiff:xdiff194,6854
ETAGS:ETAGS197,6942
ETAGS%:ETAGS%200,7012
ETAGS13 ETAGS14 ETAGS15:ETAGS13 ETAGS14 ETAGS15203,7084
ETAGS12:ETAGS12206,7216
OTAGS:OTAGS209,7304
CTAGS:CTAGS212,7369
CTAGS%:CTAGS%215,7443
CTAGS13 CTAGS14 CTAGS15:CTAGS13 CTAGS14 CTAGS15218,7545
EXTAGS:EXTAGS221,7680
.PRECIOUS:.PRECIOUS224,7838
FRC:FRC226,7894
objc-src/Subprocess.h,98
#define Subprocess 41,1217
......@@ -3173,7 +3225,7 @@ module ModuleExample1,0
def module_instance_method46,1051
def ModuleExample.module_class_methodmodule_class_method49,1131
ruby-src/test1.ruby,635
ruby-src/test1.ru,635
class A1,0
def a(2,8
def b(5,38
......
......@@ -3415,50 +3415,101 @@ function Square.something:Bar Bar14,148
local function test.me22b 25,297
local function test.me22b me22b25,297
make-src/Makefile,1156
make-src/Makefile,2175
LATEST=1,0
RELEASELIST=2,10
ADASRC=4,104
ASRC=5,171
CSRC=6,197
CPSRC=10,423
ELSRC=13,614
ERLSRC=14,661
FORTHSRC=15,702
FSRC=16,726
HTMLSRC=17,776
JAVASRC=18,844
LUASRC=19,907
MAKESRC=20,926
OBJCSRC=21,943
OBJCPPSRC=22,999
PASSRC=23,1035
PERLSRC=24,1053
PHPSRC=25,1108
PSSRC=26,1156
PROLSRC=27,1173
PYTSRC=28,1210